Chorus/Flanger

Status
Not open for further replies.

C0d3man

Well-known member
Hi,

I was trying a little bit around with the chorus and flanger effects. For the chorus I am missing a LFO modulation (this was also discussed here). So I tried the flanger with the simple ToneSweep example:

Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
#include <Bounce.h>

AudioSynthToneSweep myEffect;
AudioEffectFlange        flanger_r;
AudioEffectFlange        flanger_l;
AudioOutputPT8211      audioOutput;        // audio shield: headphones & line-out

// The tone sweep goes to left and right channels
AudioConnection          patchCord0(myEffect, flanger_r);
AudioConnection          patchCord1(myEffect, flanger_l);
AudioConnection patchCord2(flanger_r, 0, audioOutput, 0);
AudioConnection patchCord3(flanger_l, 0, audioOutput, 1);


float t_ampx = 0.8;
int t_lox = 10;
int t_hix = 22000;
// Length of time for the sweep in seconds
float t_timex = 10;


#define FLANGE_DELAY_LENGTH (2*AUDIO_BLOCK_SAMPLES)
int s_idx = 2*FLANGE_DELAY_LENGTH/4;
int s_depth = FLANGE_DELAY_LENGTH/4;
double s_freq = 3;
//#define FLANGE_DELAY_LENGTH (12*AUDIO_BLOCK_SAMPLES)
//int s_idx = 3 * FLANGE_DELAY_LENGTH / 4;
//int s_depth = FLANGE_DELAY_LENGTH / 8;
//double s_freq = .0625;
short delay_flanger_r[FLANGE_DELAY_LENGTH];
short delay_flanger_l[FLANGE_DELAY_LENGTH];


// <<<<<<<<<<<<<<>>>>>>>>>>>>>>>>
void setup(void)
{
  
  Serial.begin(9600);
  while (!Serial) ;
  delay(3000);

  AudioMemory(32);

  flanger_r.begin(delay_flanger_r, FLANGE_DELAY_LENGTH, s_idx, s_depth, s_freq);
  flanger_l.begin(delay_flanger_l, FLANGE_DELAY_LENGTH, s_idx, s_depth, s_freq);
  
  Serial.println("setup done");

  if(!myEffect.play(t_ampx,t_lox,t_hix,t_timex)) {
    Serial.println("AudioSynthToneSweep - begin failed");
    while(1);
  }
    Serial.println("1");

  // wait for the sweep to end
  while(myEffect.isPlaying());
    Serial.println("2");

  // and now reverse the sweep
  if(!myEffect.play(t_ampx,t_hix,t_lox,t_timex)) {
    Serial.println("AudioSynthToneSweep - begin failed");
    while(1);
  }
      Serial.println("3");

  // wait for the sweep to end
  while(myEffect.isPlaying());
  Serial.println("Done");
}

void loop(void)
{
}

What I am getting is very strange and sometimes audibly distorted. So my question is: Is the flanger really usable or more a kind of example?

Regards, Holger

P.S.: I am searching for a nice chorus effect for my port of the MDA-EPiano: https://codeberg.org/dcoredump/MicroMDAEPiano.git, and here in action - installed on a BlackAddr TGA board: https://youtu.be/1JCiIiuND5c
 
Status
Not open for further replies.
Back
Top