exponential envelope
Is there a generally-accepted method for creating exponential envelopes? It can be managed with Gen5, but the result is somewhat clumsy and requires a very fast loop. -Alex
Hey Alex,
On 1 June 2011 02:11, Alex French
Is there a generally-accepted method for creating exponential envelopes? It can be managed with Gen5, but the result is somewhat clumsy and requires a very fast loop.
I'm a bit short on time now but I seem to remember you can chuck to and from the GenN ugens. Are you sure you need that loop? I can look in more detail if your problem persists but it'll have to be in a few hours. Yours, Kas.
I'm a bit short on time now but I seem to remember you can chuck to and from the GenN ugens. Are you sure you need that loop?
Hmm. The documentation agrees with you: "Lookup can either be done using the lookup() function, or by driving the table with an input UGen, typically a Phasor." I tried to drive the Gen5 ugen with an envelope, but that didn't seem to work (or do anything at all). I tried a few other variations on this idea with no result. Maybe this is not what you meant, and what I am doing is completely silly. Noise n => Envelope e => Gen5 curve => dac; [0., 1., 0.] => curve.coefs; 500::ms => e.duration; while (true) { e.keyOn(); 1::second => now; e.keyOff(); 2::second => now; } Let me know what you think. I appreciate the help. Thanks, -Alex
Alex; Hmm. The documentation agrees with you: "Lookup can either be done
using the lookup() function, or by driving the table with an input UGen, typically a Phasor."
That's what I thought I remembered, yes. So; barring bugs let's assume that for now.
I tried to drive the Gen5 ugen with an envelope, but that didn't seem to work (or do anything at all).
Yes, that's right. This is because Envelope internally multiplies its shape with it's input. To get the behaviour you expect you'd write; Step unity => Envelope e; 1 => unity.next; This is a pattern I use fairly often. "unity" stands for "unity gain". Once you have a Step of that name you can re-use it elsewhere in your code. I find that quite handy. It's been discussed that perhaps this should be the default behaviour for Envelopes (including ADSR) that don't get a input, I'd be in favour of that and I seem to remember Perry also felt that way.
I tried a few other variations on this idea with no result. Maybe this is not what you meant, and what I am doing is completely silly.
No, it's close. What you are doing is wave-shaping the enveloped signal and instead you we'd like to wave-shape the envelope, then apply it to the signal. In this case we need a additional vca (Voltage Controlled Amplifier) So; Step unity => Envelope e => Gen5 curve => Gain vca; //waveshaped envelope as a control voltage Noise my_signal => vca => dac; //signal to be enveloped 1 => unity.next; //unity gain to make the envelope behave 3 => vca.op; //set the vca to multiply //set up your Gen5 here, your envelope, write music, etc. Aside from the trick with the Step it's all quite standard and straightforward stuff that you'd see in any kind of modular synth, but I can understand that this is a bit tricky if see it for the first time. It should be easier with a updated Envelope and ADSR, I think. I hope that helps and I hope there aren't too many bugs in it; I didn't try to run any of this ;-) Yours, Kas.
Yes, that's right. This is because Envelope internally multiplies its shape with it's input. To get the behaviour you expect you'd write; Step unity => Envelope e; 1 => unity.next; This is a pattern I use fairly often. "unity" stands for "unity gain". Once you have a Step of that name you can re-use it elsewhere in your code. I find that quite handy. It's been discussed that perhaps this should be the default behaviour for Envelopes (including ADSR) that don't get a input, I'd be in favour of that and I seem to remember Perry also felt that way.
Okay, so in order to use an Envelope by itself (which is necessary in this case, as it is otherwise the first item in the chain), we need to give it an input to multiply, which is the purpose of the Step ugen. Is that correct?
What you are doing is wave-shaping the enveloped signal and instead you we'd like to wave-shape the envelope, then apply it to the signal. In this case we need a additional vca (Voltage Controlled Amplifier)
So; Step unity => Envelope e => Gen5 curve => Gain vca; //waveshaped envelope as a control voltage Noise my_signal => vca => dac; //signal to be enveloped 1 => unity.next; //unity gain to make the envelope behave 3 => vca.op; //set the vca to multiply
//set up your Gen5 here, your envelope, write music, etc. Aside from the trick with the Step it's all quite standard and straightforward stuff that you'd see in any kind of modular synth, but I can understand that this is a bit tricky if see it for the first time. It should be easier with a updated Envelope and ADSR, I think.
Ah, okay, I got close to this solution but I didn't know how to multiply signals. I hadn't seen 'op' in the documentation until you mentioned it and I went searching for it... I think the subject of connecting multiple chains using Gain in this way is something that the manual could elaborate upon.
I hope that helps and I hope there aren't too many bugs in it; I didn't try to run any of this ;-)
I'll let you know how it goes. I'm on lunch break at work right now, but I'll try it out when I get home in a few hours. -Alex
Alex; Okay, so in order to use an Envelope by itself (which is necessary in
this case, as it is otherwise the first item in the chain), we need to give it an input to multiply, which is the purpose of the Step ugen. Is that correct?
Exactly. So, in this case the value of 1 isn't a "magical number" at all. Because of that I sometimes write this; true => my_step.next; That comes down to the exact same thing and I avoid the number in my code.
Ah, okay, I got close to this solution but I didn't know how to multiply signals. I hadn't seen 'op' in the documentation until you mentioned it and I went searching for it... I think the subject of connecting multiple chains using Gain in this way is something that the manual could elaborate upon.
It's not there? That's not good. To summarize; Gain is the most simple UGen and has all of the properties that all other UGens have, but no others. In fact instead of using "Gain" you can write "UGen and get the same results. I wouldn't do that as it's less clear, but you can. .op(), which all UGens have sets how the inputs are treated, the options are (from memory); 0; only output 0, making the UGen a bit of a dummy 1 (default) add all inputs 2; subtract (starting from the left, I think) 3 multiply (the most practically useful one next to 1) 4; divide (hopefully has exceptions for 0...) Even the dac has these, meaning that you can nearly instantly turn a complicated set of running files into a huge mess of sound, if you'd like. I'll let you know how it goes. I'm on lunch break at work right now,
but I'll try it out when I get home in a few hours.
Sounds like you'll be fine, as now the general strategy is clear. Hope you'll have a good sounding weekend. Yours, Kas.
participants (2)
-
Alex French
-
Kassen