Help with waveshaper effect

Status
Not open for further replies.

scruffy

Member
Hello everyone,
first post to the forum so sorry if this is in the wrong place etc..

I am working on a midi controlled guitar effect unit using a teensy 3.6 and the BlackAddr guitar audio board version 1.2.
I have many effects working but the waveshaper has me stumped. I am not getting any effect at all, just clean guitar.
I did find the github page https://github.com/dxinteractive/TeensyAudioWaveshaper and have imported the library, also
using an example shown on the github page. I am sure I am doing something wrong so hopefully someone can give me a clue.
Thanks!

My code is below:

#include <Audio.h>
#include <Wire.h>
#include "BALibrary.h"
#include "BAEffects.h"
#include "effect_waveshaper.h"

using namespace BAEffects;
using namespace BALibrary;

// Codec commom to all modules
BAAudioControlWM8731 codecControl;


// GUItool: begin automatically generated code
AudioInputI2S i2s1; //xy=269,212
AudioEffectWaveshaper waveshape1; //xy=607,222
AudioOutputI2S i2s2; //xy=921,222
AudioConnection patchCord1(i2s1, 0, waveshape1, 0);
AudioConnection patchCord2(waveshape1, 0, i2s2, 0);
AudioConnection patchCord3(waveshape1, 0, i2s2, 1);
// GUItool: end automatically generated code

float WAVESHAPE_EXAMPLE[17] = {
-0.588,
-0.579,
-0.549,
-0.488,
-0.396,
-0.320,
-0.228,
-0.122,
0,
0.122,
0.228,
0.320,
0.396,
0.488,
0.549,
0.579,
0.588
};



void setup() {

// wait a few ms to make sure the GTA Pro is fully powered up
delay(5);

// Give it some memory resources
AudioMemory(128);

// Reset codec
codecControl.disable();
delay(100);
codecControl.enable();
delay(100);


waveshape1.shape(WAVESHAPE_EXAMPLE, 17);

}

void loop() {


}
 
The WAVESHAPE_EXAMPLE array is short enough that it only has a significant effect on the high frequency content of the audio.
Try using a larger array with more changes in the amplitude. This one is a combination of three separate arrays that I tried. Individually they didn't seem to be doing anything. Combined, they make quite a mess of the audio (turn the volume down) :)
Code:
float WAVESHAPE_EXAMPLE[] = {
  -0.588,
  -0.579,
  -0.549,
  -0.488,
  -0.396,
  -0.320,
  -0.228,
  -0.122,
  0,
  0.122,
  0.228,
  0.320,
  0.396,
  0.488,
  0.549,
  0.579,
  0.588,
  -0.588,
  -0.579,
  0.549,
  0.488,
  -0.396,
  -0.320,
  0.228,
  0.122,
  -0.122,
  -0.228,
  0.320,
  0.396,
  -0.488,
  -0.549,
  0.579,
  0.588,
  -0.9,
   0.9,
  -0.9,
   0.9,
  -0.9,
   0.9,
  -0.9,
   0.9,
   0.9,
  -0.9,
   0.9,
  -0.9,
   0.9,
  -0.9,
   0.9,
  -0.9,
  0.228,
  0.122,
  -0.122,
  -0.228,
  0.320,
  0.396,
  -0.488,
  -0.549,
  0.579,
  0.588,
  -0.9,
   0.9,
  -0.9,
   0.9,
  -0.9,
   0.9,
};

If you also change this:
Code:
waveshape1.shape(WAVESHAPE_EXAMPLE, 17);
to this:
Code:
waveshape1.shape(WAVESHAPE_EXAMPLE, sizeof(WAVESHAPE_EXAMPLE)/sizeof(WAVESHAPE_EXAMPLE[0]));
you won't have to adjust that 17 to 65 (or 33, etc) when you change the array size.

Pete
 
Status
Not open for further replies.
Back
Top