Wb-FreeKill Posted May 31, 2005 Share Posted May 31, 2005 Is it possible to retrieve a mp3 or wav music file length? like 04:32 Link to comment Share on other sites More sharing options...
quick_sliver007 Posted May 31, 2005 Share Posted May 31, 2005 Is it possible to retrieve a mp3 or wav music file length? like 04:32<{POST_SNAPBACK}>There should be a dll for it, although I had no luck finding it. Windows Media player has to get the song length some how. Other then that, the only way I can think of is to filegetsize and do some math to figure out how long the song is. But if you did it that way, then quality will be a issue with then file size. All I know is that windows media player does it as well as other players and I believe there is a dll some where to return the length of a Mp3 file. . Link to comment Share on other sites More sharing options...
Lazycat Posted May 31, 2005 Share Posted May 31, 2005 Lots of threads, but this is most close: http://www.autoitscript.com/forum/index.php?showtopic=8492. Look for Larry example. Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
Wb-FreeKill Posted May 31, 2005 Author Share Posted May 31, 2005 Looked at it allready, and compared it with windows, my program says 03:28 and windows says 03:17 :S MsgBox(4096,"file length","length in milliseconds: " & $answer /1000 / 60) 197609 milli / 1000 / 60 = 3.29348333333333 Link to comment Share on other sites More sharing options...
buzz44 Posted May 31, 2005 Share Posted May 31, 2005 That is correct... 3.29 is going out of 100... There are 60 seconds in 1 minute, not 100. 197609 milli / 1000 / 60 = 3.29348333333333 29 / 100 * 60 = 17.4 . qq Link to comment Share on other sites More sharing options...
Wb-FreeKill Posted May 31, 2005 Author Share Posted May 31, 2005 That is correct...3.29 is going out of 100... There are 60 seconds in 1 minute, not 100.197609 milli / 1000 / 60 = 3.2934833333333329 / 100 * 60 = 17.4 .<{POST_SNAPBACK}>hah, wize boy - damn u thank you very much! Link to comment Share on other sites More sharing options...
Wus Posted May 31, 2005 Share Posted May 31, 2005 thats cause its base 60 instead of base ten... reminds me of algebra and the SAT's Link to comment Share on other sites More sharing options...
jdickens Posted June 2, 2005 Share Posted June 2, 2005 For Mp3, it is the mp3 author's choice to code in the length in the ID tag, I believe. But many utilities will calculate it for you. For WAV, if you can access the header, you can calculate the length precisely. If you know that it is 16 bit stereo, 44100 Sampling rate, such as CD quality, you can use: Length in Seconds = (Size of File - Size of Header)/44100/2(for stereo)/(16*16) Header is around 32 bytes I think, but there are exceptions. (This is all from my memory -- Please correct me if I am wrong) J If I am too verbose, just say so. You don't need to run on and on. Link to comment Share on other sites More sharing options...
buzz44 Posted June 3, 2005 Share Posted June 3, 2005 Can't you do (BytesPerSample - BitsPerSecond) / 1000? Or maybe its (BytesPerSecond - BitsPerSample) / 1000. qq Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now