[chuck-users] ChuK control via OSC

altern altern2 at gmail.com
Tue Jan 16 03:50:26 EST 2007


hi karl

karl petermichl wrote:
> 
> * Sorry to flood the list with so many questions, *

i do it all the time as well ;)

> but I have to get ChuK and myself ready for the first date in public 
> together (read: live gig) quite soon. The only funcionality which I am 
> lacking for this first gig is some kind of graphic fader for adjusting 
> variables on the fly. I know it is all about live coding, but I really 
> would like to feed my sound generators with some "fluid floats" (or 
> ints). I got into OSC, and I do understand the sending and receiving OSC 
> examples.
>  
> I also found the OSC commands within JAVA, and a nice little application 
> called JAVAOSC. Those four faders would be all that I need, I just 
> cannot figure out which OSC codesc JAVAOSC is transmitting to the 
> localhost. I searched for an OSC-Analyser, but the only one I could find 
> exists for MAC and LINUX exclusively, and I am running XP (ok, sorry, 
> way uncool, I know, but I really needed the harddisc space for audio 
> samples, so I had to erase my ReiserFS partition...).

the easiest way to send/receive OSC i know is using python. It gets as 
simple as this:
import osc
osc.init()
osc.sendMsg('/blah', [6.9999])

For this you need to install python
www.python.org
and SimpleOSC library for python
http://www.ixi-software.net/content/download/simpleosc0.2.3.zip
To install simpleosc you can use the setup.py from command line or just
uncompress the zip and copy the osc folder into
c:\Python2.x\Lib\site-packages
check readme.txt file and app.py example for detailes on how to use.

To create a GUI with faders you could use few python libraries, being 
TKinter (GUI toolkit by default included Python) the easiest, others 
candidates would be FLTK, WXPython, GTK, QT ...

this is the tkinter reference for that Range widget (fader)
http://infohost.nmt.edu/tcc/help/pubs/tkinter/scale.html
This is an example of one fader sending osc to localhost on port 9000 
(comments start with #)


from Tkinter import *
import osc

osc.init() # start osc library

# this function will be called every time the slider changes value
def sendValue(value) :
     osc.sendMsg('/slider1', [value], "127.0.0.1", 9000)

window = Tk() # create window
# create slider and bind it to sendValue function
h = Scale(window, from_=0, to=200, orient=HORIZONTAL, command=sendValue)
h.pack() # put slider in the window
mainloop() # enter main loop


you can copy this code and paste it into notepad then save it as 
myslider.py, to run the scripts under windows just doubleclick it.

Again if you want a crossplatform GUI that sends automatically OSC you 
could check something i did just couple of weeks ago.
http://ixi-software.net/content/body_backyard_python.html
It is called zombi, and it is kind of usable. Very primitive yet. It is 
done with python and wxpython but it can be used from ChucK so you dont 
have to do a single line of python if you dont want to.

On a different direction there is a java based GUI server called 
swingOSC, this is done for supercollider but i guess it could be used 
with chuck as well.

good luck

enrike

> So does anyone of you know which codes JAVAOSC is transmitting by 
> default? Are there other simple ways of transmitting OSC commands to 
> ChuK? I tried the software PROCESSING and TAPSTREAM, but in both cases 
> it was obvious to me how to assign OSC commands to faders.
>  
> Thank you again for your advice,
> karl.
> 
>  
> 
> 
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.432 / Virus Database: 268.16.10/626 - Release Date: 
> 14.01.2007 20:29
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users




More information about the chuck-users mailing list