General

DF Player Pro+Arduino. Play specific sounds one after the other

userHead Francisco.Lopez-Linares 2024-03-20 08:41:57 1060 Views6 Replies

Hello:

 

I bought a DFPLayer pro to be able to play wav files from its own memory, while arduino does “another things”.

 

Sadly I have found that though there is a function call “isplaying” to know when a sound has end it, while this function is been run, it “stalls” arduino execution, so at the end is more or less the same as inserting a delay in the code…, so I think this function is useless for my case.

 

I need to develope a function to send mini player something like this:

 

play_sounds("one.wav", “two.wav”, "four.wav");

 

So DFplayer takes care of playing those sounds (that are in it's memory), while Arduino takes care of other stuff…

 

Anyone know if any function of this type has been develop or any special function I can use to get to this goal?

 

Thanks for your time.

2026-02-21 09:12:52

That's a classic challenge with the DFPlayer when you need non-blocking playback. The issue is that isplaying() polls the module, and while it checks the status, your Arduino code essentially waits at that line. For true parallel operation, you need a state-based approach.

 

Instead of relying on a blocking check, you can set up a system where the Arduino sends the command to play "one.wav" and then immediately returns to its main loop. You would then use a timer (like the millis() function) to check the duration of the sound. When the timer expires, you send the command for the next file ("two.wav") in your sequence. This lets your Arduino manage other tasks seamlessly between sounds, which is exactly what you need for a function like play_sounds().

 

For your project, searching for "Arduino non-blocking DFPlayer tutorial" will provide you with specific code examples to build your function.

userHeadPic Nicholas.Morgan
2024-03-26 04:25:56

Not thanks to the help in this forum, I have conclude that DFplayer needs arduino to play the sounds, so for me is not of very much interest. I have used with much more sucess other reproduction modules wich play the sounds without “halting” arduino.

 

userHeadPic Francisco.Lopez-Linares
2024-03-21 18:21:23

Success! It could be one of the most informative blogs we've come across on the subject. Great information! I am also a specialist in this field, so I understand your efforts very well. Thank you so much for your help. play slope


 

userHeadPic henry.katy
2024-03-21 15:09:02

Is this forum officaly attend it? 

 

Should I expect an answer from DFROBOT?

userHeadPic Francisco.Lopez-Linares
2024-03-20 09:46:57

I have just realized that DF1201S.playSpecFile”, also blocks de execition of arduino….., so with the actualk state of the firmare, I'm afraid the devices is useless for me :-(..

userHeadPic Francisco.Lopez-Linares
2024-03-20 08:51:08

Take into account that In the memory there are 100 sounds, and an specific moment I need to play only those three sounds.., so the function that plays all the sounds on the folder can't be used.

userHeadPic Francisco.Lopez-Linares