
Originally Posted by
PaulStoffregen
AudioInputAnalog only supports 1 signal. It doesn't support using multiple instances of AudioInputAnalog.
Paul I know that, maximum 2 mono signals if use adcs.
You can have 4 line-level inputs by using 2 audio shields with the quad I2S. Sparkfun wrote a
nice tutorial. Or you could use one shield for 2 line level input and the other shield for the mic input. The SGTL5000 chip can do either mono mic or stereo line in, not both. But if you have 2 SGTL5000, you could configure one of them for stereo line in and the other for mono mic.
That is nice to use 2 audio shields, I readed Sparkfun's tutorial.
But.. I was thinking, if SGTL has own build in an ADC and use it for processing then I be able use another mono or stereo Teensy ADC and I tried this;

And working! until I not use any other ADC in any way. I need to know, why is like that
Sine>>DAC >---wirring by ---||---10uF and feeding ---ADC1
MIC IN audio board by i2s
Mixing to i2s OUT
AND I got simultaneously ADC1 and working MIC from audio board, even if I use stereo adcs object also working! I got stereo + mic from audio board, that is 3 signal simultaneously and I get also these signals on headphones and line out.
For me ideal, I don't want more inputs and quality is enough. But is one problem in this solution... if I want use more analog inputs, for control function SGTL or frequency of sine object or any other knob, I cannot because ADC1 stop working, even DAC1 too. Any control knobs also stop..
I can only use MIC IN but without knob control volume.
If someone want try, code is here and working until uncomment lines for control.
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioInputI2S i2s2; //xy=140,64
AudioInputAnalog adc1(A2); //xy=141,30
AudioSynthWaveformSine sine1; //xy=278,143
AudioMixer4 mixer1; //xy=347,49
AudioOutputAnalog dac1; //xy=407,143
AudioOutputI2S i2s1; //xy=537,47
AudioConnection patchCord1(i2s2, 0, mixer1, 1);
AudioConnection patchCord2(i2s2, 1, mixer1, 2);
AudioConnection patchCord3(adc1, 0, mixer1, 0);
AudioConnection patchCord4(sine1, dac1);
AudioConnection patchCord5(mixer1, 0, i2s1, 0);
AudioConnection patchCord6(mixer1, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=343,103
// GUItool: end automatically generated code
void setup() {
Serial.begin(9600);
AudioMemory(40);
dac1.analogReference(EXTERNAL);
sgtl5000_1.enable();
sgtl5000_1.volume(0.5);
sgtl5000_1.micGain(5);
sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
mixer1.gain(0, 0.4);
mixer1.gain(1, 0.4);
mixer1.gain(2, 0.4);
}
elapsedMillis msc = 0;
int in_gain = 0;
float vol = 0.0;
void loop() {
/*
if (msc > 30) {
in_gain = map(analogRead(A3),0,1023,0,64);
sgtl5000_1.micGain(in_gain);
sgtl5000_1.lineInLevel(in_gain);
vol = analogRead(A1);
sgtl5000_1.dacVolume(vol / 1023.0);
msc = 0;
}
*/
int f = 0;
//f = analogRead(A6)<<2;
sine1.amplitude(0.5);
sine1.frequency(80.000+f);
}