[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] Pbind, Event and osc messages



On Jul 22, 2009, at 4:44 AM, Thomas Girod wrote:

hi list

I am trying to build a pattern of arbitrary osc messages. Let's write a small
function to send a message passed as an array of values.
...
I also tried to directly replace the \play function inside Pbind, but it
doesn't seems to pass the arguments as it does to an instrument.

You're on the right track here, but 'play' functions in an event don't receive their parameters as function arguments. Instead, they read environment variables from the event.

This works:

d = NetAddr("127.0.0.1", NetAddr.langPort);

o = OSCresponderNode(d, '/foo', { |t, r, m| m.postln }).add;

Pbind(
\play, { ~dest.sendBundle(~latency, ~msg) },
\dur, 1,
\dest, d,
\msg, Pseq(#[["/foo",42],["/foo",23]])
).play;


You can also add a custom event type and then use it just like any other type.

Event.addEventType(\osc, { ~dest.sendBundle(~latency, ~msg) });

Pbind(
\type, \osc,
\dur, 1,
\dest, d,
\msg, Pseq(#[["/foo",42],["/foo",23]])
).play;

hjh


: H. James Harkins
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman