Time Position in MP3

Blitz3D Forums/Blitz3D Beginners Area/Time Position in MP3

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I've never done it before, but my take on it is that many players divide the file size by the bitrate to get the length of the song in seconds. (Note: Of course this wouldn't work in formats like MIDI or MOD since the information is stored and played completely differently.)

So for example, a 6MB MP3 compressed with 192Kbps bitrate:
6MB = 6144KB
192Kb/s = 24KB/s
...
6144KB/24KB/s = 256s = 4:16 (m:s)

And of course to get how long it has played, you just have to keep track of how many KB you've read in the file.

Like I said, I'm not absolutely sure, but it seems to work out. And what led me to this assumption is seeing my music player (Quintessential) always changing the approximate length of the song (and getting it wrong) every second or so on variable bitrate files.