setLoop for MP3 Encoded files #1094
-
I have looked through as much of the posts and documentation as I could but without success. I have a larger program that operates just fine but I want to implement the playing of a bell sound. It will be initiated with an event and should continue to play until other logic ends it. For testing, I have used your example for streaming an MP3 file to i2s. It works wonderfully but plays the file just once. The code included here was my attempt to get it to play continuously. No joy. It is my understanding that there is no setLoop() for this class. If so, what is the best way to get the file to play continuously? Will it be necessary for me to convert the file to raw and use the MemoryStream method? If so, I have to figure out a way to convert the file to the raw format. Thanks in advance for the assistance.
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 9 replies
-
Have a look at the FileLoop class. |
Beta Was this translation helpful? Give feedback.
-
In case you did not find it: here is the link to the example MP3 needs a little bit of time to get started, so if you want to avoid any gaps you could use a wav file instead... |
Beta Was this translation helpful? Give feedback.
-
I have access to a PC now and I had a look at your first example. I think your description was confusing me because you were talking about about a file. Look at the documentation for the MemoryStream! Why don't you just call mp3.setLoop(true) ? The FileLoop is to be used for any type of file including SPIFFS or LittleFS which do not require any SD drive |
Beta Was this translation helpful? Give feedback.
Have a look at the FileLoop class.
Alternatively you can just move the file pointer to the beginning when you are at the end.