From 4971e5ce6847996b487e76866e1078b2686a62de Mon Sep 17 00:00:00 2001 From: FedericoBusero <35894905+FedericoBusero@users.noreply.github.com> Date: Sun, 26 Dec 2021 18:29:09 +0100 Subject: [PATCH] Increase I2S buffer size (#472) Increase I2S buffer size from 64 samples/ block to 128 samples/block. Thus fixes sound artifacts described in issue https://github.com/earlephilhower/ESP8266Audio/issues/442 Fixes #442 --- src/AudioOutputI2S.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AudioOutputI2S.cpp b/src/AudioOutputI2S.cpp index 98346f07..0eb3c0da 100644 --- a/src/AudioOutputI2S.cpp +++ b/src/AudioOutputI2S.cpp @@ -220,7 +220,7 @@ bool AudioOutputI2S::begin(bool txDAC) .communication_format = comm_fmt, .intr_alloc_flags = ESP_INTR_FLAG_LEVEL1, // lowest interrupt priority .dma_buf_count = dma_buf_count, - .dma_buf_len = 64, + .dma_buf_len = 128, .use_apll = use_apll // Use audio PLL }; audioLogger->printf("+%d %p\n", portNo, &i2s_config_dac); @@ -324,7 +324,7 @@ void AudioOutputI2S::flush() { #ifdef ESP32 // makes sure that all stored DMA samples are consumed / played - int buffersize = 64 * this->dma_buf_count; + int buffersize = 128 * this->dma_buf_count; int16_t samples[2] = {0x0, 0x0}; for (int i = 0; i < buffersize; i++) {