Frippertronics audio looper

pedrobosch

New member
Hey!
Im new to using the teensy 3.6 and im struggling with a project where I want to make a Frippertronics audio looper. For now im keeping it simple trying to make the board work with a 10 second looper that loops continously with out buttons knobs or anything. Im using the adc and dacs no audio shield. My looper for now only loops once and then stops. Ive only managed to make it loop at extremly short timings.
Can anyone help me with this please?!
Here the code:
#include <_Teensy.h>
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
// #include <SD.h>
#include <SerialFlash.h>

AudioPlayQueue queuePlay1;
AudioRecordQueue queueRecord1;
AudioInputAnalog adc1;
AudioMixer4 mixer1;
AudioOutputAnalogStereo dacs1;
AudioConnection patchCord1(queuePlay1, 0, mixer1, 1);
AudioConnection patchCord2(adc1, queueRecord1);
AudioConnection patchCord3(adc1, 0, mixer1, 0);
AudioConnection patchCord4(mixer1, 0, dacs1, 0);
AudioConnection patchCord5(mixer1, 0, dacs1, 1);
const int bufferSize = AUDIO_BLOCK_SAMPLES;
int16_t buffer[bufferSize];
int bufferCount = 0;
IntervalTimer myTimer;
long duration = 0.000001;

void setup() {
AudioMemory(60);
Serial.begin(9600);
myTimer.begin(buffer_lenght, duration);
mixer1.gain(0, 0.8);
mixer1.gain(1, 0.8);
}
void loop(){
}
void buffer_lenght(){
bufferCount++; Serial.println(bufferCount);
if( (bufferCount >0) && (bufferCount == 10)){ // stop recording and start playing
queueRecord1.end(); Serial.println("Recording stopped");
queuePlay1.play(buffer, bufferSize); Serial.println("Playback working");
bufferCount = 0;
}
if (bufferCount == 0) { // start recording
queueRecord1.begin(); Serial.println("Recording started");
}
}
 
#include <_Teensy.h>
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
// #include <SD.h>
#include <SerialFlash.h>

AudioPlayQueue queuePlay1;
AudioRecordQueue queueRecord1;
AudioInputAnalog adc1;
AudioMixer4 mixer1;
AudioOutputAnalogStereo dacs1;
AudioConnection patchCord1(queuePlay1, 0, mixer1, 1);
AudioConnection patchCord2(adc1, queueRecord1);
AudioConnection patchCord3(adc1, 0, mixer1, 0);
AudioConnection patchCord4(mixer1, 0, dacs1, 0);
AudioConnection patchCord5(mixer1, 0, dacs1, 1);

const int bufferSize = AUDIO_BLOCK_SAMPLES;
int16_t buffer[bufferSize];
int bufferCount = 0;
IntervalTimer myTimer;
long timer = 0;
long timerDelay = 1000; //1000 = 1 second

void setup() {
AudioMemory(60);
Serial.begin(9600);
myTimer.begin(checkTimer, timerDelay);
mixer1.gain(0, 0.8);
mixer1.gain(1, 0.8);
}

void loop() {
}

void checkTimer() {
// If millis counter is greater than or equal to the timer...
if (millis() >= timer) {
// Update the timer for the next interval
timer = millis() + timerDelay;

bufferCount++;
Serial.println(bufferCount);

if (bufferCount > 0 && bufferCount == 10) {
queueRecord1.end();
Serial.println("Recording stopped");
queuePlay1.play(buffer, bufferSize);
Serial.println("Playback working");
bufferCount = 0;
}
else if (bufferCount == 0) {
queueRecord1.begin();
Serial.println("Recording started");
}
}
}
 
Last edited:
Back
Top