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

Re: [sc-users] sending synth parameters with patterns



Hi Fredrik
 
OK, I tried this and *as is* it seems to work. However, I have to admit I don't really understand what it's doing. 

I tried adding note and duration lists and can't get past apparent syntax errors. How would I write the Pbind to do the equivalent of this, except with your method of invoking the variants?

e = \basicsub;
f = \oboe;
b = [60, 72, 71, 67, 69, 71, 72, 60, 69, 67];
c = [2, 2, 1, 0.5, 0.5, 1, 1, 2, 2, 3];

r = Pbind(                              // note \oboe is missing here obviously
    \instrument, e,
    \midinote, Pseq(b, 1),
    \dur, Pseq(c, 1)
).play;

If I can get that to work then everything else falls into place. (The rest of the work is in the creation of patches, and the creation of note and duration lists.)

thanks!

Phil

On Dec 30, 2013, at 12:15 PM, Philip Galanter <list@xxxxxxxxxxxxxxxxxx> wrote:

dunno, but I'll try it later today...thanks!

Phil

On Dec 30, 2013, at 5:04 AM, Fredrik Olofsson <f@xxxxxxxxxxxxxxxxxxx> wrote:

i didn't follow this thread, but can't you just do...

(a= SynthDef("basicsub", //keep this def in a variable
{
arg freq = 440, gateTime = 0.25, outVol = 0.5, outbus = 0, keyVel = 1,
vcaA = 1,  vcaD = 1, vcaS = 0.5, vcaR = 1,
vcfA = 1,  vcfD = 1, vcfS = 0.5, vcfR = 1,
vcfTrack = 1, vcfOffset = 2, vcfEnvAmt = 1, vcfQ = 0;

var gate, osc1, vcfEnv, vcfCV, vcaEnv, inst;

gate = EnvGen.kr(Env.linen( 0.001, gateTime, 0.001 ));
osc1 = Saw.ar( freq );
vcfEnv = EnvGen.kr( Env.adsr(vcfA, vcfD, vcfS, vcfR, 1, -4), gate );
vcfCV = (freq * vcfOffset * vcfTrack) + (vcfEnv * freq * vcfEnvAmt);
vcaEnv = EnvGen.kr( Env.adsr(vcaA, vcaD, vcaS, vcaR, 1, -4), gate, doneAction: 2);
inst = MoogFF.ar( osc1, freq: vcfCV, gain: vcfQ ) * vcaEnv * keyVel * outVol;

Out.ar(outbus, [inst, inst])
},

variants: (
oboe: [vcaA: 0.05, vcaR: 0.05,   vcfOffset: 3],
reverse:  [vcaA: 3, vcaR: 0.01],
epiano: [vcaA: 0.01, vcaD: 3, vcaS: 0, vcaR: 3, vcfQ: 0.5, outVol: 0.9],
qwaah: [vcaA: 0.01, vcaR: 4, vcfQ: 3.7],
sweep: [vcaA: 0.01, vcaR: 4,
vcfOffset: 2, vcfQ: 3.7, vcfEnvAmt: 10,
vcfA: 0, vcfS: 0, vcfR: 4, vcfD: 4  ],
thwap: [vcaA: 0.01, vcaD: 1, vcaS: 0, vcaR: 0.25,  outVol: 0.9,
vcfA: 0, vcfD: 0.025, vcfS: 0, vcfR: 0.025,
vcfOffset: 0, vcfQ: 3.7, vcfEnvAmt: 10  ]
)
).add;)//note: use .add instead of .send(s) when working with events


b= Pbind(*[\instrument, \basicsub]++a.variants[\oboe]).play
b.stop
b= Pbind(*[\instrument, \basicsub]++a.variants[\reverse]).play
b.stop
b= Pbind(*[\instrument, \basicsub]++a.variants[\epiano]).play
b.stop

30 dec 2013 kl. 02:15 skrev Philip Galanter <list@xxxxxxxxxxxxxxxxxx>:

Well here is a vote for fixing it...

I'm using Supercollider on a Beagleboard as a way to have a low cost synthesis engine. It will be driven by messages sent from another processor, in this case an Arduino Mega.

I'm not sure why SynthDef variants isn't an obvious and frequently used feature.  It's something I was rather counting on. Below is a (i would assume) simple subtractive synth. My plan was to be able to choose a synth and a preset. Perhaps I'm not thinking about things the "Supercollider way" but it seems like the most natural thing in the synth-world to want to do...synths with presets.

Meanwhile...is there no workaround to force Pbind to select the appropriate variant?

( I need to deal with this in the next week. Right now it looks like I will have to break my variants up into individual SynthDef's or turn my variants into rather unsightly case statements.)

thanks,

Phil

p.s. gratuitous example of variants use:

(SynthDef("basicsub",
{
arg freq = 440, gateTime = 0.25, outVol = 0.5, outbus = 0, keyVel = 1,
vcaA = 1,  vcaD = 1, vcaS = 0.5, vcaR = 1,
vcfA = 1,  vcfD = 1, vcfS = 0.5, vcfR = 1,
vcfTrack = 1, vcfOffset = 2, vcfEnvAmt = 1, vcfQ = 0;

var gate, osc1, vcfEnv, vcfCV, vcaEnv, inst;

gate = EnvGen.kr(Env.linen( 0.001, gateTime, 0.001 ));
osc1 = Saw.ar( freq );
vcfEnv = EnvGen.kr( Env.adsr(vcfA, vcfD, vcfS, vcfR, 1, -4), gate );
vcfCV = (freq * vcfOffset * vcfTrack) + (vcfEnv * freq * vcfEnvAmt);
vcaEnv = EnvGen.kr( Env.adsr(vcaA, vcaD, vcaS, vcaR, 1, -4), gate, doneAction: 2);
inst = MoogFF.ar( osc1, freq: vcfCV, gain: vcfQ ) * vcaEnv * keyVel * outVol;

Out.ar(outbus, [inst, inst])
},

variants: (
oboe: [vcaA: 0.05, vcaR: 0.05,   vcfOffset: 3],
reverse:  [vcaA: 3, vcaR: 0.01],
epiano: [vcaA: 0.01, vcaD: 3, vcaS: 0, vcaR: 3, vcfQ: 0.5, outVol: 0.9],
qwaah: [vcaA: 0.01, vcaR: 4, vcfQ: 3.7],
sweep: [vcaA: 0.01, vcaR: 4,
vcfOffset: 2, vcfQ: 3.7, vcfEnvAmt: 10,
vcfA: 0, vcfS: 0, vcfR: 4, vcfD: 4  ],
thwap: [vcaA: 0.01, vcaD: 1, vcaS: 0, vcaR: 0.25,  outVol: 0.9,
vcfA: 0, vcfD: 0.025, vcfS: 0, vcfR: 0.025,
vcfOffset: 0, vcfQ: 3.7, vcfEnvAmt: 10  ]
)
).send(s);)


  #|
  |#