[chuck-users] Determining the address of an OSC message

Brian Robison brobison at gmail.com
Sun Sep 6 18:12:01 EDT 2020


Hello, ChucKers!  I am looking for a way to receive an arbitrary OSC
message and determine its address.  In my toy example, my receiver will
receive messages at /sndadj/lgain and /sndadj/rgain and adjust the gain of
the L or R channel accordingly.

Here's a program that would probably work if there were an
OscEvent.address() function:

SinOsc sl => dac.left;
SinOsc sr => dac.right;

0.5 => sl.gain;
0.5 => sr.gain;

225 => float lfreq;
150 => float rfreq;

lfreq => sl.freq;
rfreq => sr.freq;

OscRecv recv;
6449 => recv.port;
recv.listen();

OscEvent oe;
recv.event("/sndadj/lgain, f" ) @=> oe;
recv.event("/sndadj/rgain, f" ) @=> oe;

while (true) {
    oe => now;

    while (oe.nextMsg() != 0) {
        // XXX - OscEvent.address() doesn't exist
        if (oe.address() == "/sndadj/lgain") {
            oe.getFloat() => sl.gain;
        }
        else {
            oe.getFloat() => sr.gain;
        }
    }
}

I do have a version working with a single /sndadj/gain address which sends
two floats, but it makes my sender uglier and I feel like address
discernment is something ChucK probably does anyway.

Any ideas?  Thanks!

Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20200906/6a347fbb/attachment.html>


More information about the chuck-users mailing list