User-Defined Opcode Database

flip

Flips an incoming floating point value at k-rate.

Download UDO File

Description

This opcode is mostly intended for use with MIDI and OSC controllers but it can likely be used for other things as well.

Syntax

kval flip kin, kmax

Performance

kmax -- Maximum value to flip.

kin -- Input floating point variable.

kval -- Resulting flipped output.

For example, if your kmax was 0, and your MIDI controller is sending values in range 0 - 127, putting it through flip would return values in range -0.000000 to -127.000000.

Code

opcode	flip, k, kk
kin, kmax	xin

kout	=	(kmax - kin)

	xout	kout
		endop

Examples

instr	1

kval	ctrl7	1, 1, 0, 127

kdisp	flip	kval, 127

	printk2	kdisp

		endin

Credits

David Akbari - 2005


Previous Home Next
p5glove   gainslider