import osc """ simpleOSC 0.2 ixi software - July, 2006 www.ixi-software.net """ print "TUIO to Csound" print "=================================================" print "Creates sigle OSC messages readable by Csound" print "extracting data from message bundle sent" print "Tuio localhost 3333 to localhost 5775" print "/tuio/2Dcur active in /tuio/2Dcur/active" print "/tuio/2Dcur set in /tuio/2Dcur/set" print "Free Software - do whatever you want with it" print "Site: http://triceratupuz.altervista.org" print "Contact: v a l l s t e -at- l i b e r o -dot- i t" print "=================================================\n" def myTest(): osc.init() osc.listen('127.0.0.1', 3333) #listen to port 3333 print 'ready to receive and send osc messages ...' while 1: osc.bind(cleanStuff, "/tuio/2Dcur") osc.dontListen() # finally close the connection bfore exiting or program def cleanStuff(*msg): messaType = msg[0][2] if messaType == "alive": attivi = [-1] * 15 # print "Attivi", len(msg[0]) - 3 index = 3 while index < len(msg[0]):# < 10 + 4: # print "attivo", index, ":" , msg[0][index] attivi[index-3] = msg[0][index] index= index+1 msgacti = ["iiiiiiiiiiiiiii"] + attivi print msgacti osc.sendMsg("/tuio/2Dcur/active", msgacti, "127.0.0.1", 5775) elif messaType == "set": # print msg msgset = ["ffffff", msg[0][3], msg[0][4], msg[0][5], msg[0][6], msg[0][7], msg[0][8]] print msgset osc.sendMsg("/tuio/2Dcur/set", msgset, "127.0.0.1", 5775) if __name__ == '__main__': myTest()