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

[sc-users] Polling Ugen for MIDI data?



Hey list,

I have a question that seems like must have a straight-forward answer but that I haven't been able to find...

I'm sending midi control messages from SuperCollider out to a DAW. I'd like to generate relatively complex patterns and so far I've been using something like the following, where the Psegs sort of recreate sine functions:

(
Pbind(\type, \midi, \midicmd, \control, \midiout, ~DAW, \chan, 0, \ctlNum, 12,
    \control, (
        Pseg( Pseq([0, 127, 0], 1), Pseq([0.25, 0.25], 1), \sine, inf)*Pseg( Pseq([0, 0.5, 0], 1), Pseq([3, 3], 1), \sine, inf)
    ).round,
    \dur, 0.01,
).play;
)

Is there a way to do this without using Pseg? Basically, I want to be able to control a parameter in my DAW using the output of a Ugen like SinOsc for instance. Is there some way to periodically grab the instantaneous value of a Ugen and pass it to a pattern which could transmit it as a midi control message? - as though Pfunc could be given a Ugen, like in this hypothetical code;

(
Pbind(\type, \midi, \midicmd, \control, \midiout, ~DAW, \chan, 0, \ctlNum, 12,
    \control, (
       Pfunc({ (SinOsc.kr(0.5).range(0, 127))*SinOsc.kr(6, 0, 0.25, 0.25) })
    ).round,
    \dur, 0.01,
).play;
)

Thanks in advance!

Ben