Hi,
I have an issue that playing mp3 files from spiff take about 1 second to start and I need around 100-200ms max.
Someone suggested that the delay may be caused by stopping the pipeline after each play and then having to recreate it. It seems I would need to create the audio pipeline on first start up and not close it down between files being played, but I am not sure how to do this and would really appreciate some help. The code was based on esp example "Play_mp3 using custom board.
I have attached the calling file "audio.c" and the file that creates, plays and shuts down the audio pipeline. (play_spiffs_mp3.c"
Thanks
Delay starting mp3 play
Delay starting mp3 play
- Attachments
-
- play_spiffs_mp3.c
- (7.18 KiB) Downloaded 511 times
-
- audio.c
- (4.16 KiB) Downloaded 449 times
Re: Delay starting mp3 play
Hi, i have the same issue. Did you manage to solve it?
Re: Delay starting mp3 play
No,
had no replies yet.
had no replies yet.
Re: Delay starting mp3 play
I managed to reduce the delay time by using the lib "esp8266Audio" and a AudioFileSourceBuffer. A buffer has the method "seek" witch can be used to jump to a specific position of the audio data. Hope this might help you.
-
- Posts: 21
- Joined: Tue Nov 07, 2017 9:59 pm
Re: Delay starting mp3 play
Hi guys,
I'm trying to help resolve this for orbitcoms.
If I take https://github.com/espressif/esp-adf/tr ... spiffs_mp3
I notice it takes about 600ms to get to the while loop. Ie the setup code takes some time to run. I tried to split up the code into 3 functions.
init
play
clean
and would like to run the init function only once. and then send different files to the play function however,
I'm having trouble getting it to play the second audio.
if I dont stop the pipe line I get
I'm trying to help resolve this for orbitcoms.
If I take https://github.com/espressif/esp-adf/tr ... spiffs_mp3
I notice it takes about 600ms to get to the while loop. Ie the setup code takes some time to run. I tried to split up the code into 3 functions.
init
play
clean
and would like to run the init function only once. and then send different files to the play function however,
I'm having trouble getting it to play the second audio.
if I dont stop the pipe line I get
If I do stop it I getE (5819) AUDIO_EVT: Error add queue items to queue set
W (5819) AUDIO_PIPELINE: Pipeline already started, state:3
Any guidance on how to initialize the pipeline once or a different way to shave off the time would be appreciatedE (9098) AUDIO_ELEMENT: [spiffs] Element already stopped
W (9108) AUDIO_EVT: There is no space in external queue
E (9118) AUDIO_ELEMENT: [mp3] Element already stopped
E (9118) AUDIO_ELEMENT: [volume] Element already stopped
- Attachments
-
- play_spiffs_mp3.c
- (8.19 KiB) Downloaded 508 times
check out my course https://learnesp32.com
Re: Delay starting mp3 play
I have managed to remove most of the delay (which was linked to how spiffs was being established).
The total time is now 167ms from call until i2S starts streaming out.
The spiffs takes around 1ms, the entire audio element and pipeline setup takes around 26ms
The largest delay is in the function "audio_pipeline_run(pipeline);" This delays 140ms
Does anyone know what has been processed when this function ends? Has the audio file already started being read and decoded ? (Meaning the delay is not a setup delay but now part of the player sequence)?
The total time is now 167ms from call until i2S starts streaming out.
The spiffs takes around 1ms, the entire audio element and pipeline setup takes around 26ms
The largest delay is in the function "audio_pipeline_run(pipeline);" This delays 140ms
Does anyone know what has been processed when this function ends? Has the audio file already started being read and decoded ? (Meaning the delay is not a setup delay but now part of the player sequence)?
Re: Delay starting mp3 play
Hi, can you give more info for how to solve this problem? You've made a huge improvement.
Congratulations.
Congratulations.
orbitcoms wrote: ↑Mon May 03, 2021 10:26 amI have managed to remove most of the delay (which was linked to how spiffs was being established).
The total time is now 167ms from call until i2S starts streaming out.
The spiffs takes around 1ms, the entire audio element and pipeline setup takes around 26ms
The largest delay is in the function "audio_pipeline_run(pipeline);" This delays 140ms
Does anyone know what has been processed when this function ends? Has the audio file already started being read and decoded ? (Meaning the delay is not a setup delay but now part of the player sequence)?
Who is online
Users browsing this forum: No registered users and 16 guests