Applying ADSR to a filter?

wrightflyer

Active member
(typed a long post yesterday then have a feeling I closed the tab before actually submitting it - that's age for you!).

So the question I had was about using the elements in the Audio library. In a traditional synth you might typically apply two keyboard gated ADSRs to both VCA and VCF but I wonder how you do that using elements in the Teensy Audio library?

In the design tool an "envelope" is an inline component that you can feed a sound signal into then get the ADSR shaped output at the other end. That's a bit like a combined ADSR+VCA.

But how can you apply this to a filter? I see the plain "filter" element has two inputs - one for the sound and one for "frequency control". So can you some how feed ADSR into that too?

I'm wondering if this is where the mysterious "dc" element comes into play? Do you feed the dc output into an envelope and then that output on into input 1 of the filter element?

Or is there another way to do this?

Things like that second input on filter intrigue me in fact. Clearly the author of the filter element had something in mind when they coded the element to add that second input - but I don't see documentation saying how it should be used. Same goes for the "dc". The comments basically say "you'll know when you need this" but sadly some of us don't :-(

PS BTW the documentation on the "wavetable" element is particularly intriguing! (I'm guessing "blah blah" is a placeholder for goodies yet to come? ;-)
 
Do you feed the dc output into an envelope and then that output on into input 1 of the filter element?

Yes, that's the answer.

The DC synth also has some limited support for linear ramping. It's not as automatic or as precise as the envelope, but might be useful in some cases.
 
You can use DC, or if you're going the modular approach use a velocity or LFO input to modulate the adsr.

The filter CV input allows tracking at audio sample rates. Just remember that if this is digitally generated you'll want to filter the input to band limit it so you don't get transients when values change.
 
Paul, Thanks for confirming that.

boxofrobots, not sure I follow what you mean by "modulate the ADSR"? It doesn't have either an input channel or a method to allow it to be modulated?

I get Paul's suggestion as something like:

Code:
// GUItool: begin automatically generated code
AudioSynthWaveformDc     dc1;            //xy=406,312
AudioSynthWaveform       waveform3;      //xy=510.9999694824219,259
AudioEffectEnvelope      envelope2;      //xy=542,315
AudioFilterStateVariable filter1;        //xy=685.7777099609375,269.3333435058594
AudioEffectEnvelope      envelope1;      //xy=841,252
AudioOutputI2S           i2s1;           //xy=1001.1110305786133,256.44447135925293
AudioConnection          patchCord1(dc1, envelope2);
AudioConnection          patchCord2(waveform3, 0, filter1, 0);
AudioConnection          patchCord3(envelope2, 0, filter1, 1);
AudioConnection          patchCord4(filter1, 0, envelope1, 0);
AudioConnection          patchCord5(envelope1, 0, i2s1, 0);
AudioConnection          patchCord6(envelope1, 0, i2s1, 1);
AudioControlSGTL5000     sgtl5000_1;     //xy=667.4443969726562,196.11111450195312
// GUItool: end automatically generated code
(and I'll try that.)

But what would any alternatives look like?

EDIT: actually maybe the above should look more like??:
Code:
// GUItool: begin automatically generated code
AudioSynthWaveform       waveform3;      //xy=514,166
AudioSynthWaveformDc     dc1;            //xy=540,227
AudioEffectEnvelope      envelope1;      //xy=667,168
AudioEffectEnvelope      envelope2;      //xy=676,230
AudioFilterStateVariable filter1;        //xy=819,184
AudioOutputI2S           i2s1;           //xy=1007,172
AudioConnection          patchCord1(waveform3, envelope1);
AudioConnection          patchCord2(dc1, envelope2);
AudioConnection          patchCord3(envelope1, 0, filter1, 0);
AudioConnection          patchCord4(envelope2, 0, filter1, 1);
AudioConnection          patchCord5(filter1, 0, i2s1, 0);
AudioConnection          patchCord6(filter1, 0, i2s1, 1);
AudioControlSGTL5000     sgtl5000_1;     //xy=673,112
// GUItool: end automatically generated code

that is:

filtADSR.png
 
See your waveform generator up there? The one going into the envelope generator? That could be ANY frequency, and the output can modulate something else. LFO + ADSR gen = modulated ADSR. Or, use your DC source to reflect velocity. Modulated Envelope Generator.
 
See your waveform generator up there? The one going into the envelope generator? That could be ANY frequency, and the output can modulate something else. LFO + ADSR gen = modulated ADSR. Or, use your DC source to reflect velocity. Modulated Envelope Generator.

Can't you just feed a straight signal into the envelope using a dc source without having to use its ramp time parameter? In my synth I'm feeding the output from an oscillator mixer into an envelope that modulates the level from the mixer before it goes into the filter. This works fine. But when I try to do the same thing with a dc signal going into an envelope that controls the filter frequency, it has no affect. What's different between modulating a volume level and modulating a filter frequency with an envelope?
 
Can't you just feed a straight signal into the envelope using a dc source without having to use its ramp time parameter?

Sure!

I'm not sure why you're unable to modulate your filter freq with an adsr, in your pictorial above that should work fine. the dc1 will act as a "velocity" type signal and will set the maximum amplitude of your envelope. If you have no dc1 value set, the adsr will multiply nothing. Perhaps that's the problem?
 
Can't you just feed a straight signal into the envelope using a dc source without having to use its ramp time parameter?

Sure!

I'm not sure why you're unable to modulate your filter freq with an adsr, in your pictorial above that should work fine. the dc1 will act as a "velocity" type signal and will set the maximum amplitude of your envelope. If you have no dc1 value set, the adsr will multiply nothing. Perhaps that's the problem?

That's the strange thing. I have the DC value set to 1.0. That is the max right? I just don't hear it doing anything, no matter what the value. When I get to my computer I'll share some code.
 
It just dawned on me! I've been taking readings from a pot to control the cutoff frequency. The frequency, not a dc leading into the cutoff. That's why there was no affect! Everytime the envelope updated the frequency it was getting cancelled out by the update from the pot. What I need to do is mix a dc and the signal from the envelope together and run that into the filter cutoff. Then if the DC is controlled by the pot instead of changing the frequency directly it should work as expected. Man, sometimes it blows my mind the stuff I'll miss!
 
Back
Top