Rpi Pico SD card stuttering #1884
-
Problem DescriptionI have absolutely no problems with streaming music through http, however when I'm trying to play (the exact same file as streamed) from sd card it stutters a lot and is impossible to enjoy. Device DescriptionRaspberry pi pico 2 w with pcm5102 dac and generic cd card reader Sketch/**
* @file player-sdfat-i2s.ino
* @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-player/player-sdfat-i2s/README.md
*
* @author Phil Schatzmann
* @copyright GPLv3
*/
#include "AudioTools.h"
#include "AudioTools/AudioLibs/AudioSourceSDFAT.h"
#include "AudioTools/AudioCodecs/CodecMP3Helix.h"
const char *startFilePath="/";
const char* ext="mp3";
AudioSourceSDFAT source(startFilePath, ext,17,20);
I2SStream i2s;
MP3DecoderHelix decoder;
AudioPlayer player(source, i2s, decoder);
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);
//AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
// setup output
auto config = i2s.defaultConfig(TX_MODE);
config.pin_ws = 10;
config.pin_bck = 11;
config.pin_data = 9;
i2s.begin(config);
// setup player
//source.setFileFilter("*Bob Dylan*");
player.setMetadataCallback(printMetaData);
player.setBufferSize(2048);
player.begin();
}
void loop() {
player.copy();
} Other Steps to ReproduceNo response What is your development environmentArduino Ide I have checked existing issues, discussions and online documentation
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Maybe it is also worth mentioning that i tried reencoding mp3 files but still nothing changed ;) |
Beta Was this translation helpful? Give feedback.
-
Did you try to increase the i2s buffer ? I would make it big enough to hold 2 - 3 decoded writes. I also think your read speed is a bit low compared to what we can get via Wifi. What SPI frequency did you try ? |
Beta Was this translation helpful? Give feedback.
-
Also google the topic of SD speed: I e.g. found this |
Beta Was this translation helpful? Give feedback.
-
Since this is not related to my functionality, I am converting this to a discussion! |
Beta Was this translation helpful? Give feedback.
Did you try to increase the i2s buffer ?
I would make it big enough to hold 2 - 3 decoded writes.
I also think your read speed is a bit low compared to what we can get via Wifi. What SPI frequency did you try ?