|
Hey everyone,
I'm having an issue building durations into my SC patches. Let's say I have the following line of code: play{PMOsc.ar(440, 440, 4)} How would I modify this so that the process was killed at the end of 1 second? While I've learned much from scavenging the docs, tutorials and book, I've yet to find an answer on this particular topic. Thanks for any help you can offer on this total n00b question.
Jake -- codehop.com | #code #art #music |
|
On a very basic level, applying an envelope to your sound (multiplying by EnvGen, for example) will solve your problem:
( play{ var env; env = EnvGen.kr(Env([0,1,1,0],[0.01,0.98,0.01],\lin),doneAction:2); PMOsc.ar(440, 440, 4) * env; } )
On Sun, Aug 14, 2011 at 5:40 PM, Jacob Joaquin <[hidden email]> wrote: Hey everyone, Eli
|
|
An alternative would be to assign the Synth to a variable, and use a routine to free the synth after 1 second. It would also be worth your while looking into the SynthDef and Synth classes.
{ x = play{PMOsc.ar(440, 440, 4)} 1.wait; x.free; }.fork On 14 August 2011 23:47, Eli Fieldsteel <[hidden email]> wrote: On a very basic level, applying an envelope to your sound (multiplying by EnvGen, for example) will solve your problem: |
|
Thanks for both suggestions! Big help. I'd certainly welcome any other methods anyone has to share. I have 15 years of Csound I'm trying to unlearn so I can make sense of SuperCollider.
Jake On Sun, Aug 14, 2011 at 4:03 PM, Arthur Carabott <[hidden email]> wrote: An alternative would be to assign the Synth to a variable, and use a routine to free the synth after 1 second. It would also be worth your while looking into the SynthDef and Synth classes. codehop.com | #code #art #music |
|
what about Scheduling and Sequencing in Getting Started With SC toot?
Best -a- On Aug 15, 2011, at 1:09 AM, Jacob Joaquin wrote: Thanks for both suggestions! Big help. I'd certainly welcome any other methods anyone has to share. I have 15 years of Csound I'm trying to unlearn so I can make sense of SuperCollider. -------------------------------------------------- Andrea Valle -------------------------------------------------- CIRMA - DAMS Università degli Studi di Torino --> [hidden email] -------------------------------------------------- " This is a very complicated case, Maude. You know, a lotta ins, a lotta outs, a lotta what-have-yous." (Jeffrey 'The Dude' Lebowski) |
|
I'll check these out as well. In the meantime, here's something I
built with my newfound knowledge: fork{{var t=0.2,x=t.rand;play{PMOsc.ar(100+400.rand,400+400.rand,1+4.0.rand)*EnvGen.kr(Env.linen(0,x,0,1),1,1,0,1,2)};(t-x).wait}!999} Best, Jake On Sun, Aug 14, 2011 at 4:20 PM, Andrea Valle <[hidden email]> wrote: > > what about Scheduling and Sequencing in Getting Started With SC toot? > > Best > > -a- > > On Aug 15, 2011, at 1:09 AM, Jacob Joaquin wrote: > > Thanks for both suggestions! Big help. I'd certainly welcome any other methods anyone has to share. I have 15 years of Csound I'm trying to unlearn so I can make sense of SuperCollider. > Jake > > On Sun, Aug 14, 2011 at 4:03 PM, Arthur Carabott <[hidden email]> wrote: >> >> An alternative would be to assign the Synth to a variable, and use a routine to free the synth after 1 second. It would also be worth your while looking into the SynthDef and Synth classes. >> >> { >> >> x = play{PMOsc.ar(440, 440, 4)} >> >> 1.wait; >> >> x.free; >> >> }.fork >> >> On 14 August 2011 23:47, Eli Fieldsteel <[hidden email]> wrote: >>> >>> On a very basic level, applying an envelope to your sound (multiplying by EnvGen, for example) will solve your problem: >>> >>> ( >>> >>> play{ >>> >>> var env; >>> >>> env = EnvGen.kr(Env([0,1,1,0],[0.01,0.98,0.01],\lin),doneAction:2); >>> >>> PMOsc.ar(440, 440, 4) * env; >>> >>> } >>> >>> ) >>> >>> Eli >>> >>> On Sun, Aug 14, 2011 at 5:40 PM, Jacob Joaquin <[hidden email]> wrote: >>>> >>>> Hey everyone, >>>> >>>> I'm having an issue building durations into my SC patches. Let's say I have the following line of code: >>>> >>>> play{PMOsc.ar(440, 440, 4)} >>>> >>>> How would I modify this so that the process was killed at the end of 1 second? While I've learned much from scavenging the docs, tutorials and book, I've yet to find an answer on this particular topic. Thanks for any help you can offer on this total n00b question. >>>> >>>> Jake >>>> -- >>>> codehop.com | #code #art #music >>>> >>> >> > > > > -- > codehop.com | #code #art #music > > > -------------------------------------------------- > Andrea Valle > -------------------------------------------------- > CIRMA - DAMS > Università degli Studi di Torino > --> http://www.cirma.unito.it/andrea/ > --> http://www.myspace.com/andreavalle > --> http://www.flickr.com/photos/vanderaalle/ > --> http://www.youtube.com/user/vanderaalle > --> [hidden email] > -------------------------------------------------- > " This is a very complicated case, Maude. You know, a lotta ins, a lotta outs, a lotta what-have-yous." > (Jeffrey 'The Dude' Lebowski) > > -- codehop.com | #code #art #music _______________________________________________ sc-users mailing list info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml archive: http://www.listarc.bham.ac.uk/marchives/sc-users/ search: http://www.listarc.bham.ac.uk/lists/sc-users/search/ |
|
I can head-bob to this. -j- On Aug 14, 2011, at 7:48 PM, Jacob Joaquin wrote: > I'll check these out as well. In the meantime, here's something I > built with my newfound knowledge: > > fork{{var t=0.2,x=t.rand;play{PMOsc.ar(100+400.rand,400+400.rand,1+4.0.rand)*EnvGen.kr(Env.linen(0,x,0,1),1,1,0,1,2)};(t-x).wait}!999} > > Best, > Jake > > > On Sun, Aug 14, 2011 at 4:20 PM, Andrea Valle <[hidden email]> wrote: >> >> what about Scheduling and Sequencing in Getting Started With SC toot? >> >> Best >> >> -a- >> >> On Aug 15, 2011, at 1:09 AM, Jacob Joaquin wrote: >> >> Thanks for both suggestions! Big help. I'd certainly welcome any other methods anyone has to share. I have 15 years of Csound I'm trying to unlearn so I can make sense of SuperCollider. >> Jake >> >> On Sun, Aug 14, 2011 at 4:03 PM, Arthur Carabott <[hidden email]> wrote: >>> >>> An alternative would be to assign the Synth to a variable, and use a routine to free the synth after 1 second. It would also be worth your while looking into the SynthDef and Synth classes. >>> >>> { >>> >>> x = play{PMOsc.ar(440, 440, 4)} >>> >>> 1.wait; >>> >>> x.free; >>> >>> }.fork >>> >>> On 14 August 2011 23:47, Eli Fieldsteel <[hidden email]> wrote: >>>> >>>> On a very basic level, applying an envelope to your sound (multiplying by EnvGen, for example) will solve your problem: >>>> >>>> ( >>>> >>>> play{ >>>> >>>> var env; >>>> >>>> env = EnvGen.kr(Env([0,1,1,0],[0.01,0.98,0.01],\lin),doneAction:2); >>>> >>>> PMOsc.ar(440, 440, 4) * env; >>>> >>>> } >>>> >>>> ) >>>> >>>> Eli >>>> >>>> On Sun, Aug 14, 2011 at 5:40 PM, Jacob Joaquin <[hidden email]> wrote: >>>>> >>>>> Hey everyone, >>>>> >>>>> I'm having an issue building durations into my SC patches. Let's say I have the following line of code: >>>>> >>>>> play{PMOsc.ar(440, 440, 4)} >>>>> >>>>> How would I modify this so that the process was killed at the end of 1 second? While I've learned much from scavenging the docs, tutorials and book, I've yet to find an answer on this particular topic. Thanks for any help you can offer on this total n00b question. >>>>> >>>>> Jake >>>>> -- >>>>> codehop.com | #code #art #music >>>>> >>>> >>> >> >> >> >> -- >> codehop.com | #code #art #music >> >> >> -------------------------------------------------- >> Andrea Valle >> -------------------------------------------------- >> CIRMA - DAMS >> Università degli Studi di Torino >> --> http://www.cirma.unito.it/andrea/ >> --> http://www.myspace.com/andreavalle >> --> http://www.flickr.com/photos/vanderaalle/ >> --> http://www.youtube.com/user/vanderaalle >> --> [hidden email] >> -------------------------------------------------- >> " This is a very complicated case, Maude. You know, a lotta ins, a lotta outs, a lotta what-have-yous." >> (Jeffrey 'The Dude' Lebowski) >> >> > > > > -- > codehop.com | #code #art #music > > _______________________________________________ > sc-users mailing list > > info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml > archive: http://www.listarc.bham.ac.uk/marchives/sc-users/ > search: http://www.listarc.bham.ac.uk/lists/sc-users/search/ > _______________________________________________ sc-users mailing list info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml archive: http://www.listarc.bham.ac.uk/marchives/sc-users/ search: http://www.listarc.bham.ac.uk/lists/sc-users/search/ |
|
In reply to this post by Jacob Joaquin
hi,
you can use Trig as well, but in that case you have to free the synth {Trig.kr(DC.kr(1),1)*SinOsc.ar(220,mul:0.2)}.play; also you can take a look at Timer, Latch, Impulse (cmd+D shows class helpfile, cmd+Y shows methods implementations) best |
|
In reply to this post by Jacob Joaquin
At Sun, 14 Aug 2011 16:09:03 -0700,
Jacob Joaquin wrote: > Thanks for both suggestions! Big help. I'd certainly welcome any other methods anyone has to > share. I have 15 years of Csound I'm trying to unlearn so I can make sense of SuperCollider. If you're coming from csound, you might find Events to your liking. Instead of having to fork something for every note, an event already includes "sustain" information (loosely corresponding to p3) and takes care of the release for you. Your SynthDef does need to include an EnvGen with doneAction: 2, e.g. SynthDef(\pmosc, { |freq = 440, gate = 1, out = 0| var env; env = EnvGen.kr(Env.adsr, gate, doneAction: 2); Out.ar(out, (PMOsc.ar(freq, freq, 4) * env).dup(2)); }).add; // Play an Event (instrument: \pmosc, sustain: 2).play; So, now you have a way to write parameter names and values in a single line (maybe a long line) *including* duration. There are some reserved parameter names -- see these help files: PG_07_Value_Conversions PG_08_Event_Types_and_Parameters This example uses a "gated" envelope, with a sustain phase (IIRC the Env help file discusses this). You can also have an envelope that just plays for a given amount of time and stops automatically. In that case you would leave out 'gate' from the SynthDef argument list. I could post another example of that later... but this may be enough to digest for now. Hope that helps, hjh -- James Harkins /// dewdrop world [hidden email] http://www.dewdrop-world.net "Come said the Muse, Sing me a song no poet has yet chanted, Sing me the universal." -- Whitman blog: http://www.dewdrop-world.net/words audio clips: http://www.dewdrop-world.net/audio more audio: http://soundcloud.com/dewdrop_world/tracks _______________________________________________ sc-users mailing list info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml archive: http://www.listarc.bham.ac.uk/marchives/sc-users/ search: http://www.listarc.bham.ac.uk/lists/sc-users/search/ |
| Powered by Nabble | See how NAML generates this page |
