[sc-users] args as integers: outputproxy

Paul Vickers northumbria at paulvickers.com
Wed Aug 9 23:41:16 PDT 2006


Ok

Having moved on from patches I tried converting a patch to a synthdef.

Here's the synthdef:
(// Great metal bar/chime/bell SynthDef
SynthDef( "Bell",
{
 arg myBellNumber=0, pan=0 ;
  var out,chime, freqSpecs, num, burst, totalHarm = 12,
    burstEnv, att = 0, seeds, seedNames, burstLength = MouseY.kr(0.0001, 1);
seeds =  [
        Date.seed,        // Random bell
        1155524954,       // Nice low bell
        1155442766,       // Nice clunky bell
        1155294420,       // really low bell
        1154676704,       // High bell
        1155146026        // Mid range
        ] ;
seedNames = [
         "Random",
         "Nice low bell",
         "Nice clunky bell",
         "Really low bell",
         "High bell",
         "Mid range"
         ];
thisThread.randSeed = seeds[myBellNumber];
//postn(Select.ar(myBellNumber, seedNames)) ;
freqSpecs = `[
 {rrand(1, 30)*(100+rrand(-10.0,10.0))}.dup(totalHarm),
 {rrand(0.1, 0.9)}.dup(totalHarm).normalizeSum,
 {rrand(1.0, 3.0)}.dup(totalHarm)];
burstEnv = Env.perc(0, burstLength);
burst = PinkNoise.ar(EnvGen.kr(burstEnv, gate: Impulse.kr(1),doneAction: 2));
out = Pan2.ar( // Put in stereo field
   Klank.ar(freqSpecs, burst)*MouseX.kr(0.1, 0.8) ,
   pan);
Out.ar(0, out) ;
}).send(s)
)

However, SC complains that 'myBellNumber' is an outputproxy rather than an
integer. How then do I pass an integer argument to the synthdef so that I
can select an array element based on the value of that argument????

Paul



More information about the sc-users mailing list