Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playing mp3 files in a function on ESP32 #463

Open
HeikkiHietala opened this issue Dec 10, 2021 · 3 comments
Open

Playing mp3 files in a function on ESP32 #463

HeikkiHietala opened this issue Dec 10, 2021 · 3 comments

Comments

@HeikkiHietala
Copy link

Hi,

I wanted to thank you for building this library. I am hoping to build a talking clock, with MP3 files for the sounds of "oh one"... "oh nine" and then "one" to "fifty nine". I have the files made already and they all fit under 2MB of SPIFFS memory on the ESP32.

What I am struggling with is trying to build a method for running a function that actually plays the sound. The example has only one sound file, and while I can play my own sound, adding more than one doesn't work.

So, what should the structure be in the loop that would allow for a sound to be played and then wait for the next?

@doublejosh
Copy link

Same problem-- how to manage various audio files and trigger them as part of other code. Seems so basic, but managing the memory and file loading is immediately confusing.

Also, I'm failing to understand how we need to manage mp3->isRunning()), mp3->loop() and mp3->stop() to create a some kind of play() function. It may need take handlers like this, but I'm not sure...
void play(uint8_t message, AudioGeneratorMP3 *mp3, AudioFileSourceID3 *id3, AudioOutputI2SNoDAC *out) {

The only thing like this is the example was the speech synthesis source. The audio quality is horrific, but it's looped.
https://github.com/earlephilhower/ESP8266Audio/blob/master/examples/TalkingClockI2S/TalkingClockI2S.ino

@doublejosh
Copy link

doublejosh commented Jan 3, 2022

@HeikkiHietala
Copy link
Author

Thanks for tis :)= sorry for the delay. I have built a case structure that allows me at least to loop through the list o files I have on the ESP32, and I am hoping to get that included in the main structure, but I will surely take a look at your solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants