Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Applying ADSR to a filter?

  1. #1
    Junior Member
    Join Date
    Sep 2020
    Posts
    18

    Applying ADSR to a filter?

    (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? ;-)

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,061
    Quote Originally Posted by wrightflyer View Post
    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.

  3. #3
    Senior Member
    Join Date
    Apr 2020
    Location
    Tucson
    Posts
    135
    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.

  4. #4
    Junior Member
    Join Date
    Sep 2020
    Posts
    18
    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:

    Click image for larger version. 

Name:	filtADSR.png 
Views:	11 
Size:	8.9 KB 
ID:	22043

  5. #5
    Senior Member
    Join Date
    Apr 2020
    Location
    Tucson
    Posts
    135
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •