How to stop Mp3 being converted to wav?
Blitz3D Forums/Blitz3D Programming/How to stop Mp3 being converted to wav?
| ||
When i load an mp3 into blitz3d, the program memory jumps in a manner that only means the program has taken the mp3 file i've asked it to load, and making it a WAV file, which takes up about 1 MB per second. Does anyone know how to stop this? |
| ||
1mb per second? i doubt that, 10mb per minute ive found for cd quality wav's blitz due to mp3 licencing no longer officially supports mp3's perhaps try ogg's instead i guess instead of streaming (which im guessing it would if it was built into b3D) whatever lib you are calling has to convert it on the fly into ram or a temp file if it was a wav already, granted it would take your game to huge file sizes, i doubt youd find any slowdowns in short use ogg |
| ||
Converting to OGG seemed to help a lot, and yes it was 1MB per second also. The trouble is, that playing using the "playmusic(file$) command often leads to very choppy playback! |
| ||
odd for the file size as i record annecdotes and my bass at cd quality and get 10mb aprox per minute |
| ||
If you LOAD a musicfile it is converet to PCM Audio, a pc can not play back mp3,ogg, wav or what ever. The playback buffer must contain PCM datas. That is not a problem of blitz but how a pc work inside. http://en.wikipedia.org/wiki/Pulse-code_modulation Thats the difference Samples/Streams. A stream only use a buffer of 30-50ms to convert in realtime. ;) bye |
| ||
SO is there no way to have background ambience tracks in my program (that are about 4/5 minutes long) without my program memory usage jumping up from 30 to nearly 100Mb? |
| ||
Out of interest, what commands are you using? I get the sneaky suspicion you're using LoadSound() when you should really be using PlayMusic(). Check out the difference in the docs/helpfile. |
| ||
the trouble with playmusic() is that it doesn't loop the sound, which is something i really need the sound to do. |
| ||
Have you tried lowering the bitrate? |
| ||
I just used ogg file format and that seems to work pretty well. I made a little counter that compares the time played to the millisecs() variable also, to make the file "loop". |
| ||
the trouble with playmusic() is that it doesn't loop the sound, which is something i really need the sound to do. You're right. Which is why one tends to do something like the following: Global channelHandle Global musicFileName$ = "\Path\To\musicfile.ogg" ;During initialisation of the level or whatever (when you want the music to start) channelHandle = PlayMusic(musicFileName$) ; Start the music playing ;#### In Main Loop #### If Not ChannelPlaying(channelHandle) then PlayMusic(musicFileName$) ; Play the music again if it's not already playing ;#### End Main Loop #### Hope that helps. |