Open RuudMR opened 2 years ago
Hello. I expect your problem is that the files you are trying to use are not in 8.3 format. Where the SdCard is FAT32 and only supports 8.3.
Please note that this is stated in several places in the Trouble Shooting Guide. There is a Warning at the bottom of the guide with instructions like the below. Or using the 'd' demo command to list out the filenames the SdFat sees. Where only these 8.3 filenames can be used.
Example
C:\Arduino\Mega_Calculator>dir /x *.cpp
Volume in drive C is Windows
Volume Serial Number is 66C4-7A27
Directory of C:\Arduino\Mega_Calculator
03/05/2020 03:57 PM 6,318 BIGNUM~1.CPP BigNumber.cpp
03/05/2020 03:57 PM 8,941 CALCUL~1.CPP Calculator.cpp
01/03/2021 08:07 PM 7,121 LEDDIS~1.CPP LEDdisplay.cpp
3 File(s) 22,380 bytes
0 Dir(s) 289,351,168,000 bytes free
C:\Arduino\Mega_Calculator>
I would expect "1234.mp3" would error. As the '' wild card is not supported in SdFat. And or this code would get more complicated. As wild cards respond back with lists and not just one file.
I hope this helps.
Hello Michael, I can read (in your program) the SDcard, the format is FAT32. But i want to start the musicnumber by only giveup the numbers (and the subdir). I have made some samples on a SDcard. It is on the Sub 01/ (And it starts with a 3 count number.) I will start the number with a command with only the first 3 or 4 numbers (of the name of the file)
It works only when i giveup the complete name. But, I want to use the name in the file for indentification. (it works also by the other MP3 controllers XY5300 and the QJ008 i use.) (By this controllers i giveup the subdir (2 numbers) and the musicnumber (3 numbers) thereafter is the name of the mp3) Like this: 001 Alexander Curly - Guus.mp3
How can i do it with this controller on the same way? I have take the time to searce a solution for is, but nothing works. Please can you advice or help with it.
Here under the files....
Received command: d Files found (name date time size): 2022-08-22 17:05 0 01/ 2007-11-17 15:22 3747164 001 Alexander Curly - Guus.mp3 2014-07-08 22:47 3985408 002 Andre Hazes - Bloed Zweet En Tranen.mp3 2004-09-26 01:21 3532822 003 Andre Hazes - De Vlieger.mp3 2022-06-23 12:24 96275 250 Ringsignaal.mp3 2022-06-23 12:24 96275 251 Ring.mp3 2022-06-23 12:24 96275 252.mp3 2022-06-23 12:24 96275 253 RinggelLang.mp3 2022-06-23 12:24 96275 254File.mp3 2022-06-23 12:24 96275 255File ringsignaal.mp3 2021-03-16 17:02 2812110 File0000.mp3 2021-03-16 16:59 4217038 File0001.mp3 2021-03-16 16:59 2801870 File0002.mp3
Please note that this driver is focused on playing a stream of data from a particular file and controlling the features of the VS1053. Only minimal examples are provided for file management. That is outside the scope of this driver.
In short file management is hard on the Arduino.
In comparison to something like Python, file management max's out Arduino's RAM quickly, as there is only 2 or 8k on the 328 or 2560. I quickly learned this limitation, when providing the two demo examples below, learning this limitation. I had bitten into them and quickly regretted it, but I pushed through them to make working examples. It was bittersweet and an exceptionally good learning experience. fileplayer.ino webplayer.ino
It has been a while since I wrote them. I recall that I had to continually read/scrape the directories. And keeping track of an index position and then having to use that index to scan the dir as to retrieve the next desired filenames. There simply is not enough RAM. Because a dump of a directory and filenames has no size limit. It can quickly exceed the RAM of the Arduino.
Give these two above files a read.
Also look through https://gist.github.com/mpflaga. There are a bunch of examples that may help your effort.
It may be possible that AdaFruit’s refactoring https://github.com/adafruit/Adafruit_VS1053_Library of this library may have what you are looking for. They based theirs using the standard SD.h library. I am not sure what features it has now. 7 years ago, the SdFat had more.
I hope this helps.
Hi Michael, I have worked the whole day on it, but no good result. I have made loop, displaying the filenames, than, i look after the begin of the name, is there the righ number than is it good. But it cost (withSD.h) about 20 seconds to scan a small subdir. Works but not good. to slow. In your program it works a lot faster, in seconds. But. The command Serial.println(entry.size() works but the command Serial.print(entry.name()); not. If i use dir.ls(LS_R); than i see with high speed all the files in that subdir. But i can't find a command like Serial.print(entry.name()) to test the filename for the right number. I have searche in all the librarys for a good solution, but not found, this must be easy i think, but not.... How can i find and test for the right filenumber? And if i have found, can i start it than with a index number or something. Please can you give me advice.
I believe. I am missing some things in your translation.
It looks like you are using the SD.h library. Maybe, you are referring to Adafruits library that uses SD.h. Please note that you can not mix the two libraries. SD.h and SdFat.h. It is possible you could get it to compile. But things will go bad.
I am not as familiar with that, and it has been 7 years. Your above code appears to be from the Arduino Reference page printDirectory() . I do not recall using these commands or finding them in this project.
I do recall having a problem printing out individual files to something other than the Serial Print. I recall there are some commands that directly print the DIR to the Serial Print. but needing to grab each file name one, at a time. There was no SdFAT command to do so.
As I mentioned before it was quite painful code, create, as I had to find public methods that were deep in the SdFat.h library. The following link ListFiles() is to an example in this project that gets each file and sends it to a Ethernet output, instead of the Serial Print.
This may help you. It is the way I solved this problem.
It also cost me a lot of time to test it out, but i don't get it working on this way. It is (for me) not possible to get the actual filename into the arduino char memory. My jukebox i have made works and i can play 5000 MP3 files on one SD 32Gbyte. I use now the name File0001.mp3 - File4999.mp3 and i was trying to start the file with only the number.
I give it up and i hope someone else find a solution for it. Micheal thanks for your support. (and your work on this nice library)
Hello Michael, Nice library, you have made! I use it for my own made Jukebox. (and i am very glad with it) But I have a question: I have a SD card with a lot of files. All these files start with a number and thereafter a space and the name from the artist. How can i access these files WITHOUT renaming the names on the SD card. (File1234.mp3) (i have done it for now)
It has to do with the command : uint8_t vs1053::playMP3(char* fileName, uint32_t timecode) { ......... And with: if(!track.open(fileName, O_READ)) return 2;
The name must be complete given in the "fileName" Is it possible to give only "1234*.mp3" for a musicfile name "1234 Help, the Beatles.mp3" (i do it also with other MP3 controllers, like the XY5300 and the QJ008 ) Please can you look for it. Thanks. Greeting Ruud (from the Netherlands)
Yes and i have tried it a lot of times to make it, but without the right result. Sorry....