Closed Radio-Builder closed 1 year ago
There are no examples because this does not work! Both the internal DAC and the internal ADC are working only on port 0, so you can't use them at the same time
OK,,, Thanks very much for your reply.
Instead of the output to the internal DAC you could try to use the PWM output
Thanks for the idea... It would be a solution for me.
This is what I tried... but when I use your sinewave code I get 0-100% approx change in the PWM outout but when I use the internal ADC it does vary with the input 0-1V Sinewave but only about 5% , varies only approx +/- 2-3% around 90%.
* @file streams-generator-pwm.ino
* @author Phil Schatzmann
* @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-stream/streams-generator-pwm/README.md
* @author Phil Schatzmann
* @copyright GPLv3
*/
#include "AudioTools.h"
//Pins pins = {22, 23};
AudioInfo info(8000, 1, 16);
//SineWaveGenerator<int16_t> sineWave(32000); // subclass of SoundGenerator with max amplitude of 32000
//GeneratedSoundStream<int16_t> sound(sineWave); // Stream generated from sine wave
AnalogAudioStream in;
PWMAudioOutput pwm;
StreamCopy copier(pwm, in); // copy in to out
void setup() {
Serial.begin(115200);
AudioLogger::instance().begin(Serial, AudioLogger::Warning);
// setup sine wave
//sineWave.begin(info, N_B4);
// setup PWM output
auto config = pwm.defaultConfig();
config.copyFrom(info);
//config.resolution = 11;
pwm.begin(config);
// // RX automatically uses port 0 with pin GPIO34
auto cfgRx = in.defaultConfig(RX_MODE);
cfgRx.copyFrom(info);
in.begin(cfgRx);
}
void loop(){
copier.copy();
}```
Did you try to display the output of the AnalogAudioStream.? I think you need to center the singal... https://github.com/pschatzmann/arduino-audio-tools/wiki/It's-not-working
Hi @pschatzmann, I am using an ESP32 Devkit C and am trying to read audio from the internal DAC and pass it straight through to the internal ADC. ( Later I want to add a FIR filter in the middle ) but I can not get it to work. There are no examples so this is what I tried...
If I set "cfgTx.port_no = 1;" I get a core panic
If I set "cfgTx.port_no = 0;" I get a 2 Errors E (96) I2S: register I2S object to platform failed [E] AnalogAudioESP32.h : 75 - begin - i2s_driver_install
This is the LOG