EnvGen Error message not understood

View: New views
3 Messages — Rating Filter:   Alert me  

EnvGen Error message not understood

by Nav Reyort :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hello,

I am trying to make envelope generator synthdef.

(
SynthDef(\Envelope, { | out=0, dur=1, trig=0, rand=10, min=0.2, max=2.0 |
    var valueArray, timeArray;
   
    rand.do({ |i| //Make value and time array for envelope generator
        valueArray = valueArray.add(rrand(min, max));
        timeArray = timeArray.add(dur);
        });
    timeArray.drop(-1);
    Out.kr(out, EnvGen.kr(Env.new(valueArray, timeArray, \linear), doneAction: 2))
    }).send(s);
)

But I am keep getting an error message that says:

EnvGen arg: '9' has bad input: nil
 ARGS:
   gate: 1 Float
   levelScale: 1 Float
   levelBias: 0 Float
   timeScale: 1 Float
   doneAction: 2 Integer
   5: a BinaryOpUGen BinaryOpUGen
   6: 1 Integer
   7: -99 Integer
   8: -99 Integer
   9: nil Nil
   10: an OutputProxy OutputProxy
   11: 1 Integer
   12: 0 Integer
ERROR: SynthDef Envelope build failed

I do not understand this error message and what is possibly causing this problem.
Any help from you is appreciated. Thank you in advance.

Akito


MSN相談党、誕生。あなたの知識で日本を変えよう。党首には押切もえが就任! Hotmailで質問・回答できる!今すぐ参加!

Re: EnvGen Error message not understood

by Dan Stowell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi -

Change
  timeArray.drop(-1);
to
  timeArray = timeArray.drop(-1);

and I think it'll work. The error is caused by timeArray still
containing the same number of points as valueArray rather than one
less.

Dan


2008/7/13 Reyort, Nav <tennen_funk@...>:

> Hello,
>
> I am trying to make envelope generator synthdef.
>
> (
> SynthDef(\Envelope, { | out=0, dur=1, trig=0, rand=10, min=0.2, max=2.0 |
>     var valueArray, timeArray;
>
>     rand.do({ |i| //Make value and time array for envelope generator
>         valueArray = valueArray.add(rrand(min, max));
>         timeArray = timeArray.add(dur);
>         });
>     timeArray.drop(-1);
>     Out.kr(out, EnvGen.kr(Env.new(valueArray, timeArray, \linear),
> doneAction: 2))
>     }).send(s);
> )
>
> But I am keep getting an error message that says:
>
> EnvGen arg: '9' has bad input: nil
>  ARGS:
>    gate: 1 Float
>    levelScale: 1 Float
>    levelBias: 0 Float
>    timeScale: 1 Float
>    doneAction: 2 Integer
>    5: a BinaryOpUGen BinaryOpUGen
>    6: 1 Integer
>    7: -99 Integer
>    8: -99 Integer
>    9: nil Nil
>    10: an OutputProxy OutputProxy
>    11: 1 Integer
>    12: 0 Integer
> ERROR: SynthDef Envelope build failed
>
> I do not understand this error message and what is possibly causing this
> problem.
> Any help from you is appreciated. Thank you in advance.
>
> Akito
>
> ________________________________
> MSN相談党、誕生。あなたの知識で日本を変えよう。党首には押切もえが就任! Hotmailで質問・回答できる!今すぐ参加!



--
http://www.mcld.co.uk

_______________________________________________
sc-users mailing list

info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de:8888/MusicTechnology/880
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/

Re: EnvGen Error message not understood

by felix-38 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


yes, the error message could be better.  you can see that is quite helpful for the first args that have names:

EnvGen arg: '9' has bad input: nil
 ARGS:
   gate: 1 Float
   levelScale: 1 Float
   levelBias: 0 Float
   timeScale: 1 Float
   doneAction: 2 Integer
   5: a BinaryOpUGen BinaryOpUGen
   6: 1 Integer
   7: -99 Integer
   8: -99 Integer
   9: nil Nil
   10: an OutputProxy OutputProxy
   11: 1 Integer
   12: 0 Integer

but what happens is that the Envelope gets flattened and treated like more args, but they don't have names so the error message can't figure it out so it has to just say '9'
so 5-12 is the Envelope flattened.

but also there is another problem.  you can see arg 5 and arg 10 are not floats or integers.

see below.



2008/7/13 Reyort, Nav <tennen_funk@...>:
Hello,

I am trying to make envelope generator synthdef.

(
SynthDef(\Envelope, { | out=0, dur=1, trig=0, rand=10, min=0.2, max=2.0 |
    var valueArray, timeArray;
   

actually you can't do this in a SynthDef

dur and rand will both be Control UGens, they will not be fixed numbers.
so you can't build an array like that inside a synth def.


could use Instr:

Instr(\Envelope, { | dur=1, trig=0, rand=10, min=0.2, max=2.0 |
    var valueArray, timeArray;
   
    rand.do({ |i| //Make value and time array for envelope generator
        valueArray = valueArray.add(rrand(min, max));
        timeArray = timeArray.add(dur);
        });
    timeArray.drop(-1);
    EnvGen.kr(Env.new(valueArray, timeArray, \linear), doneAction: 2))
},[
  StaticSpec( 0.1,1.0), // dur
  \trig,
  StaticIntegerSpec(3,20), // rand for size of envelope
  StaticSpec( 0.0,1.0), //min
  StaticSpec( 0.0,1.0) // min
]);

p = Patch(\Envelope, [  supply your values here ]);
p.play(bus: out); // play it onto the kr bus you wish to play on
 or
p.prepareForPlay // will build the synth def and send it to the server.

// here is the def name for use in your code to build synths
p.defName





another solution is to make a factory function

envmaker = { |name,min,max,rand|
var env;
env = make your env here

  SynthDef(name,{ |out, ... just your real time control args here|
   Out.kr( EnvGen.kr( env ....   play the EnvGen here
 ).send(s)

};

envmaker.value(  \Envelope, ... supply your values here to build the env synth def )



f;lix


   

 

    rand.do({ |i| //Make value and time array for envelope generator
        valueArray = valueArray.add(rrand(min, max));
        timeArray = timeArray.add(dur);
        });
    timeArray.drop(-1);
    Out.kr(out, EnvGen.kr(Env.new(valueArray, timeArray, \linear), doneAction: 2))
    }).send(s);
)


 


But I am keep getting an error message that says:

EnvGen arg: '9' has bad input: nil
 ARGS:
   gate: 1 Float
   levelScale: 1 Float
   levelBias: 0 Float
   timeScale: 1 Float
   doneAction: 2 Integer
&nb sp;  5: a BinaryOpUGen BinaryOpUGen
   6: 1 Integer
   7: -99 Integer
   8: -99 Integer
   9: nil Nil
   10: an OutputProxy OutputProxy
   11: 1 Integer
   12: 0 Integer
ERROR: SynthDef Envelope build failed

I do not understand this error message and what is possibly causing this problem.
Any help from you is appreciated. Thank you in advance.

Akito


MSN相談党、誕生。あなたの知識で日本を変えよう。党首には押切もえが就任! Hotmailで質問・回答できる!今すぐ参加!

LightInTheBox - Buy quality products at wholesale price