playing 2 audio files mono 44100hz 16bit & merge to stereo output on a esp32-audiokit #2170
-
Hello, I'm able to play a stereo wav file 16bit 44100hz with my esp32-audio-kit, when I tried, the sound was stuttering. I tried to use raw pcm audio so, but same issue Has anyone tried this before ? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
here's the code, with 2 mono wav files merged to stereo, at 22050hz samplerate #include <SPI.h> const int chipSelect = PIN_AUDIO_KIT_SD_CARD_CS; AudioInfo info(22050,2, 16); StreamCopy copier(i2s, merge, 256); // 256-byte buffer void setup() { SPI.begin(PIN_AUDIO_KIT_SD_CARD_CLK, PIN_AUDIO_KIT_SD_CARD_MISO, } } |
Beta Was this translation helpful? Give feedback.
-
The bottleneck is most likely the read speed of the SD library. |
Beta Was this translation helpful? Give feedback.
-
switching to sdmmc solved the issue, here is a sample code: #include "FS.h" AudioInfo info(44100, 2, 16); StreamCopy copier(i2s, merge, 512); // Larger buffer for stereo data void setup() { if (!SD_MMC.begin("/sdcard", true, true, SDMMC_FREQ_52M)) { File file1 = SD_MMC.open("/pinaVoix/voxNoise.wav"); File file2 = SD_MMC.open("/birds/weirdBirds.wav"); loopingFile.setFile(file1); decoder.begin(); merge.add(decoder, 1); uint8_t testBuffer[64]; void loop() { |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot |
Beta Was this translation helpful? Give feedback.
The bottleneck is most likely the read speed of the SD library.
Try to increase the SPI frequency or switch to a more efficient library