[CM] osc and midi receiving changes

Heinrich Taube taube at uiuc.edu
Wed Dec 30 13:00:29 PST 2009


svn has some big changes to osc and midi input that makes things  
easier and more consistent to work with.  the main change is that you  
can now set osc and midi receivers on specific types of incoming  
messages . so for osc you can associate individual receivers with  
particular osc paths:

(osc:receive "/hello" (lambda (m) ...))
(osc:receive "/goobye" (lambda (m) ...))

for midi you can associate receivers with specific midi status opcodes:

(mp:receive mm:on (lambda (m) ...))
(mp:receive mm:bend (lambda (m) ...))

you can have multiple receivers in effect at the same time and you can  
assign a 'default' receiver to handle all messages that no  other  
receiver is assigned to. To set a default receiver just provide the  
function without a path or opcode, eg:

(osc:receive (lambda (m) ...))

(mp:receive (lambda (m) ...))

in the case of default receivers the first element in the message data  
will be the path or midi opcode so the default receiver knows what  
type of message it received (for specific receivers the path or opcode  
are not needed and not part of the data.) all receivers are procedures  
that take a single (list) argument. this list will contain the message  
data received at the port

to clear a receiver specify #f as the receiver value

(mp:receive mm:on #f)

to clear all receivers call the function with no arguments:

(mp:receive)

to see what receivers are in effect use (receive?)

(osc:receive?)
(osc:receive? "/hiho")

also added new function osc:bundle, eg:

(osc:bundle <time> ...)    sends bundles of osc messages at a  
(relative) timetag. so (osc:bundle 0 (...) (...)) sends two messages  
at osc_immediate and (osc:bundle 0.5 ...) sends .5 seconds in the future

ive also optimized osc input and tested it with largish messages of 10  
ints/floats every 15ms  for 20 minutes. s7 handled it fine. also  
reveiving midi input from a disklavier and sprouting processes that  
play acompanyment using SuperCollider synthdefs. =:)




More information about the Cmdist mailing list