OSC and Pbind

OSC and Pbind

Hello all!

I have a simple Pbind (Pbindef would also an option):

Pbind(

\dur, 1,

\midinote, Pseq([60, 62, 64, 65, 67, 65, 64, 62], inf),

\legato, Pkey(\midinote).linlin(60, 67, 0.5, 0.25),

\amp, Pseq([0.8, 0.2, 0.4, 0.2], inf)

);

the resulting data should be send to a Player Piano like device via OSC .

I have tried to do a simpler version with fixed values only within a Routine, which works, but I am searching for a method to convert Pbinds like above and far more complicated versions with algorithmic compositions that already exist and use a lot of Pdefs, which to my knowledge is hard to do in a Routine.

Is there a method to „convert“ the outcome of a Pind directly to OSC data? I know the definitions (OSC names etc.) for all messages the device will react to but I have no idea how to write such code.

(the \legato values need to be converted to some sort of „note off“ messages, as the device understands \amp = 0.0 as „note off“)

Thanks for any assistence!

best

Rainer

What you’re asking about is an event type. Basically, this is a function that reads values from the event and performs any action you want, including sending OSC.

Event.addEventType(\nameOfMyEventType, { |server|
    .... your logic here ....
});

Then you would include \type, \nameOfMyEventType in your Pbind.

The logic itself is up to you – this is just where to put it, and how to access it.

hjh

hello jamshark!
great thanks for your assistence!
this is the missing link!
best regards
Rainer