On Tuesday 21 April 2009 16:48:15 yvan volochine wrote:
> Hello.
>
> I am new to this list so, first, thanks to all of you for all the great
> help I found on the list/forum.
>
> While trying to make some polyphony, I came through this error and I'd
> like to understand what I'm doing wrong.
> Here is my simplified code:
>
> (
> SynthDef(\yo, { |out=0, n=8|
> var src= SinOsc.ar({Rand(100, 2000)}!n, 0, 1/n);
> Out.ar(out, Mix.new(Pan2.ar(src, 0, 1)));
> }).send(s);
> )
>
> Of course, if I use, say, 8 instead of n, I have no errors.
You can't create a dynamic size array in a synthdef.
What would work is this:
(
var n = 8;
SynthDef(\yo++n, { |out=0|
var src= SinOsc.ar({Rand(100, 2000)}!n, 0, 1/n);
Out.ar(out, Mix.new(Pan2.ar(src, 0, 1)));
}).send(s);
)
You'll have to create a separate SynthDef for each amount of SinOscs you want
to have.
sincerely,
Marije
_______________________________________________
sc-users mailing list
info (subscription, etc.):
http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtmlarchive:
http://www.listarc.bham.ac.uk/marchives/sc-users/search:
http://www.listarc.bham.ac.uk/lists/sc-users/search/