Midi control of effect with smooth transitions

Status
Not open for further replies.

lamikam

Active member
Using the audio board with a midi controller. The controller is to change the values of various effect parameters.
In the code snippet below, I am reading the midi channel data in the loop and changing the flanger effect frequency rate based on the control value. This sounds very choppy when the controller values change. Is there any method to "smooth out" the transitions?

Thanks

Code:
AudioInputI2S       audioInput;         // audio shield: mic or line-in
AudioEffectFlange   l_myEffect;
AudioOutputI2S      audioOutput;        // audio shield: headphones & line-out
AudioConnection c1(audioInput, 0, l_myEffect, 0);
AudioConnection c3(l_myEffect, 0, audioOutput, 0);
AudioControlSGTL5000 audioShield;


void loop() {
   if (MIDI.read()) {                    // Is there a MIDI message incoming ?
      byte type = MIDI.getType();
      switch (type) {
               default:
          d1 = MIDI.getData1();
          d2 = MIDI.getData2();
          Serial.println(String("Message, type=") + type + ", data = " + d1 + " " + d2);
          double freq = 0.01 + scaledVal(d2)*10;
          Serial.printf("Freq = %f\n", freq);
          l_myEffect.voices(s_idx,s_depth,freq);
       }
  }
}
 
Status
Not open for further replies.
Back
Top