Replies: 3 comments 4 replies
-
I have a similar issue. After I switched the log level to verbose, I saw that the mp3 decoder wasn't able to allocate enough memory to play the mp3 and simply stopped doing it. Maybe changing the log level will also provide some clue for you. |
Beta Was this translation helpful? Give feedback.
2 replies
-
#include "Arduino.h"
#include "Audio.h"
#include "SD_MMC.h"
Audio audio;
#define I2S_LRC 26
#define I2S_DOUT 25
#define I2S_BCLK 27
#define I2S_MCLK 0
int idx = 0;
const char* audioFileList[] = {
"/wave_test/If_I_Had_a_Chicken.wav",
"/mp3files/mechanik.mp3",
"/m4a/sample1.m4a",
"/opus/Helikopter117.opus",
"/ogg/Collide.ogg",
"/m4a/sample1.m4a",
};
void setup() {
Serial.begin(115200);
if(!SD_MMC.begin( "/sdcard", true, false, 20000)){
Serial.println("Card Mount Failed");
return;
}
audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT, -1, -1);
// audio.setVolumeSteps(64);
audio.setVolume(13); // 0...21 Will need to add a volume setting in the app
audio.connecttoFS(SD_MMC, audioFileList[idx]);
}
void loop() {
audio.loop();
}
void audio_info(const char *info){
Serial.print("info: "); Serial.println(info);
}
void audio_eof_mp3(const char *info){ //end of file
idx++;
if(idx == sizeof(audioFileList) / 4){
Serial.println("end of list");
return;
}
audio.connecttoFS(SD_MMC, audioFileList[idx]);
} |
Beta Was this translation helpful? Give feedback.
2 replies
-
Nah I don't want to mix it, I just want to play one wav at a time... just to pick from a set. Think of a soundboard like thing. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I thought I was trying to do something fairly simple, but either I'm going about it wrong or more likely I'm an idiot.
I want to use a button to trigger a sequence that first plays an .mp3 from and SD card, pauses for a set amount of time then plays a second .mp3 file, then moves on with the program. Simple right?
Firstly, I simply took the
audio.connecttoFS(SD, "/test1.mp3");
from setup() and placed it in the loop(), then addeddelay(2000); audio.connecttoFS(SD, "/test2.mp3");
But nothing played, not even if I just put the first part in the loop().Next, I tried using an array to store the mp3's in
const char* audiofilenames[] = { "test1.mp3", "test2.mp3" };
Then tried to accessed them using the following (this work fine for 1 mp3),
However, when I add a second file
This just skips over the first file, runs the delay then plays the second file once, meaning I have to reboot to run it again. I have also tried using
void audio_eof_mp3(const char *info)
, but with no luckCan anyone spot the mistake I'm making.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions