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

Re: [sc-users] array dynamically in synthdef



Thanks Guilherme and Michael, I love this list!

I think that Michael solution is not that I aspect because if I understand you can't change dynamically the number of elements in the array, it's always 4 (the example is to generate an harmonics series).
The Guilherme solution seems better and I think about it before but is not really elegant because you have always to fill with 0 your analyze. Any other solution in the way?

Btw in this example (down) if I put more than 570 partials I have an error (FAILURE /d_recv failed). This is very annoying if you want to use a series of Dynklank (one DynKlank to filter another and other etc.).
It's possible to change this limit with some command? Or is the SC limit? Or my computer ram limit? (I don't think so...)

Any idea about this?

Best

p


(
var freqs, amps, ringtimes, n;

n = 570;

freqs = Array.fill(n, { (30 + 75.rand).midicps});
amps = Array.fill(n, { 0.002 + 0.007.rand });
ringtimes = Array.fill(n, { 0.05 + 0.25.rand });

SynthDef('dynKlanklac', {
Out.ar(0, DynKlank.ar([`[freqs, amps, ringtimes], `[freqs, amps, ringtimes]], WhiteNoise.ar * 0.001))
}
).send(s)
)


a = Synth('dynKlanklac');






If you want to change an array dynamically in a SynthDef check out Control. There is an example in the help file for Control which uses Klank.ar 
I think that is basically what you want, right?
 
Hope that helps.
 
gr.
 
Michael 
 

From: pelectron69@xxxxxxxxx
To: sc-users@xxxxxxxxxxxxxxxx
Subject: [sc-users] array dynamically in synthdef
Date: Mon, 27 Jul 2009 21:27:40 +0200

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




Deel je favoriete foto's online met Windows Live Photos