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

Thread: Midi control of effect with smooth transitions

  1. #1

    Midi control of effect with smooth transitions

    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);
           }
      }
    }

  2. #2
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,045

Posting Permissions

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