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

Thread: Pop/Click Noises on Flange.Voices update

  1. #1
    Junior Member
    Join Date
    Apr 2022
    Posts
    2

    Pop/Click Noises on Flange.Voices update

    Hi All,

    I have searched the forums, but can't find a solution to my problem.

    I'm attempting to add a ramped increase/decrease to a flange effect on the delayRate whereby if a button is held down, it increases and when released decreases. Apologies for the poor code below but before that, here's the things I've tried so far:
    - Adjust the envelope parameters
    - increase AudioMemory
    - Use a mixer with 2 flange inputs and switch between them with a delay on update

    Unfortunately each time I call flange1.voices I get an unwanted pop/click type noise. I've also got it so it only calls this update if there's a new value. Any help would be much appreciated. Thank you!

    Code:
    #include <JC_Button.h>
    #include <elapsedMillis.h>
    #include <Ramp.h>
    
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    
    // GUItool: begin automatically generated code
    AudioSynthWaveformSine   sine1;          //xy=248,248
    AudioEffectEnvelope      envelope1;      //xy=424,249
    AudioEffectFlange        flange1;        //xy=574,264
    AudioOutputI2S           i2s1;           //xy=730,328
    AudioConnection          patchCord1(sine1, envelope1);
    AudioConnection          patchCord2(envelope1, flange1);
    AudioConnection          patchCord3(flange1, 0, i2s1, 0);
    
    // GUItool: end automatically generated code
    
    // Accel Counter
    elapsedMillis accel_count;
    
    // Flange settings
    #define FLANGE_DELAY_LENGTH (6*AUDIO_BLOCK_SAMPLES)
    int s_idx = FLANGE_DELAY_LENGTH/4;
    int s_depth = FLANGE_DELAY_LENGTH/6;
    double s_freq = 5;
    short l_delayline[FLANGE_DELAY_LENGTH];
    short r_delayline[FLANGE_DELAY_LENGTH];
    
    AudioControlSGTL5000 audioShield;
    
    rampInt myRamp;
    Button myBtn(1);
    double new_freq;
    
    void setup() {
      myBtn.begin();
      
      AudioMemory(12);
    
      // Enable the audio shield and set the output volume.
      audioShield.enable();
      audioShield.volume(1);
    
      sine1.frequency(55);
      sine1.amplitude(0.5);
    
      flange1.begin(l_delayline, FLANGE_DELAY_LENGTH, s_idx, s_depth, s_freq);
    
      //envelope1.attack(20);    // 20ms
      //envelope1.hold(0);      // 10ms
      
      envelope1.noteOn();
    
      myRamp.go(5, 0);
      
    }
    
    void loop () {
      myBtn.read();
      
      if (myBtn.wasPressed()) {
        myRamp.go(35,3000);
      }
    
      if (myBtn.wasReleased()) {
        myRamp.go(5, 3000);
      }
    
      if (accel_count > 100) {
        if (s_freq != myRamp.update()) {
          flange1.voices(s_idx, s_depth, myRamp.update());
          s_freq = myRamp.update();
        }
        accel_count = 0;
      }
    }

  2. #2
    Junior Member
    Join Date
    Apr 2022
    Posts
    2
    Just a quick update. I've since added a ladder filter and this has effectively worked but I don't feel like simply filtering out the unwanted noise is the correct way.

  3. #3
    Senior Member
    Join Date
    Apr 2020
    Location
    Tucson
    Posts
    160
    You need to set up two flange objects and fade between them with like a 1mS ramp on each. Update one with new settings and fade to that one, back and forth. Works quite well.

Posting Permissions

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