Hi everyone,
I am trying to create a simple delay effect on a signal
however I am not getting a clean delay sound but rather
some kind of white noise instead of the delay. Can anyone reproduce this ?
There does not seem to be a hardware problem since I can compile
and listen to the examples just fine. There seems to be some kind
of clipping or overloading in my code but I cannot figure out where.
Any help would be appreciated.
Here's the code, you have to attach a button on pin 15 (A1)
I am trying to create a simple delay effect on a signal
however I am not getting a clean delay sound but rather
some kind of white noise instead of the delay. Can anyone reproduce this ?
There does not seem to be a hardware problem since I can compile
and listen to the examples just fine. There seems to be some kind
of clipping or overloading in my code but I cannot figure out where.
Any help would be appreciated.
Here's the code, you have to attach a button on pin 15 (A1)
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
#include <Bounce.h>
// GUItool: begin automatically generated code
AudioSynthWaveform waveform1; //xy=293,163
AudioMixer4 mixer2; //xy=468,194
AudioSynthWaveformDc dc1; //xy=538,376
AudioEffectEnvelope envelope1; //xy=707,215
AudioEffectMultiply multiply1; //xy=741,351
AudioEffectDelay delay1; //xy=866,495
AudioMixer4 mixer1; //xy=876,280
AudioOutputI2S i2s1; //xy=1205,219
AudioConnection patchCord1(waveform1, 0, mixer2, 0);
AudioConnection patchCord2(mixer2, envelope1);
AudioConnection patchCord3(dc1, 0, multiply1, 1);
AudioConnection patchCord4(envelope1, 0, mixer1, 0);
AudioConnection patchCord5(multiply1, 0, mixer1, 1);
AudioConnection patchCord6(delay1, 0, multiply1, 0);
AudioConnection patchCord7(mixer1, delay1);
AudioConnection patchCord8(mixer1, 0, i2s1, 0);
AudioConnection patchCord9(mixer1, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=368,724
// GUItool: end automatically generated code
Bounce button0=Bounce(15,15);
void setup() {
AudioMemory(20);
waveform1.begin(0.2,660, WAVEFORM_TRIANGLE);
mixer1.gain(0,0.3);
mixer1.gain(1,0.6);
mixer2.gain(0,1);
pinMode(15, INPUT_PULLUP);
button0.update();
Serial.begin(9600);
dc1.amplitude(0.8);
delay1.delay(0,300);
envelope1.delay(2);
envelope1.attack(9.2);
envelope1.hold(2.1);
envelope1.decay(31.4);
envelope1.sustain(0.6);
envelope1.release(84.5);
sgtl5000_1.enable();
sgtl5000_1.volume(0.5);
}
void loop() {
button0.update();
if (button0.fallingEdge()) {
Serial.println("Button (pin 0) Press");
envelope1.noteOn();
}
if (button0.risingEdge()) {
Serial.println("Button (pin 0) Release");
envelope1.noteOff();
}
}
float map(float x, float in_min, float in_max, float out_min, float out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}