Menu

#19 MP3 Length

v1.0_(example)
accepted
None
5
2017-03-04
2017-01-26
No

I am using your library and everything seems to work but for some reason I can not get the Length of the mp3 file to put in a textbox. Is this a bug or am I just not doing it right. Here is the code I am using:

lengthTXT.Text = file.TagHandler.Length.ToString();

Discussion

  • Andrew Pearmund

    Andrew Pearmund - 2017-03-04

    Sorry it's taken so long to look at this. The TagHandler.Length property returns a TimeSpan from the contents of the ID3 TLEN frame. This is not always populated by the creating software, so could really be blank. You can also get a length from the IAudio.Duration property, which returns the number of seconds from the xing/vbri headers or from the id3 TLEN frame. Ultimately, the only certain way to obtain the duration of a VBR file seems to be to decode the audio stream and measure it.
    If on the other hand you have an mp3 file that has a TLEN frame that's not being read correctly, please send it to me or attach it here so I can see what's going wrong.

     
    • Split Cell Software

      Now I need to apologize for my delay. I have been working on a package that is absorbing most of my free time. Thanks again.

       
  • Andrew Pearmund

    Andrew Pearmund - 2017-03-04
    • status: unread --> accepted
    • assigned_to: Andrew Pearmund
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.