DFPlayer file number problem

I am trying to play spesific files as part of an OTTO robot when i store the files on the SD chip in the folder /mp3 ( this does not seam to be critical) with the files numbered with 4 numerical diggits 0001.mp3 0002.mp3 ...... however this does not enshure correct playing of the files by number.
To fix this rename the first file from 0001.mp3 to 1001.mp3 and the files play properly
ie myDFPlayer.play(1) plays file 1001.mp3 and myDFPlayer.play(2) plays file 0002.mp3 .....
Is there any other way of acheiving this?

What do you mean this?

When you say "0001.mp3" does give the file that name? or just "1.mp3" ? If so then the files won't sort as expected.

Maybe you could use "file0001.mp3" for example.

All the documentation i have found it states that files should be labeled 0001.mp3 0002.mp3 .... ect.You can use 0001songname.mp3 but I am not doing that. The directory of the sd look like :-1
27/06/2022 04:40 PM 747,790 0002.mp3 this is played by myDFPlayer.play(2)
27/06/2022 04:40 PM 562,780 0003.mp3 this is played by myDFPlayer.play(3)
27/06/2022 04:40 PM 230,055 0004.mp3 .
27/06/2022 04:40 PM 95,991 0005.mp3 .
27/06/2022 04:40 PM 55,130 0006.mp3 .
27/06/2022 04:40 PM 54,398 0007.mp3
27/06/2022 04:40 PM 48,547 0008.mp3
27/06/2022 04:40 PM 43,427 0009.mp3
27/06/2022 04:40 PM 53,667 0010.mp3
28/06/2022 01:34 PM 4,560,688 0011.mp3
13/07/2022 01:37 PM 38,265 0012.mp3
13/07/2022 01:40 PM 38,996 0013.mp3
13/07/2022 01:43 PM 33,876 0014.mp3
13/07/2022 01:44 PM 34,608 0015.mp3
13/07/2022 01:51 PM 55,088 0016.mp3
13/07/2022 01:52 PM 52,162 0017.mp3
13/07/2022 01:53 PM 52,162 0018.mp3
13/07/2022 01:47 PM 27,293 0019.mp3
13/07/2022 01:54 PM 43,385 0020.mp3
13/07/2022 01:55 PM 41,191 0021.mp3
13/07/2022 01:56 PM 58,745 0022.mp3
13/07/2022 01:57 PM 60,208 0023.mp3
13/07/2022 01:48 PM 40,459 0024.mp3
13/07/2022 01:50 PM 55,088 0025.mp3
13/07/2022 01:49 PM 43,385 0026.mp3
27/06/2022 04:40 PM 60,208 1001.mp3 this is played by myDFPlayer.play(1)

I have tried verious file naming options and get the same result ?????

Can you expand on this? Do you mean that the player doesn't play file 0004.mp3 when you tell it to.

There's a webpage here:

where the author says:

You will also need to copy these files across in order, the DFPlayer seems to use some sort of creation timestamp when the files are index. So don’t copy 0003.mp3 and then 0001.mp3, otherwise wacky things will happen.

I don't recall if i found this to be true or not.

Yes it matters the order the MP3 Files are loaded onto the SDCard. It shouldn't, but it does. So load 0001.mp3 first, then 0002.mp3, and so on. One of the drawbacks of a versatile but extremely inexpensive MP3 player.

Why do you think that "it shouldn't" ? It is one of standard sort order of file system. Many of old car CD-changers works the same way.

Because the documentation says that it should not.

1 Like

Thanks for all your feedback, I am using a windows enviroment to prepare the MP3 files to load on to the SD chip and use Ctrl a to select them and Ctrl v to paste them. This was suggested buy the documentation I read on get hub as the only way to get the files in the correct order on the SD. But when I try to play them the second file is played first, and the third file played second and so on untill the first file is played Last. I have not tried to load the files one at a time, I may need to try this. I have tried various namings ie 001.mp3 002.mp3 ... or a.mp3 b.mp3 ... but does not have any different behaveour. I can live with the curent way it works, I just thought that I was making some obvious mistake.

The files must be transferred to the SD one by one, in order.

If you Delete 0004.mp3 and replace with another file 0004.mp3 you'll mess it up.

I posted this in another discussion regarding sorting files for a DFPlayer Mini:

Have a search for "fat file sorter". There are a few around that rearrange files alphabetically, although some comments suggest that they don't like sub-folders.

I just noticed one called DriveSort which may be what you are looking for. The intro says:

Recent operating systems sort the files before showing them to the user, either by name, by size or by whatever the user choose. However, it is not always the case in embedded OSes on small portable devices like MP3 players. On these devices the lack of resources (CPU, memory) can lead their developers to make it display or play the files in the order in which they are on the disk.
This order depends mostly of the order in which they were added to the disk, which is not convenient for the user. DriveSort can change this order to help such devices to play or view their files in the order you want, by putting them on the disk in a customizable order.

Back in the days of MS-DOS, utils like this were common place.

However, I've not tested It but it may sort out the order of files and hopefully make using the DFPlayer Mini a bit more friendly.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.