-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there any function that can get the total duration of a song? #927
Comments
Sorry, this is the function, but it has some errors. It is very large in the early stage of the song, about tens of seconds, and gradually decreases as the music plays. There is still an error of about 5 seconds at the end. |
This is because you are using a variable bit rate. There is no way to calculate it exactly here. See the wiki: |
I don't have any specific explanation for the problem. However, I can say that I have similar problems, but with .flac and especially .aac formats. I also sometimes get some error during decoding and it has the same result - "audio_eof_mp3" is not triggered. |
I don't think the SD card is the problem. If you use SD_MMC, the SD card can be connected directly to the GPIOs (Vcc, GND, D0, CMD, CLK), which is better than your card adapter, especially since a level shifter is not required. |
I have an SD card connected directly to the GPIOs (of course I have pull-up resistors there). But that is not the case of the questioner, as can be seen in the picture he attached. Fortunately in my case it is rare that the error occurs. If I notice any pattern, I will open a new issue. |
Pull-ups are not necessary with SD_MMC, but they do not interfere either. A good connection is much more important; small contact problems are often enough to trigger a malfunction. This is a possible cause with a breadboard. |
In the process of simple low-speed circuit connection verification, DuPont wire may be one of the better choices without breadboard. |
Not sure if you solved your problem but you may want to check the sd-card module as it may be a 5 volt module and may work intermittently on 3.3 v. |
I tried audio.getAudioFileDuration() but it's not correct.
The text was updated successfully, but these errors were encountered: