Creating SynthDef with a dynamic Env

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

Creating SynthDef with a dynamic Env

amirteymuri
Hello SC-Forum,

how is it possible to create a Synth which takes as arguments levels and times for creating an Env. I have something like this in mind:


SynthDef(\inst, {
        arg frq = 440, levels, times;
        var sig = SinOsc.ar(freq:frq);
        var env = EnvGen.ar(Env(levels:levels, times:times), doneAction:2);
        Out.ar(0, sig * env)
}).add;

Also can someone tell me why the above code is wrong?

Many thanks,
a
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating SynthDef with a dynamic Env

Nathan Ho
amirteymuri wrote
Hello SC-Forum,

how is it possible to create a Synth which takes as arguments levels and times for creating an Env. I have something like this in mind:


SynthDef(\inst, {
        arg frq = 440, levels, times;
        var sig = SinOsc.ar(freq:frq);
        var env = EnvGen.ar(Env(levels:levels, times:times), doneAction:2);
        Out.ar(0, sig * env)
}).add;

Also can someone tell me why the above code is wrong?

Many thanks,
a
hi amirteymuri,

sorry, but this message is in the wrong place. you will need to post in the "SuperCollider Users" sub-forum here: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SuperCollider-Users-New-Use-this-f2676391.html  also, in order for messages to that list to show up to subscribers, you need to first send a message with body "subscribe sc-users-acl" to majordomo@lists.bham.ac.uk. (this subscribes you to a dummy "access control" list and won't fill up your inbox.)


nathan
Loading...