Choppy Audio for A SD to PWM output #1540
-
Currently getting choppy audio when attempting to play a WAV file from an SD card on a Seeeduino XIAO Sense nRF52840 I have attempted to change buffer sizes for the player, pwm stream, and config but nothing seems to work for me which makes me think my SD card is too slow. I figure this is an implementation error on my end since this is my first time using this board/chip and library. Here is my current code #include "AudioTools.h"
#include "AudioLibs/AudioSourceSDFAT.h"
#include "AudioCodecs/CodecWAV.h"
const char *startFilePath="/";
const char* ext="wav";
AudioSourceSDFAT source(startFilePath, ext,2);
AudioInfo info(8000, 1, 16);
WAVDecoder wav;
PWMAudioOutput pwm; // PWM output
AudioPlayer player(source, pwm, wav);
void printMetaData(MetaDataType type, const char* str, int len){
Serial.print("==> ");
Serial.print(toStr(type));
Serial.print(": ");
Serial.println(str);
}
void setup() {
Serial.begin(115200);
while(!Serial){}
Serial.print("Starting");
AudioLogger::instance().begin(Serial, AudioLogger::Info);
player.setMetadataCallback(printMetaData);
auto config = pwm.config();
config.setAudioInfo(info);
pwm.begin(config);
source.begin();
// setup player
wav.begin();
source.setFileFilter("*test*");
player.begin();
}
void loop() {
player.copy();
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
You can define the clock speed in the constructor of the AudioSourceSDFAT and don't forget to set the log level to Warning |
Beta Was this translation helpful? Give feedback.
-
Have a look at PWMConfig. |
Beta Was this translation helpful? Give feedback.
You can define the clock speed in the constructor of the AudioSourceSDFAT and don't forget to set the log level to Warning