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

Re: [sc-users] array dynamically in synthdef



One solution (I think)
that you would make a big array (like 20 elements)
and when you desire a spectra with 12 partials, the 13th element and
others may have value zero:

(
SynthDef('help-dynKlank', {
freqs (#[100, 200, 300, 400, 0, 0, 0, 0, 0, 0, 0, ...]), 
amps (#[1, 0.3, 0.2, 0.05, 0, 0, 0, 0, 0, 0, ...]), 
rings (#[1, 1, 1, 2, 0, 0, 0, 0, 0, 0,...])|

Out.ar(0, DynKlank.ar(`[freqs, amps, rings], WhiteNoise.ar * 0.001))
}).send(s)
)



or make a function (not a SynthDef)

Página pessoal:
http://gcravista.googlepages.com/guilhermemartinslunhanii


On Mon, Jul 27, 2009 at 12:27 PM, Perdo <pelectron69@xxxxxxxxx> wrote:
Dear list,

Excuse me if this question already has been done a lot of times but don't know the answer in the lists archives...

Now I play with this beautiful ugens DynKlank and DynKlang.
It's possible to change dynamically de numbers of arrays elements for controlling these ugens?

From the example:

(
SynthDef('help-dynKlank', {
freqs (#[100, 200, 300, 400]), 
amps (#[1, 0.3, 0.2, 0.05]), 
rings (#[1, 1, 1, 2])|

Out.ar(0, DynKlank.ar(`[freqs, amps, rings], WhiteNoise.ar * 0.001))
}).send(s)
)

a.setn(\freqs, Array.rand(4, 500, 2000));
a.setn(\amps, Array.exprand(4, 0.01, 1));

If I change the number (by default 4) of elements to 10 for example nothing change or bang!! (explode), for  this doesn't work:

a.setn(\freqs, [100, 101, 102, 103, 300, 1000]);
a.setn(\amps, [0.1, 0.1, 0.1, 0.2, 0.3, 0.4]);
a.setn(\rings, [1, 1, 1, 1, 1, 1]);

I know that I can have a lots of synthdef with different defaults arrays number and play with, but if I use resonances models from fft analyses that changes all time it's not funny...
Is a syntax problem or only not possible? 

Any help would be appreciated

Best

p