Home Forums Sparkfun MP3 Shield Library Support Forum TotalLenght of a Mp3 file ?

This topic contains 3 replies, has 3 voices, and was last updated by  Michael P. Flaga 3 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #1816

    Jupiter Moll

    Im trying to programm  dynamic startcuepoints and endcuepoints for mp3files which should be looped inside these cuepoints.
    For this task i need to get the totallenght (time)  of an mp3 file?
    Any suggestions???



    That is tough, to do in the perfect sense.

    The VS1053 can do so many different formats and each has different header formats. I have avoided getting specific format issues.

    Recently we addressed BitRate and there is a way to read the average Bit Rate. (Noting Constant versus Variable, hence average.) BR read directly from VSdsp or from the File. Noting that it may actually be Variable Bit Rate. And that the VSdsp is actually slightly skewed from what the file states in the case of CBR.

    Note the datasheet address’s JumpPoints inthe Extra Parameters. Which are sometimes available. This sounds similar to the cue points. After reading about this, it became obvious the skipto() function is not perfectly clean. Hence several formats have the jumpPoints. But the SkipTo works nice and mutes 50ms assuming the corrupted initial packet is passed.






    I’m also looking to be able to get the track length. Can you either give an example or a bit more direction as how to ascertain that information (even if it’s a rough estimate) using the average Bit Rate? I’d be grateful.



    There are several “getter’s” included in the library. Note several of them only work for certain file formats. Obvious, since not all contain wrappers that include everything. The entire library of code is document ed http://mpflaga.github.io/Sparkfun-MP3-Player-Shield-Arduino-Library/

    I would recommend searching the web documentation for the following the search is in the upper right.

    void SFEMP3Shield::getTrackInfo(uint8_t offset, char* infobuffer){

    void SFEMP3Shield::trackArtist(char* infobuffer){

    void SFEMP3Shield::trackTitle(char* infobuffer){

    void SFEMP3Shield::trackAlbum(char* infobuffer){

    void SFEMP3Shield::getAudioInfo() {

    void SFEMP3Shield::getBitRateFromMP3File(char* fileName) {

    int8_t SFEMP3Shield::getVUmeter() {

    int8_t SFEMP3Shield::setVUmeter(int8_t enable) {

    int16_t SFEMP3Shield::getVUlevel() {

    Example: http://mpflaga.github.io/Sparkfun-MP3-Player-Shield-Arduino-Library/class_s_f_e_m_p3_shield.html#a6a4b776e45e151a7c330d91a9e88fb78

    You may need to also do some direct file access and properities and some math to calculate totals. Note some file formats have variable bit rates. These may change on the fly.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.