Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Environmental Audio in Allegro5?

This thread is locked; no one can reply to it. rss feed Print
Environmental Audio in Allegro5?
Mark Oates
Member #1,146
March 2001
avatar

Hey what's up. Has anyone done some legwork on, or come across something related to real-time game audio processing using Allegro 5? Allegro appears to have an impressive audio chain so it looks very possible.

I'm looking specifically at being able to filter sound effect audio through a "reverb" filter, in a performant way, similar to Super Mario World when you enter an underground cave. There are other applications for audio filtering that I'd like to try out, too, but this is where I hope to start.

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Dizzy Egg
Member #10,824
March 2009
avatar

I would recommend irrklang, it’s a really straightforward sound engine that allows you to use a bunch of different effects without much fuss, here’s a link with example of effects:

https://www.ambiera.com/irrklang/tutorial-sound-effects.html

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Todd Cope
Member #998
November 2000
avatar

You can use al_set_mixer_postprocess_callback() to process audio before it is sent to the audio device.

To do SNES-style reverb you could just keep a buffer of samples to be mixed in at a lower volume at an offset from when they were initially played. This is an oversimplification, of course, but it should point you in the right direction if you want to use Allegro for this.

Mark Oates
Member #1,146
March 2001
avatar

Todd Cope said:

You can use al_set_mixer_postprocess_callback() to process audio before it is sent to the audio device.
To do SNES-style reverb you could just keep a buffer of samples to be mixed in at a lower volume at an offset from when they were initially played. This is an oversimplification, of course, but it should point you in the right direction if you want to use Allegro for this.

Thank you Todd, that was really good advice. I had initially abandoned that direction but thanks to your comment I continued and was able to make substantial progress.

Apparently, the actual math behind reverb is more than just one or two simple algorithms. There's art behind it, and one can craft many different kinds of reverb - it's somewhat analogous to writing an artistic shader. Working on this lead me down a path of circular buffers, sample sizes, buffer lengths, channel configurations, all-pass filters, all these exciting things. Apparently there's an audio programming society of people who specialize in audio programming and do that exclusively as a programming career, who knew! It's a very deep domain.

I found a nice youtube video "Let's write a reverb", which was a good talk on the subject.

At this point, I've managed to write a solid circular buffer, a mixer, and a delay filter (with delay_sec and decay) that will be included it in my codebase. With this much, I've moved the ball forward and now have a good foundation for an actual reverb in the next steps. Hopefully some exciting news coming up. :)

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Go to: