Slow/Choppy audio #2044
-
Problem DescriptionIm trying to get an example working, i used the mp3 sd card one and it kept crashing/rebooting when trying to laod an mp3 file i saw a comment in another issue about using a wave decoder instead which works but the audio is playing really slowly, maybe my file is too large or soemthing is there a way to get it working? Device DescriptionESP32 AudioKit V2.2 Sketch/**
* @file player-sd-audiokit.ino
* @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-audiokit/player-sd-audiokit/README.md
* Make sure that the pins are set to off, on, on, off, off
* @author Phil Schatzmann
* @copyright GPLv3
*/
#include "AudioTools.h"
#include "AudioTools/AudioLibs/AudioBoardStream.h"
#include "AudioTools/Disk/AudioSourceSD.h"
#include "AudioTools/AudioCodecs/CodecMP3Helix.h"
const char *startFilePath = "/";
const char *ext = "wav";
AudioSourceSD source(startFilePath, ext, PIN_AUDIO_KIT_SD_CARD_CS);
AudioBoardStream kit(AudioKitEs8388V1);
WAVDecoder decoder; // or change to MP3DecoderMAD
AudioPlayer player(source, kit, decoder);
void next(bool, int, void *)
{
player.next();
}
void previous(bool, int, void *)
{
player.previous();
}
void startStop(bool, int, void *)
{
player.setActive(!player.isActive());
}
void setup()
{
Serial.begin(115200);
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
// setup output
auto cfg = kit.defaultConfig(TX_MODE);
// sd_active is setting up SPI with the right SD pins by calling
// SPI.begin(PIN_AUDIO_KIT_SD_CARD_CLK, PIN_AUDIO_KIT_SD_CARD_MISO, PIN_AUDIO_KIT_SD_CARD_MOSI, PIN_AUDIO_KIT_SD_CARD_CS);
cfg.sd_active = true;
kit.begin(cfg);
// setup additional buttons
kit.addDefaultActions();
kit.addAction(kit.getKey(1), startStop);
kit.addAction(kit.getKey(4), next);
kit.addAction(kit.getKey(3), previous);
// setup player
player.setVolume(0.7);
player.begin();
// select file with setPath() or setIndex()
// player.setPath("/ZZ Top/Unknown Album/Lowrider.mp3");
// player.setIndex(1); // 2nd file
}
void loop()
{
player.copy();
kit.processActions();
} Other Steps to ReproduceNo response What is your development environment (incl. core version info)No response I have checked existing issues, discussions and online documentation
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The fastest access to the sd drive is via sdmmc: However I never had any performance issues using the SD library, For mp3 I am usually recommending libhelix. Further info can be found here.... |
Beta Was this translation helpful? Give feedback.
The fastest access to the sd drive is via sdmmc: However I never had any performance issues using the SD library,
So maybe there are some issues with your SD card ?
For mp3 I am usually recommending libhelix.
I noticed that you left the log level at Info: did you try to set it to Warning as recommended ?
Further info can be found here....