How to stop Mp3 being converted to wav?

Blitz3D Forums/Blitz3D Programming/How to stop Mp3 being converted to wav?

Crinkle(Posted 2009) [#1]
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?


Ginger Tea(Posted 2009) [#2]
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


Crinkle(Posted 2009) [#3]
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!


Ginger Tea(Posted 2009) [#4]
odd for the file size as i record annecdotes and my bass at cd quality and get 10mb aprox per minute


Abrexxes(Posted 2009) [#5]
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


Crinkle(Posted 2009) [#6]
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?


LineOf7s(Posted 2009) [#7]
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.


Crinkle(Posted 2009) [#8]
the trouble with playmusic() is that it doesn't loop the sound, which is something i really need the sound to do.


Ross C(Posted 2009) [#9]
Have you tried lowering the bitrate?


Crinkle(Posted 2009) [#10]
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".


LineOf7s(Posted 2009) [#11]
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.