Argument = array

I used the argument level [ ] , time [ ] , curve [ ]; as argument
But when I insert the argument in the env ( ) I get an error
It seems that the array should also be enclosed in an array
see code
First example is wrong
Second example doesn’t give an error message but still no sound becasue of the envelope ?
SO I must be doing something wrong in the argument declaration or use of the aray ,but then the console would give me an error , which it doesnt’( second example )

///this is wrong
(
{
	arg levels=[0,1,0],times=[0.001,0.500],curves=[0,-5];
	var env,sig;

	env=EnvGen.ar(Env(levels,times,curves),doneAction:2);///argumens are not enclosed in array
	sig=Saw.ar(48.midicps)*0.3;
	sig=RLPF.ar(sig,777,0.5);
	sig-sig*env;

}.play
)
//////also wrong
(
{
	arg levels=[0,1,0],times=[0.001,1],curves=[0,-5];
	var env,sig;

	env=EnvGen.ar(Env([levels,times,curves]),doneAction:2);///here the arguments are enclosed in an array 
	sig=Saw.ar(48.midicps)*0.3;
	sig=RLPF.ar(sig,777,0.5);
	sig*env;///no sound seems that env is still not working 

}.play
)
//

Def. weird
Trying to narrow it down ,usng only the curves as an argument
NO console error while plotting but the curves are absent

(
{arg curves=[5,-5];
	
	EnvGen.ar(Env([0,1,0],[0.5,1],curves),doneAction:2);
}.plot(2)
)

O.k. so this works
I name the arguments , but I still need to assign the arrays which brngs me to the frt post
I want to this all on the same line ,naming and declaring

(
{
	arg levels,times,curves;
	var env,sig;
	levels=[0,1,0];
	times=[0.5,0.5];
	curves=[2,-5];

	env=EnvGen.ar(Env(levels,times,curves),doneAction:2);
	sig=Saw.ar(48.midicps)*0.3;
	sig=RLPF.ar(sig,444,0.5);
	sig=sig*env!2;

}.play
)

Here the filter frequency argument is an array [700,2000] ,700Hz left speaker , 2000Hz right speaker.
No sound but also no error …

(
{
	arg levels,times,curves,filter=[700,2000];
	var env,sig;
    levels=[0,1,0];
	times=[0.500,0.500];
	curves=[0,-5];
	env=EnvGen.ar(Env(levels,times,curves),doneAction:2);
	sig=Saw.ar(48.midicps)*0.3;
	sig=RLPF.ar(sig,filter,0.5);
	sig=sig*env;

}.play
)

It’s a very subtle point, but it is actually documented correctly in the SynthDef help file.

http://doc.sccode.org/Classes/SynthDef.html#UGen%20Graph%20Functions%20and%20Special%20Argument%20Forms

literal arrays
Arguments which have literal arrays as default values (see Literals) result in multichannel controls

The key word is “literal.”

  • Array written as an expression: [1, 2, 3] – this compiles the same as Array.new(3).add(1).add(2).add(3).
  • Literal array: #[1, 2, 3]. This uses no method calls at all – it’s just stored in the function object as an array.

SynthDef argument defaults must be literal floats or literal arrays. Expressions are never permitted here. You will also have a problem e.g. with arg freq = 440 / 2.

If you need a synth control to have a nonliteral default, use NamedControl.

hjh