Quantcast

New to SC - Trying to send trigger from pdef to OSC without sending Rest()

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

New to SC - Trying to send trigger from pdef to OSC without sending Rest()

platerytter
Heya,

New to supercollider, been doodling with it the last 6 months, love it. Very intuitive and fun.

Now trying to expand my setup to visuals by sending trigger data from pdefs to OSC (and into touchdesigner), and I'm having some problems as my Rest() functions are also sent.

Is there a way to only send when a synthdef is triggered ? And not every single event ?

Here's my current pdef :

Pdef(
        \kicks,
        Pbind(
                \instrument, \pigSimpler,
                \dur, Prand([1/8,1/2,1/4, 1/16, Rest(2)], inf),
                \buf, Prand(c[\kicks],inf),
                \sendMsg, Pfunc({|ev|  n.sendMsg("/trig", 1.0.rand)});
        );
).play;

This sends a random float value everytime an event is triggered by the \dur key. Works just fine! The problem is that it also sends a new value when it reaches the Rest() key.

Any way of just sending synthdef triggers ? Am I going about this the wrong way ?

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: New to SC - Trying to send trigger from pdef to OSC without sending Rest()

Nathan Ho
Hi platerytter,

Welcome to SC! Unfortunately, this message is in the wrong place. You're looking for the sc-users subforum: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SuperCollider-Users-New-Use-this-f2676391.html

If you post to sc-users, you will need to be subscribed to the sc-users list (see http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx), or sc-users-acl for non-delivery.


Nathan

platerytter wrote
Heya,

New to supercollider, been doodling with it the last 6 months, love it. Very intuitive and fun.

Now trying to expand my setup to visuals by sending trigger data from pdefs to OSC (and into touchdesigner), and I'm having some problems as my Rest() functions are also sent.

Is there a way to only send when a synthdef is triggered ? And not every single event ?

Here's my current pdef :

Pdef(
        \kicks,
        Pbind(
                \instrument, \pigSimpler,
                \dur, Prand([1/8,1/2,1/4, 1/16, Rest(2)], inf),
                \buf, Prand(c[\kicks],inf),
                \sendMsg, Pfunc({|ev|  n.sendMsg("/trig", 1.0.rand)});
        );
).play;

This sends a random float value everytime an event is triggered by the \dur key. Works just fine! The problem is that it also sends a new value when it reaches the Rest() key.

Any way of just sending synthdef triggers ? Am I going about this the wrong way ?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: New to SC - Trying to send trigger from pdef to OSC without sending Rest()

ddw_music
In reply to this post by platerytter
platerytter wrote
Now trying to expand my setup to visuals by sending trigger data from pdefs to OSC (and into touchdesigner), and I'm having some problems as my Rest() functions are also sent.

Is there a way to only send when a synthdef is triggered ? And not every single event ?
Despite being in the wrong place (Nathan is correct), the answer to your question is:

\sendMsg, Pfunc({ |ev|
    if(ev.isRest.not) {
        n.sendMsg("/trig", 1.0.rand)
    } { 0 }  // don't leave out the dummy 'else' { 0 } branch
});

hjh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: New to SC - Trying to send trigger from pdef to OSC without sending Rest()

platerytter
Thanks a bunch! Works great! Apologies for posting in the wrong place!
Loading...