madzo0omadz
Member
Hi guys,
I've been using the Teensy 3.2 along with two Audio shields, following the Quad tutorial shown below:
https://www.sparkfun.com/news/2055
So now I have 2xLineIn, 2xLineOut/headphone. I am trying to apply an Eqalizer for each Line In and output all 4 channels in one Line out. The problem I'm having is that I can't apply independent equalizers to each LineIn. For example, say I have two soundtracks that I want to mix into one, before mixing them I want to apply Bass Booster on music stream 1 and a vocal booster on music stream 2. When I run the code below, it applies Bass Booster to one LineOut(headphone1) and a Vocal Booster to another LineOut(headphone2) and not to the individual input streams themselves. Any idea if this is possible to do on Teensy Quad Audio?
Here is the code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioInputI2SQuad i2s_quad1; //xy=377,202
AudioMixer4 mixer1; //xy=629,160
AudioMixer4 mixer2; //xy=631,254
AudioOutputI2SQuad i2s_quad2; //xy=822,214
AudioConnection patchCord1(i2s_quad1, 0, mixer1, 0);
AudioConnection patchCord2(i2s_quad1, 1, mixer2, 0);
AudioConnection patchCord3(i2s_quad1, 2, mixer1, 1);
AudioConnection patchCord4(i2s_quad1, 3, mixer2, 1);
AudioConnection patchCord5(mixer1, 0, i2s_quad2, 0);//change this to 2 to switch to lower headphone jack
AudioConnection patchCord6(mixer2, 0, i2s_quad2, 1);//change this to 3 to switch to lower headphone jack
AudioControlSGTL5000 sgtl5000_1; //xy=162,36
AudioControlSGTL5000 sgtl5000_2; //xy=492,44
// GUItool: end automatically generated code
const int myInput = AUDIO_INPUT_LINEIN;
//const int myInput = AUDIO_INPUT_MIC;
void setup() {
// Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example
AudioMemory(50);
// Enable the first audio shield (Music Stream 1), select input, and enable output
sgtl5000_1.setAddress(LOW);
sgtl5000_1.enable();
sgtl5000_1.inputSelect(myInput);
sgtl5000_1.volume(0.75); //0.75
sgtl5000_1.audioPreProcessorEnable();
sgtl5000_1.audioPostProcessorEnable();
// Enable the second audio shield (Music Stream 2), select input, and enable output
sgtl5000_2.setAddress(HIGH);
sgtl5000_2.enable();
sgtl5000_2.inputSelect(myInput);
sgtl5000_2.volume(0.75);
sgtl5000_2.audioPreProcessorEnable();
sgtl5000_2.audioPostProcessorEnable();
//Notes: mixer 1 = left ear, mixer 2 = right ear
// mixer1/2 channel 0 is music stream 1, channel 1 is music stream 2
}
//switch between different Equalizer modes:
int mode=2;
void loop() {
if (mode == 1) {
//Bass boost Stream 1, Bass reducer on Stream 2; mode 1
//gains
mixer1.gain(0,0.75);
mixer2.gain(0,0.75);
mixer1.gain(1,0.75);
mixer2.gain(1,0.75);
//Change Equalizer
//Music Stream 1 (upper Teensy Audio board); add bass boost to it
sgtl5000_1.eqSelect(3);
sgtl5000_1.eqBands(1,1,-1,0,0);
//Music Stream 2 (Lower Teensy Audio board); remove bass from it
sgtl5000_2.eqSelect(3);
sgtl5000_2.eqBands(-1,-1,1,-1,-1);
}
}
I've been using the Teensy 3.2 along with two Audio shields, following the Quad tutorial shown below:
https://www.sparkfun.com/news/2055
So now I have 2xLineIn, 2xLineOut/headphone. I am trying to apply an Eqalizer for each Line In and output all 4 channels in one Line out. The problem I'm having is that I can't apply independent equalizers to each LineIn. For example, say I have two soundtracks that I want to mix into one, before mixing them I want to apply Bass Booster on music stream 1 and a vocal booster on music stream 2. When I run the code below, it applies Bass Booster to one LineOut(headphone1) and a Vocal Booster to another LineOut(headphone2) and not to the individual input streams themselves. Any idea if this is possible to do on Teensy Quad Audio?
Here is the code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioInputI2SQuad i2s_quad1; //xy=377,202
AudioMixer4 mixer1; //xy=629,160
AudioMixer4 mixer2; //xy=631,254
AudioOutputI2SQuad i2s_quad2; //xy=822,214
AudioConnection patchCord1(i2s_quad1, 0, mixer1, 0);
AudioConnection patchCord2(i2s_quad1, 1, mixer2, 0);
AudioConnection patchCord3(i2s_quad1, 2, mixer1, 1);
AudioConnection patchCord4(i2s_quad1, 3, mixer2, 1);
AudioConnection patchCord5(mixer1, 0, i2s_quad2, 0);//change this to 2 to switch to lower headphone jack
AudioConnection patchCord6(mixer2, 0, i2s_quad2, 1);//change this to 3 to switch to lower headphone jack
AudioControlSGTL5000 sgtl5000_1; //xy=162,36
AudioControlSGTL5000 sgtl5000_2; //xy=492,44
// GUItool: end automatically generated code
const int myInput = AUDIO_INPUT_LINEIN;
//const int myInput = AUDIO_INPUT_MIC;
void setup() {
// Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example
AudioMemory(50);
// Enable the first audio shield (Music Stream 1), select input, and enable output
sgtl5000_1.setAddress(LOW);
sgtl5000_1.enable();
sgtl5000_1.inputSelect(myInput);
sgtl5000_1.volume(0.75); //0.75
sgtl5000_1.audioPreProcessorEnable();
sgtl5000_1.audioPostProcessorEnable();
// Enable the second audio shield (Music Stream 2), select input, and enable output
sgtl5000_2.setAddress(HIGH);
sgtl5000_2.enable();
sgtl5000_2.inputSelect(myInput);
sgtl5000_2.volume(0.75);
sgtl5000_2.audioPreProcessorEnable();
sgtl5000_2.audioPostProcessorEnable();
//Notes: mixer 1 = left ear, mixer 2 = right ear
// mixer1/2 channel 0 is music stream 1, channel 1 is music stream 2
}
//switch between different Equalizer modes:
int mode=2;
void loop() {
if (mode == 1) {
//Bass boost Stream 1, Bass reducer on Stream 2; mode 1
//gains
mixer1.gain(0,0.75);
mixer2.gain(0,0.75);
mixer1.gain(1,0.75);
mixer2.gain(1,0.75);
//Change Equalizer
//Music Stream 1 (upper Teensy Audio board); add bass boost to it
sgtl5000_1.eqSelect(3);
sgtl5000_1.eqBands(1,1,-1,0,0);
//Music Stream 2 (Lower Teensy Audio board); remove bass from it
sgtl5000_2.eqSelect(3);
sgtl5000_2.eqBands(-1,-1,1,-1,-1);
}
}