User-Defined Opcode Database

p5glove

Unit generator for P5 data glove

Download UDO File

Description

Based on the Max Mathews Radio Baton opcodes from CsoundAV, this Csound5 opcode implements an OSC receiver intended for use with the P5 dataglove.

General information on the p5 dataglove can be found here: http://www.vrealities.com/P5.html

Syntax

kA, kB, kC, kf1, kf2, kf3, kf4, kf5, kX, kY, kZ p5glove

Performance

kA -- glove data from Button A (0 or 1)
kB -- glove data from Button B (0 or 1)
kC -- glove data from Button C (0 or 1)

kf1 -- THUMB bend data (in range 0-63)
kf2 -- INDEX finger bend data (in range 0-63)
kf3 -- MIDDLE finger bend data (in range 0-63)
kf4 -- RING finger bend data (in range 0-63)
kf5 -- PINKY finger bend data (in range 0-63)

kX -- proximity of glove to sensor stand X-AXIS
kY -- proximity of glove to sensor stand Y-AXIS
kZ -- proximity of glove to sensor stand Z-AXIS

NOTE : All values are returned as integers by default. It is recommended to scale the data in your .orc

Code

opcode   p5glove, kkkkkkkkkkk, 0	; p5 glove UDO

giport	OSCinit 47110

kf1 init 0         
kf2 init 0       
kf3 init 0         
kf4 init 0       
kf5 init 0         
kf6 init 0       
kf7 init 0         
kf8 init 0       
kf9 init 0         
kf10 init 0       
kf11 init 0         

	kk  OSClisten giport, "/p5glove_data", "fffffffffff", kf1, kf2, kf3, kf4, kf5, kf6, kf7, kf8, kf9, kf10, kf11

if kk =0 goto ex

	xout	kf1,kf2,kf3,kf4,kf5,kf6,kf7,kf8,kf9,kf10,kf11

	ex:
		endop

Examples

instr	1	; p5 udo controlling a simple pvscale idea

kf1,kf2,kf3,kf4,kf5,kf6,kf7,kf8,kf9,kf10,kf11	p5glove

kamp	=	(kf5 / 63.0) * ampdb(89)
kpch	=	((kf6 / 63.0) * 24) - 12
kpch	=	(2 ^ (kpch / 12))
kcps	=	cpspch(7.08)

a1	oscil	kamp, kcps, 1

f1	pvsanal	a1, 1024, 256, 1024, 1
fs	pvscale	f1, kpch

aout	pvsynth fs

	outs	aout, aout

		endin

Credits

David Akbari - 2005


Previous Home Next
msrOsc   flip