Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Sound in Games

This thread is locked; no one can reply to it. rss feed Print
 1   2   3 
Sound in Games
FMC
Member #4,431
March 2004
avatar

i'm in a desperate need of help ;)
up to now all of the games i made with allegro (actually they are just 3) are without sound.
Since this morning one of my projects came to me, crying and begging, asking for some sound how could i let him down ? :'( :'(
So i opened my powerful spellbook (the allegro manual) and looked for the sound functions...
unfortunately i found out that allegro can handle only MIDI files, or with the help of an external lib, like DUMB, MOD files; the problem is that all
of my sound files are in wav (the sound effects) or in mp3(the musics) format.
I tryed to convert this files into MIDIs with a program (intelliScore Polyphonic) but the result was actually very poor :( ...
Can someone suggest a better technique?

[FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites]
Written laws are like spiders' webs, and will, like them, only entangle and hold the poor and weak, while the rich and powerful will easily break through them. -Anacharsis
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover. -Mark Twain

X-G
Member #856
December 2000
avatar

There are support libraries for Allegro that can play MP3's. And Allegro can handle .wav just fine.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

jakerohs
Member #485
June 2000
avatar

You're in luck - Allegro plays wav files :D

Have a look at the following pages of the manual:
Sound initialization
Digital sample routines
load_wav
play_sample

That should get you started.

Have a look at exsample.c for help on using these. It plays the wave file specified on the command line. (Attachment)

FMC
Member #4,431
March 2004
avatar

...ehhm :P ::) ... yeah wav is supported, don't know why i didn't notice it before *shame*.
Unfortunately the site of the Mp3 library is down... can someone post a link to a copy of the library?

[FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites]
Written laws are like spiders' webs, and will, like them, only entangle and hold the poor and weak, while the rich and powerful will easily break through them. -Anacharsis
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover. -Mark Twain

jakerohs
Member #485
June 2000
avatar

Sure. Enjoy :)

X-G
Member #856
December 2000
avatar

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

FMC
Member #4,431
March 2004
avatar

Thank you

[FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites]
Written laws are like spiders' webs, and will, like them, only entangle and hold the poor and weak, while the rich and powerful will easily break through them. -Anacharsis
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover. -Mark Twain

Johan Halmén
Member #1,550
September 2001

Isn't it way overhead to use wav or mp3 for the music in a game? Of course, if that's the only music you have, ok then. But you should use mid or mod or that kind of stuff for music and wav for sound effects.

But complete music as a wav file takes a lot of memory. And if you have mp3, either you have to pre-unpack it to a wavelike struct or you unpack it while it plays and your other game stuff runs. I believe midi is most cpu effective.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Years of thorough research have revealed that the red "x" that closes a window, really isn't red, but white on red background.

Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest.

Thomas Fjellstrom
Member #476
June 2000
avatar

Quote:

I believe midi is most cpu effective.

Only if you have decent hardware. I don't eve have hardware that can play midi itsself. I have to use a SoftSynth to play any/all midi, wich will likely use up much more cpu than mp3 :)

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Synapse Jumps
Member #3,073
December 2002

Dont midis play differently on different computers though? Wouldnt a wav in a globally compressed datafile be fine?

Krzysztof Kluczek
Member #4,191
January 2004
avatar

Quote:

Dont midis play differently on different computers though? Wouldnt a wav in a globally compressed datafile be fine?

Yes. No. How midis play is completely dependent on how ones computer handles it. And wav probably won't compress greatly since most compression algorithms are based on run length or on frequency of characters (both these algos will fail to achieve impressive results with wav). MOD/IT/XM is probably best choice. :)

FMC
Member #4,431
March 2004
avatar

i would use midi files if a found a way to convert my sounds and music in that format... :(
Wav are big and infact in my game (ctris) i had included a music but i had to distibute the game without it because i thought that it wasnt right to make a poor modem user (like me) download an over 20 mb file ...

[FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites]
Written laws are like spiders' webs, and will, like them, only entangle and hold the poor and weak, while the rich and powerful will easily break through them. -Anacharsis
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover. -Mark Twain

Chris Katko
Member #1,881
January 2002
avatar

Waves? Big? Just OGG compress them.

Quote:

How midis play is completely dependent on how ones computer handles it.

That's an over-statement which everyone seems to use. The only thing that's usually different, is per-brand MIDI instruments. My card can use custom instrument packs as well.

Quote:

MOD/IT/XM is probably best choice.

Yes and no. If you don't have a really good musical artist, modules might work best. But modules lack everything studio audio has. Mastering, and all those nice finishing touches (like EQ).

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

FMC
Member #4,431
March 2004
avatar

I don't know what OGG is.

Google helped me to http://www.vorbis.com/ can i find here all of the infos i need?

allegro doesn't seem to support this operation directly, do you need the alogg library?

[FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites]
Written laws are like spiders' webs, and will, like them, only entangle and hold the poor and weak, while the rich and powerful will easily break through them. -Anacharsis
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover. -Mark Twain

xboxut
Member #4,290
February 2004
avatar

mod(xt,s3m etc) format was develop several year ago for atari or amiga.this format was use in ut or unreal.
try to find modplug for making mod music.it s a very good tracker

go at :http://www.united-trackers.org/2000/software/ to find more info about mod format

o and about mod music it s a very small format becose it use a little set of instruments and sample.

~~~~~~~~~~~~~~~~~~~~~~~~~~
sorry for my poor english :p

Chris Katko
Member #1,881
January 2002
avatar

Quote:

How much can it compress the file?

A very lot. 4 minute wave, 40mb. MP3 @ 128bpm, joint-stereo. 3.66mb. An OGG is around there.

Quote:

How can you compress a file?

With a encoder. You can probably get one here.

Quote:

How can you decompress it?

With a library like alogg.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

FMC
Member #4,431
March 2004
avatar

thanks for the tip(gregoire) and for the help(Etwinox) :)

[FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites]
Written laws are like spiders' webs, and will, like them, only entangle and hold the poor and weak, while the rich and powerful will easily break through them. -Anacharsis
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover. -Mark Twain

gnolam
Member #2,030
March 2002
avatar

Audacity, a really good open source & cross-platform audio editor, can natively export to .ogg nowadays.

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

xboxut
Member #4,290
February 2004
avatar

aryx a s3m music:2,17 min --->20.3 ko ,8sounds :)
u can listen ut music:a music like mission(aussault mod-->debarquement) have a lenght of 4,13 min and it s only 700 ko(good kality)

~~~~~~~~~~~~~~~~~~~~~~~~~~
sorry for my poor english :p

Chris Katko
Member #1,881
January 2002
avatar

Modules increase in size as the complexity of the music increases. Aryx is a bad example. It's using only square/triangle/etc waves. Unreal Tournament's music is more realistic. They sound good, and they're around 4-5meg each. And they're modules.

[edit] Heh, we both mentioned UT in our "additions" to our original posts. We must both be refering to different modules though.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

xboxut
Member #4,290
February 2004
avatar

ok wait i find a ut music :)

~~~~~~~~~~~~~~~~~~~~~~~~~~
sorry for my poor english :p

Chris Katko
Member #1,881
January 2002
avatar

Though one thing. It isn't really publicly known at all, but there are mo3 files. Which are mp3 compressed modules. Now those are insanely small. And some module readers can read zipped/archived modules.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

xboxut
Member #4,290
February 2004
avatar

ok fuiii i run on my own pc ok :)
mission in s3m lenght 4,13 min size:720ko
mission in mp3 lenght 4,13 min size about 4 meg

dl the attachement its mission in s3m u need mod plug player to read it

?? where i can find more information about mo3?? ;)

~~~~~~~~~~~~~~~~~~~~~~~~~~
sorry for my poor english :p

Synapse Jumps
Member #3,073
December 2002

Quote:

?? where i can find more information about mo3??

Check it out Looks pretty impressive, but I don't really like the idea of adding more libs to Allegro, I dunno, it's just cuz I'm crazy and a minimalist ;). I'd stick with s3m if you can get it that small with that much data, but do you have a player for it?

Chris Katko
Member #1,881
January 2002
avatar

Quote:

ok fuiii i run on my own pc ok
mission in s3m lenght 4,13 min size:720ko
mission in mp3 lenght 4,13 min size about 4 meg

But that module only has 14 (20-30k) samples. And it doesn't sound as high quality as [insert favorite band].

Let me get this straight though. I don't hate modules. I track modules. But there are noticable "faults" in modules. The most important two, is probably the lack of an EQ, and the lack of ANY useful effects whatsoever. No chorus, no flanger, no reverb (essential for vocals), etc.

Vocals also make a module huge.

A module can become bigger than mp3s. But this only happens when the complexity (and quality of samples) of the module, exceeds a certain point. I know of guys who track high-quality 130mb+ modules.

I don't even remember the original point. Other than that the only advantage that modules have, is that they're smaller (which isn't always true). But they also lack in mastering.

Keeping all of what I said in mind, I should look into writing one with built-in support for the common mastering tools...

Quote:

where can I find mo3

Here perhaps.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

 1   2   3 


Go to: