Advertisement

best way of using mp3 music

Started by February 22, 2000 02:35 PM
9 comments, last by Ridcully 24 years, 6 months ago
hi there! because many up to date games use mp3 music now, i was wondering how to implement this technique. as i see it, the biggest problem is the exessive cpu use of playback of mp3s. so i suppose you decode them before playing, right? but, should i decode the whole file, store it in memory or on the hd and load it in a streaming sound buffer? or should i better only decode the parts i need at the moment? thanks for any suggestions oh, and i wouldn''t complain if someone could point me to a URL where to get mp3 decompression source code
MP3''s dont really use very much CPU time.

for example, it takes only 2% of my CPU resources to play back a 192kbps mp3 in real time using the Nitrane decoder in Winamp on a K6-2 300.

As for code, im not sure of any available, except in the Golgotha source code, which is copyrighted, and you cannot use.

There might be a few free libraries around, but they usually require that your game be free-ware too.




===============================================
I saw a man pursuing the horizon;
Round and round they sped. I was disturbed at this; I accosted the man.
"It is futile," I said, You can never -- "

"You lie," he cried, And ran on.
This is my signature. There are many like it, but this one is mine. My signature is my best friend. It is my life. I must master it as I must master my life. My signature, without me, is useless. Without my signature, I am useless.
Advertisement
If you want to just take a look at the golgotha code, its available at:

www.crack.com
This is my signature. There are many like it, but this one is mine. My signature is my best friend. It is my life. I must master it as I must master my life. My signature, without me, is useless. Without my signature, I am useless.
you mean i would actually have to write my own mp3 decompression code or license this other one?
damn... sure there is no free source without any "do not sell" or copyright?

and, you would suggest decoding in real time? wouldn''t that slow down significantly on, for example a p166mmx? from what i have heard it does.
i''ll prolly decode the whole file before playing on slow machines...

but first i have to find some FREE mp3 decmp code... *sigh*
There are tons of free code for decoding/encoding mp3''s all over the net. I know I have one on my computer because I remember downloading and compiling it, but for the life of me, I have no clue where it has gotten to. If I find it i''ll send it to you I guess.

You might also check the programming section on www.mp3.com.

I have a P200 48ram, and play back is total distorted if do things like scroll a window or open up a new app. I''m not sure how he is getting that 2% figure, but I wish I could.
William Reiach - Human Extrodinaire

Marlene and Me


Last I checked, if your executable contains statically linked any MP3 depression code and the executable is for profit you have to pay a royalty to Fraunhoffer institute. However, you can use dynamically linked decompression code, as long as the dynamically linked library is free.
Advertisement
you dont have to pay royalties for your own decompression/decoding code.

Of course, they would LOVE to make it royaliy based, but there currently isnt ANY law that states that.

Encoding, however, is different.

===============================================
I saw a man pursuing the horizon;
Round and round they sped. I was disturbed at this; I accosted the man.
"It is futile," I said, You can never -- "

"You lie," he cried, And ran on.
This is my signature. There are many like it, but this one is mine. My signature is my best friend. It is my life. I must master it as I must master my life. My signature, without me, is useless. Without my signature, I am useless.
http://cust.nol.at/ppee
On that page there''s a DirectSound wrapper that can play mp3s. Go to the "DirectX Programming" page then to "DirectSound Samples".

- mallen22@concentric.net
- http://www.cfxweb.net/mxf/
http://developer.a3d.com/

A3D 3.0 now supports mp3 playback. It''s also free to use. Have fun.

Jonathan
Are you talking about decompressing it into a .wav? If so, just get Winamp and go to Preferences-Output and change the output plugin to Nullsoft Disk Writer Plugin v1.0 and play the mp3. It will decode the file into a .wav intot he directory where you configured the plugin for.

This topic is closed to new replies.

Advertisement