[ESP32-Audio-Kit | AC101] poor playback quality with higher sample rates.
sehraf opened this issue · 1 comments
Rhasspy uses some simple sounds by default to signal wake-up, end of recording and errors, which can be found here. While the sounds are short, they have a sample rate of 44100 Hz (with 16bits depth) and their playback on an ESP32-Audio-Kit with AC101 is bad.
I tried various higher writeSize
values to increase the DMA buffer and 1024
seems to be good. It runs stable and sounds good. (The default is writeSize = 256
). @locatw wrote the code around the DMA buffer size here
I don't want to blindly pump up the value and @locatw probably had their reasons. So, does anybody have some experience/opinion with DMA buffer size? The current code uses the default divide by four. So at the moment it's 256 / 4 = 64
which seems to be too low for proper 44KHz playback.
Otherwise i can send a PR with:
iff --git a/PlatformIO/src/devices/AudioKit.hpp b/PlatformIO/src/devices/AudioKit.hpp
index 35974db..488156f 100644
--- a/PlatformIO/src/devices/AudioKit.hpp
+++ b/PlatformIO/src/devices/AudioKit.hpp
@@ -188,6 +188,11 @@ void AudioKit::init()
key_listen = is_es ? ES_KEY_LISTEN : KEY_LISTEN;
+ if (!is_es) {
+ // AC101 use 256 byte DMA buffer when writing
+ writeSize = 256 << 2;
+ }
+
// LEDs
pinMode(LED_WIFI, OUTPUT); // active low
digitalWrite(LED_WIFI, HIGH);
Since i don't have an Audio-Kit with the ES8388 chip i can only test with an AC101. Maybe someone can do some testing with an ES8388?
I think the 256 was there because is was taken over from the Matrix Voice. Feel free to do a PR to the code.
I do not own either of the chips (in fact no Audio Kit at all)