Analog Audio Output Support for ESP32-S2? #1024
-
Hello, I have been experimenting with some new esp32 modules I recently got, and I want to use the newer feature of hardware USB and higher speed as compared to the esp32. I realized that this library doesn't support the DAC analog out for esp32-s2. Is this a hardware incompatibility, or is support planned? |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 20 replies
-
The implementation is basically there: you just need to figure out from which Arduino version this is available and the activate it in the config. |
Beta Was this translation helpful? Give feedback.
-
As mentioned above you will need to upgrade: 2.2.1 will not work! |
Beta Was this translation helpful? Give feedback.
-
I have installed the latest alpha drivers for ESP32 boards, but I continue to get this compilation error: |
Beta Was this translation helpful? Give feedback.
-
Did you add the USE_ANALOG in the AudioConfig.h //-------ESP32C3, ESP32S3, ESP32S2--------- #if defined(ESP32) && defined(ESP32X) #define USE_ANALOG |
Beta Was this translation helpful? Give feedback.
-
Thanks for your input. I have committed some corrections to add the support for the DAC and ADC automatically based on the release. auto cfg = dac.defaultConfig(); and to set the log level to Warning For the volume here is the documentation in the Wiki: https://github.com/pschatzmann/arduino-audio-tools/wiki/Volume-Control |
Beta Was this translation helpful? Give feedback.
-
My mistake: I forgot to commit and push my last correction |
Beta Was this translation helpful? Give feedback.
-
Yes the conversion to 8bit was critical! |
Beta Was this translation helpful? Give feedback.
-
I assume that your audio is mono that you want to output to pin 18. I just committed a correction, so that you can define the channel in the config |
Beta Was this translation helpful? Give feedback.
-
Here is the implemented logic:
So when it is mono (channels ==1) then it is taking the value from the configuration, otherwise it uses DAC_CHANNEL_MASK_ALL which sends it to both channels. |
Beta Was this translation helpful? Give feedback.
Thanks for your input. I have committed some corrections to add the support for the DAC and ADC automatically based on the release.
I also corrected the bug because I was providing int16_t values to an api which expects uint8_t values.
As far as the quality is concerned, I suggest to experiment with different sample rates and buffer settings in your sketch.
auto cfg = dac.defaultConfig();
cfg.buffer_size = 1024;
cfg.buffer_count = 10;
cfg.sample_rate = 8000;
dac.begin(cfg);
and to set the log level to Warning
For the volume here is the documentation in the Wiki: https://github.com/pschatzmann/arduino-audio-tools/wiki/Volume-Control