Go Down

Topic: DFplayer Random playback (Read 4714 times) previous topic - next topic

oliclarke

Im trying to set the playback mode to random, but it keep playing the files in sequence. sending execute_CMD(0x08,0,3) doesnt seem to make any difference? Im pretty new to arduino, and followed this guide. All works fine, but just cant change playback mode.

Power_Broker

You can see a pretty full list of commands and their hex values here.

If you take a look, 0x08 corresponds to PLAYBACK_MODE_COMMAND, but what you want is RANDOM_ALL_COMMAND, which is 0x18. I think you just made a typo.
"The desire that guides me in all I do is the desire to harness the forces of nature to the service of mankind."
   - Nikola Tesla

oliclarke

Awesome, I hadn't seen the complete command list, which makes things much simpler.
Thanks for the info.

oliclarke

Just to update this thread, neither 0x08 or 0x18 change the playback order. I think the function attached to the play next button just calls the next track, not a random track.

Power_Broker

#4
Dec 03, 2019, 10:09 pm Last Edit: Dec 03, 2019, 10:10 pm by Power_Broker
Just to update this thread, neither 0x08 or 0x18 change the playback order.
0x18 doesn't change the order in as much as it plays all mp3s in random order. See the following from the datasheet:

Quote
3.6.12. Set random playback
Random playback of the whole storage device 7E FF 06 18 00 00 00 FE E3 EF
1).This command is used to randomly play sound files in the storage device according to physical sequence and no
matter if there is a folder or not in the device. The first sound file that is conducted to be played is the first one in the
device.
I think the function attached to the play next button just calls the next track, not a random track.
Of course - did you expect "play next" to play a random song?  :)
"The desire that guides me in all I do is the desire to harness the forces of nature to the service of mankind."
   - Nikola Tesla

Power_Broker

Also, note that the files are ordered by the date/time the file was created/moved to the SD card and has no bearing on the mp3 filename whatsoever.

For example, let's say you upload 002.mp3 to the SD card and then uploaded 001.mp3. Then, if you do my_player.loop(1); the player will loop 002.mp3

I hope that helps
"The desire that guides me in all I do is the desire to harness the forces of nature to the service of mankind."
   - Nikola Tesla

oliclarke

Of course - did you expect "play next" to play a random song?  :)

Yeah I guess I though the random play would cause the play next  function to  randomly select a track from the SD card.

Looks like ill be writing my own play_next_random function!

Go Up