Audio file length
BlitzMax Forums/BlitzMax Programming/Audio file length
| ||
How can the length of and audio file be found out? I've heard that I may have to find out the bit rate first and then do some math but I don't know where to find the bit rate either. |
| ||
Might be a better way but this works :Local mysample:TAudioSample = LoadAudioSample("yourfile.ogg") Print mysample.length Print mysample.hertz Local mysound:TSound = LoadSound(mysample) PlaySound mysound WaitKey() |
| ||
For 16 bit stereo waves the following should give time in seconds: time#=float(length/4)/hertz and for 16 bit mono: time#=float(length/2)/hertz |
| ||
I tried skidracer's idea but i got 25.17... for a 1:40 song If you dont divide by 4 or 2 then it returns the right value. Thanks tonyg and skidracer |