How to determine song total length in minutes
Blitz3D Forums/Blitz3D Programming/How to determine song total length in minutes
| ||
PLEASE tell me of any way to get a song's total time in minutes + secs, and / or ms. ~DarkShadowWing~ |
| ||
You can use Imphenzia Audio System which released some time ago. You can find it in the userlibs forum. Blitz3D doesn't have a function to find audio file length. |
| ||
You can also use my mciMP3 userlib, if you're playing MP3s. It has a function just for that. (Link in signature) |
| ||
id like to, but i need to get song time for midi, mp3, etc... |
| ||
anyone? |
| ||
Since B3D doesn't have a built-in function to determine this, you'd pretty much have to do it the hard way for each individual file format. e.g. check wotsit.org for file format descriptions for each format you want to know this for, and analyze the headers of the file(s) to dig up the info you need. To complicate matters, certain fileformats like MP3 don't always return accurate info if they happen to use VBR (Variable Bit Rate) compression where different parts of the file may be encoded with different compression rates. But this might get you started: http://www.wotsit.org/getfile.asp?file=mpeghdr&sc=281382876 |
| ||
cant i just call a dll function? *sigh* |
| ||
Did you even read Mortiis and Slotman's postings above? |
| ||
yes. but imphenzia returns how LONG the song HAS been playing. I need the song file's length. whether its an mp3, a mid. w/e. its easier if i use decls to do this. and as for mci, id use it, but as i said, i need mp3, midi, wav, pretty much. ~DarkShadowWing~ |
| ||
For both MP# and WAV you can pretty much find the compression ratio in the header of the file, which you can then compare to the size of the file to calculate the length of the sample. for .mod and .mid and such it's going to be more complicated... :-? |
| ||
is there any example i can see that does this? i apologize for askin, but this is the only way i learn. by seein examples. ~DarkShadowWing~ |
| ||
Please. I'm desperate. Use MCI if you must. ~DarkShadowWing~ |
| ||
AGAIN: Look at my userlibs. You can get MP3 length. For MIDI and WAV you will just need to adapt the .bb calls a little bit, just check how to access MCI stuff (probably change the filetype to "wavaudio" for wav, and to something else to MIDI, and thatīs it) Nothing a 5 mins research, together with my mciMP3 userlib wouldnt solve. Dont use file size to get MP3 time, it doenst work (isn't precise enough, and if you get a VBR MP3 it will be even worse) EDIT: If you're that desperate, I can do it for you... for a small fee ;) |
| ||
ok. ill try. cuz im desperate. but if i cant get the mid / wav time, im screwed. ~DarkShadowWing~ |
| ||
if this works, and its royalty free, id so get the full version. unless its already royalty free. but please, no insane prices, lol. ~DarkShadowWing~ |
| ||
make me an offer at slotman@mysite :) I already have MIDI timing working, just need to make WAV too... Edit: just made it. See http://www.icongames.com.br/b3duserlibs/mci_all.zip for a sample playing mp3,wav and midi with MCI, and getting status, current position and file length (all in milliseconds). Send me an offer and you can have the source, to do whatever you want with it :) |
| ||
well. i have to talk w/ my parents about it, but i dont know how to convince them. =/ i really need song length in seconds as well as minutes. ~DarkShadowWing~ |
| ||
i really need song length in seconds as well as minutes. Multiply by sixty? |
| ||
slotman. i talked to my parents, and they said its cool. i can offer u a SMALL amount. ill email u =) ~DarkShadowWing~ |
| ||
slotman, i emailed u. i have decided to use paypal. let me know when you can have the code. i'll email u again when i hear from you =) Thanks! =) ~DarkShadowWing~ |
| ||
slotman, i emailed u again. i'll email u again when i hear from you =) Thanks! =) ~DarkShadowWing~ |
| ||
Thanks =) ~DarkShadowWing~ |
| ||
Slotman, I emailed you again =) Check your email =) Thanks! =) ~DarkShadowWing~ |
| ||
slotman? |
| ||
ok, i donated slotman. Please check your email =) ~DarkShadowWing~ |
| ||
Check your email, I just sent the code :) Cheers! |
| ||
Slotman, I got the email. Thank you so much! =) So far it's perfect =) If I find any errors or anything I'll letcha know A.S.A.P. Thanks again! =) ~DarkShadowWing~ |
| ||
Slotman, I emailed you again. Check your mail =) ~DarkShadowWing~ |
| ||
the lazy way I open the song i media player and it tells me lenght of it :) |
| ||
no probs =) its taken care of, wings :P ~DarkShadowWing~ |
| ||
I feel like this would have been way easier if you just used one of the countless free online whatever-to-mp3 converters, and then used Slotman's original lib. At least it would have spared us ten "i emailed u" posts. ;) |