Hello!
I am trying a simple project where I want to change the pitch of audio from mic input of Teensy audio shield, and send it out via the headphone jack of the shield. My code is attached.
I am unable to hear any audio. However, the moment I uncomment the only line in the loo(), I can hear the mic input directly into the headphones. Am I doing something wrong in the way I'm using the beginPitchShift() function?
Thanks a bunch in advance!
Tejas
I am trying a simple project where I want to change the pitch of audio from mic input of Teensy audio shield, and send it out via the headphone jack of the shield. My code is attached.
I am unable to hear any audio. However, the moment I uncomment the only line in the loo(), I can hear the mic input directly into the headphones. Am I doing something wrong in the way I'm using the beginPitchShift() function?
Thanks a bunch in advance!
Tejas
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioInputI2S i2s2; //xy=105,90
AudioMixer4 mixer1; //xy=230,103
AudioEffectGranular granular1; //xy=363,103
AudioOutputI2S i2s1; //xy=507,102
AudioConnection patchCord1(i2s2, 0, mixer1, 0);
AudioConnection patchCord2(i2s2, 1, mixer1, 1);
AudioConnection patchCord3(mixer1, granular1);
AudioConnection patchCord4(granular1, 0, i2s1, 0);
AudioConnection patchCord5(granular1, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=506,150
// GUItool: end automatically generated code
#define GRANULAR_MEMORY_SIZE 12800 // enough for 290 ms at 44.1 kHz
int16_t granularMemory[GRANULAR_MEMORY_SIZE];
void setup() {
AudioMemory(32);
sgtl5000_1.enable();
sgtl5000_1.volume(0.8);
sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
sgtl5000_1.micGain(50);
mixer1.gain(0, 0.5);
mixer1.gain(1, 0.5);
granular1.begin(granularMemory, GRANULAR_MEMORY_SIZE);
}
void loop() {
granular1.beginPitchShift(50);
granular1.setSpeed(1.0);
}