[chuck-users] Communicating with external processes

Gregory Brown gwbrown at uga.edu
Wed Jan 21 00:43:17 EST 2009


It is possible to send multiple (mixed) values in one OSC message.  
Here is a chunk of code I'm working on to let ChucK send data to  

			// send the OSC data	
			xmit.startMsg( "osc_data", "iiff" );   // <----- note the second  
string here -- it can be a combination of "i" and "f" and other things
			col => xmit.addInt;   // col is an int declared above this code chunk
			row => xmit.addInt;   // ditto
			// normalize the 'color' data
			(values[col][row] / Math.pow(2, bit_depth) + 1) / 2  => float color;
			color => xmit.addFloat;
			sounding => xmit.addFloat;  // once the last element is added (the  
"iiff" from above) the message goes out

For more details, check out the osc examples that come with ChucK,  
along with the specs on this page:


I have had good luck this week getting ChucK and Processing to play  
nice together, for what it is worth.

Good night,

  - Greg

On Jan 21, 2009, at 12:29 AM, Andrew McPherson wrote:

> Hi all,
> What are the ways to communicate between ChucK and external  
> programs?  Specifically, my code has a lot of parameters to adjust  
> in real time, and a GUI would be a nice way to do that.  I could  
> put the GUI together in PD or Cocoa, but how can I transmit the  
> data to ChucK?
> The two ways I have found to receive external data are MIDI and  
> OSC.  MIDI control changes can be a little coarse in terms of  
> resolution (even with 14-bit values), and for most programs it'll  
> need some sort of loopback driver to handle the routing.
> OSC seems closer to a generic way of interchanging data, but it  
> looks like I would have to spork a different thread for each  
> parameter I want to receive (since they'd have different  
> addresses), and that I can only receive one value per OSC event.   
> If I wanted, say, to receive 3 floats as part of one message, is  
> there a way to do that?
> Is there a way to read directly from a pipe to another process?   
> I'm thinking of a setup where an event is signaled when new data is  
> available at the input.  Any other thoughts on how to approach this  
> task?
> Thanks much,
> Andrew
> P.S. Semi-related to the above: is there a way to wait on 2 events  
> simultaneously?  Thinking of something like these:
> midiEvent || oscEvent => now; // wait for whichever comes first
> midiEvent || 200::ms => now; // wait with a  
> timeout_______________________________________________
> 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