Re: [livecode] supercollider question

From: Julian Rohrhuber <rohrhuber_at_uni-hamburg.de>
Date: Wed, 25 Aug 2010 11:50:54 +0200

warp it all in a function

s.bind {

        and insert
        s.sync;
        wherever you want to wait for the server.

}

note that your ~nn can be simplified, just write:
~nn = { arg mx=40, my=1; your code }.play;


On 25.08.2010, at 11:40, evan.raskob [lists] wrote:

> hey gang,
>
> I have a supercollider question.
>
> I know some of you guys are pros at this, and this isn't exactly a livecoding question... so maybe best to answer off-list. Or maybe other people are interested in the answer.
>
> Anyway, I'd like have some code load and run automagically for an installation, without having to run things line-by-line. Since things happen asynchronously, it isn't so straightforward to run a whole bunch of commands in sequence. Being a SC newbie, I see that SynthDefs have methods for triggering OSC events after loading, but I'm not sure what a good workflow for programming that is. Can some experienced SC person please give me a some advice? The code below (which will be open source, for what little that's worth...) is what I'd like to run, all at once.
>
> Thanks,
> Evan
>
>
> s = Server.internal;
> Server.default = s;
> s.boot;
>
> // read sound
> b = Buffer.read(s, "sounds/reagan_bomb.wav");
>
>
> ~nn = SynthDef( "noisy", { arg mx=40, my=1;
>
> var trate, dur, clk, pos, pan, sig1, sig2, sig3;
> trate = 40;
> //dur = MouseY.kr(0.2,224,1) / trate;
> dur = mx / trate;
> clk = Impulse.kr(trate);
> pos = mx*BufDur.kr(b) + Dust.kr(0, 0.01, clk);
> pan = WhiteNoise.kr(0.6);
> sig1 = SinOsc.ar(0, Ringz.ar( TGrains.ar(2, clk, b, 1, pos, dur, my*pan, 0.1), 1200*Dust.kr(0, 0.01, clk), dur), 0.6);
> //sig2 = SinOsc.ar(0, sig1, 0.4);
> sig1 = Ringz.ar(sig1, XLine.kr(100, 8000, 120000)*Dust.kr(0, 0.01, clk), dur);
> sig1 = Clip.ar(sig1, -0.4, 0.4);
> sig1 = CombN.ar(GVerb.ar(sig1, 105, 5, 0.7, 0.8, 60, 0.1, 0.5, 0.4) + sig1, 0.2, XLine.kr(0.05, 2.0, 60000), dur);
> sig1 = SinOsc.ar(0, sig1, 0.8);
> Out.ar(0, sig1);
>
> //LFClipNoise.ar(mx*100+160, 0.25);
> // used as an echo.
> //CombN.ar(Decay.ar(Dust.ar(1,0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3);
>
> }).play(s);
>
>
> o = OSCresponderNode(nil, '/m', { |t, r, msg|
> (
> //[ msg[0], msg[1], msg[2] ].postln;
> ~nn.set("mx", msg[1]);
> ~nn.set("my", msg[2]);
> )
> }).add;
>
Received on Wed Aug 25 2010 - 09:52:26 BST

This archive was generated by hypermail 2.4.0 : Sun Aug 20 2023 - 16:02:23 BST