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

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



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);)


  #|
  |#