[chuck-users] ChuK control via OSC

karl petermichl audioworld at gmail.com
Wed Jan 17 06:58:08 EST 2007


 
OK, I just could not wait!

Although in a hurry, I had to try out the suggestions from enrike..---))
And Yes, SUCCESS!!! ChucK finally does receive OSC commands!!

The only small change I had to make in enrikes code was my initial fault
(which he spotted but copied over into his example). The type declaration
for the OSC data must read "i" for integer, not "int":
recv.event( "/slider1, i" ) @=> OscEvent oe;

Proudly presenting (with a lot of help from enrike) my first shred which
actually creates sound controlled by a python-fader sending an OSC-command:

SinOsc sinus =>dac;
OscRecv recv;
9000 => recv.port;
recv.listen();
recv.event( "/slider1, i" ) @=> OscEvent oe;
while( true ) {
     oe => now;
     while( oe.nextMsg() ){
         oe.getInt() => int i;
         <<< "got (via OSC):", i>>>;
		 i*5+50=>sinus.freq;
         1::ms=>now;	 
     }
}


This is the python code:

from Tkinter import *
import osc
osc.init()
def sendValue(value) :
        osc.sendMsg('/slider1', [int(value)], "127.0.0.1", 9000)
window = Tk()
h = Scale(window, from_=0, to=200, orient=HORIZONTAL, command=sendValue)
h.pack()
mainloop()


Thank you enrike, without you this would not have been possible!!!
Karl.

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.13/632 - Release Date: 16.01.2007
16:36
 



More information about the chuck-users mailing list