Basically I cant find any info about how to extract the track length from an MP3 using VB. I haven't done any biinary file access before but I could learn so someone please give me a clue how to do this.
Much appreciated to anyone who replies!!
Printable View
Basically I cant find any info about how to extract the track length from an MP3 using VB. I haven't done any biinary file access before but I could learn so someone please give me a clue how to do this.
Much appreciated to anyone who replies!!
Here is where I got my info. The Read Header section will have length and a bunch of other MP3 info. But I disagree with how he is playing MP3's. There is an easier way to do it.
http://home12.inet.tele.dk/mkaratha/
Code:Public Function Length()
Static L As String * 30
mciSendString "set MP3Play time format milliseconds", 0, 0, 0
mciSendString "status MP3Play length", L, Len(L), 0
sec = Round(Val(Mid$(L, 1, Len(L))) / 1000) 'Round(CInt(Mid$(l, 1, Len(l))) / 1000)
If sec < 60 Then Length = "0:" & Format(sec, "00")
If sec > 59 Then
mins = Int(sec / 60)
sec = sec - (mins * 60)
Length = Format(mins, "00") & ":" & Format(sec, "00")
End If
End Function