Hi,
I have a problem I can't quite figure out - I'm using a Teensy 4.1 to take audio from an audio jack (AudioInputAnalog), add a delay effect, then pass it back out through another audio jack (AudioOutputMQS). I also pass through a dry version of the input straight to the output.
This works great.
I'm not using any audio adaptor boards (quality is not too important as the source will be lo-fi tones).
I'm able to control the length of delay with a potentiometer successfully.
The problem comes when I introduce a feedback loop, with the intention of runaway feedback, to be controlled with a pot attenuating the AudioAmplifier named feedbackController. I can hear the feedback loop start up (as the gain goes over 1), but then the audio quickly cuts and I get silence. If I bring the feedbackController gain back down below 1, the audio will restart.
I'm feeding the output of the first delay channel back into itself through a mixer (preMixer).
I guess I may be having some sort of out of memory error, but I was under the impression that having just one Delay channel in use, and simply feeding the previous delay into the next one, wouldn't use any more memory than without the feedback, but I guess I may be likely to be incorrect there!
As you can see I've made an attempt to check on memory usage, and have experimented with various AudioMemory(x) values.
Many thanks in advance.
I have a problem I can't quite figure out - I'm using a Teensy 4.1 to take audio from an audio jack (AudioInputAnalog), add a delay effect, then pass it back out through another audio jack (AudioOutputMQS). I also pass through a dry version of the input straight to the output.
This works great.
I'm not using any audio adaptor boards (quality is not too important as the source will be lo-fi tones).
I'm able to control the length of delay with a potentiometer successfully.
The problem comes when I introduce a feedback loop, with the intention of runaway feedback, to be controlled with a pot attenuating the AudioAmplifier named feedbackController. I can hear the feedback loop start up (as the gain goes over 1), but then the audio quickly cuts and I get silence. If I bring the feedbackController gain back down below 1, the audio will restart.
I'm feeding the output of the first delay channel back into itself through a mixer (preMixer).
I guess I may be having some sort of out of memory error, but I was under the impression that having just one Delay channel in use, and simply feeding the previous delay into the next one, wouldn't use any more memory than without the feedback, but I guess I may be likely to be incorrect there!
As you can see I've made an attempt to check on memory usage, and have experimented with various AudioMemory(x) values.
Many thanks in advance.
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioInputAnalog inputJack; // xy=98,144
AudioEffectDelay delay1; // xy=393,238
AudioMixer4 preMixer; // xy=532,205
AudioMixer4 mixer1; // xy=532,205
AudioOutputMQS outputJack; // xy=1093,382
AudioAmplifier inputToPremixer; // xy=950,449
AudioAmplifier feedbackController; // xy=950,449
AudioConnection patchCord1(inputJack, 0, inputToPremixer, 0);
AudioConnection patchCord2(inputToPremixer, 0, preMixer, 0);
AudioConnection patchCord3(preMixer, 0, delay1, 0);
AudioConnection patchCord4(inputJack, 0, mixer1, 0);
AudioConnection patchCord5(delay1, 0, feedbackController, 0);
AudioConnection patchCord6(feedbackController, 0, preMixer, 1);
AudioConnection patchCord7(delay1, 0, mixer1, 1);
AudioConnection patchCord8(mixer1, 0, outputJack, 1);
int pot1;
const int OldRange = 1024;
const float NewRange = 2;
float wetDry;
// GUItool: end automatically generated code
void setup()
{
// allocate enough memory for the delay
AudioMemory(250);
delay1.delay(0, 600);
preMixer.gain(1, 1);
inputToPremixer.gain(0.85);
feedbackController.gain(0.7);
mixer1.gain(1, 0.7)
Serial.println("Playing....");
}
void loop()
{
pot1 = analogRead(1);
if (pot1 == 0)
{
wetDry = 0;
}
else
{
wetDry = ((pot1 * NewRange) / OldRange);
}
Serial.print("wetdry = ");
Serial.print(wetDry);
Serial.println("max");
Serial.print(AudioMemoryUsage());
feedbackController.gain(wetDry);
}