Patrick1992
Member
I just want to clarify for my own sanity, but is there no way of updating the delay time of the delay object with a potentiometer? Seems like such a simple thing but obviously i am misunderstanding how the object works or something. I have searched for info but not really come across anything about it. I tried using a mixer to blend between different delay taps with different delay times but that is pretty unsatisfactory.
Here is what i'm working on, very simple delay/bitcrush/filter effect but pretty useless if i can gain control over the delay time
Thanks for reading
Here is what i'm working on, very simple delay/bitcrush/filter effect but pretty useless if i can gain control over the delay time
Thanks for reading
Code:
#define LED 3
#include <Bounce.h>
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioInputI2S i2s1; //xy=82,344
AudioMixer4 mixer1; //xy=162,96
AudioEffectBitcrusher bitcrusher1; //xy=255,27
AudioEffectDelay delay1; //xy=307,220
AudioAmplifier amp1; //xy=409,29
AudioMixer4 mixer2; //xy=462,224
AudioFilterBiquad biquad1; //xy=535,37
AudioOutputI2S i2s2; //xy=746,214
AudioConnection patchCord1(i2s1, 0, mixer1, 0);
AudioConnection patchCord2(i2s1, 0, bitcrusher1, 0);
AudioConnection patchCord3(i2s1, 0, mixer2, 1);
AudioConnection patchCord4(mixer1, delay1);
AudioConnection patchCord5(bitcrusher1, amp1);
AudioConnection patchCord6(delay1, 0, mixer1, 1);
AudioConnection patchCord7(delay1, 0, mixer2, 0);
AudioConnection patchCord8(delay1, 1, mixer2, 2);
AudioConnection patchCord9(amp1, biquad1);
AudioConnection patchCord10(mixer2, 0, i2s2, 0);
AudioConnection patchCord11(biquad1, 0, mixer1, 2);
AudioControlSGTL5000 sgtl5000_1; //xy=767,328
// GUItool: end automatically generated code
/*
Bounce footswitch = Bounce(0, 50); // debounce the footswitch
Bounce D1 = Bounce(1, 50); // debounce the toggle switch
Bounce D2 = Bounce(2, 50); // " " " " " " " " "
// this section includes the function to check the toggle position
bool right;
bool middle;
bool left;
void checkToggle () { // this is our function to check toggle position...
D1.update(); D2.update(); // check digital inputs connected to toggle (can delete I think)
if (digitalRead(1) && !digitalRead(2)) {
right = 1; // toggle is right
middle = 0;
left = 0;
}
if (digitalRead(1) && digitalRead(2)) {
right = 0; // toggle is in the middle
middle = 1;
left = 0;
}
if (!digitalRead(1) && digitalRead(2)) {
right = 0; // toggle is left
middle = 0;
left = 1;
}
}
*/
byte bitdepth = 16; // used to set bit depth
int samplerate = 44100; // used to set sample rate
float mix; // clean/delay mix
float mix1; // clean/delay mix
float feedback; // delay feedback
int bandpass; //bandpass cutoff frequency
void setup() {
AudioMemory(400); // the "40" represents how much internal memory (in the Teensy, not the external RAM chip) is allotted for audio recording. It is measured in sample blocks, each providing 2.9ms of audio.
sgtl5000_1.enable(); // this turns on the SGTL5000, which is the audio codec on the audio board
sgtl5000_1.volume(1); // this sets the output volume (it can be between 0 and 1)
sgtl5000_1.inputSelect(AUDIO_INPUT_LINEIN); // selects the audio input, we always use Line In
analogReadResolution(12); // configure the pots to give 12 bit readings
pinMode(0, INPUT_PULLUP); // internal pull-up resistor for footswitch
pinMode(1, INPUT_PULLUP); // internal pull-up resistor for toggle
pinMode(2, INPUT_PULLUP); // internal pull-up resistor for toggle
pinMode(3, OUTPUT); // pin 3 (the LED) is an output;
Serial.begin(9600); // initiate the serial monitor. USB is always 12 Mbit/sec
sgtl5000_1.audioPostProcessorEnable();
analogReadAveraging(32);
}
void loop() {
//set up delay
delay1.delay (0, 400);
delay1.disable (1);
delay1.disable (2);
delay1.disable (3);
delay1.disable (4);
delay1.disable (5);
delay1.disable (6);
delay1.disable (7);
feedback = (float) analogRead (A2) / 4095; // delay feedback
mix = (float) analogRead (A0) / 2000; // wet/dry mix
Serial.println (mix);
mix1 = 1.0 - mix;
amp1.gain(2);
//Set mixer levels
mixer1.gain (0, mix1); // clean gtr in level
mixer1.gain (1, feedback);
mixer1.gain (2, mix);
mixer2.gain (0, 0.5);
mixer2.gain (1, 0.5);
// do bitcrushing
bitdepth = (16);
bitcrusher1.bits(bitdepth); // set bit depth
samplerate = (analogRead(A1) << 1) + 1000; // samplerate pot ranges from 1000 to 9190
bitcrusher1.sampleRate(samplerate); // set sample rate
bandpass = (analogRead(A3) << 1) + 1000; // lpf pot ranges from 500 to 8240hz
biquad1.setBandpass (0, bandpass, 2);
biquad1.setBandpass (1, bandpass, 2);
biquad1.setBandpass (2, bandpass, 2);
biquad1.setBandpass (3, bandpass, 2);
}