ADC library conflicts with Audio library dac output

I am trying to use a teensy 3.6 to read an analog input and put signals to the dac pins using the soundwave synthesis library and AudioOutputAnalogStereo dacs

Running each one of these alone works fine, however the moment I setup "ADC *adc = new ADC();" the dac output using AudioOutputAnalogStereo stops working.

Any idea on what the conflict between the two is and how to resolve it?

Thanks
 
Not trying to do analogRead with AudioInputAnalog. Trying to do analogRead with the ADC and output to the dac with Audio lib

Very simple, this works:

Code:
#include <Audio.h>

AudioSynthWaveformSine   sine;
AudioOutputAnalogStereo  dacs;
AudioConnection          patchCord1(sine, 0, dacs, 0);
AudioConnection          patchCord2(sine, 0, dacs, 1);


//#include <ADC.h>
//ADC *adc = new ADC();

void setup() {
  AudioMemory(10);
  dacs.analogReference(INTERNAL);
  
  sine.frequency(120);
  sine.amplitude(0.6);
}

void loop() {
  
}

Uncomment the two ADC related lines (two comments in the text) no more ADC output (other outputs work fine).
Last tested with teensyduino 1.42
 
Since DACs are also analog pins (A21, A22), the ADC library initializations might conflict with Audio lib DAC ... more study required.

can you use the Teensy analogRead()? That might avoid a conflict. a simple analogRead(A0) in your sketch does not
seem to kill the DAC in my testing
 
Since DACs are also analog pins (A21, A22), the ADC library initializations might conflict with Audio lib DAC ... more study required.

can you use the Teensy analogRead()? That might avoid a conflict. a simple analogRead(A0) in your sketch does not
seem to kill the DAC in my testing

That is what I resorted to at the moment, the only thing is that it does not allow me to control any settings not the dac (number of bits, conversion speed and averaging).

Thanks
 
analogReadAveraging(1);
analogReadResolution(8);
changing conversion speed would require manipulating the ADC registers ....
 
Back
Top