What are we all doing for music?

BlitzMax Forums/BlitzMax Programming/What are we all doing for music?

GfK(Posted 2012) [#1]
I've used MaxMod since it first appeared but the project has been dead for three years, and after the ballache I've had just getting it to compile this week (and finding out it doesn't work with the latest version of MinGW), I figure I should probably ditch it sometime soon and save myself the grief.

So... what you doing for streaming audio? I currently have a nice musichandler class which can cross-fade tracks - obviously that wouldn't be a great idea if I was loading a massive audio file into memory at once, as I'd effectively have to have two files (one fading out, one in) and that would be costly in terms of resources. Plus the loading/decompression time would be horrid.

Any usable MaxMod alternatives? Anybody done any work on their own with RTAudio?


Kryzon(Posted 2012) [#2]
Yo!

obviously that wouldn't be a great idea if I was loading a massive audio file into memory at once, as I'd effectively have to have two files (one fading out, one in) and that would be costly in terms of resources.

You should try crossfading with streamed audio.
What happens when streaming audio is that the audio engine loads small, consecutive buffers of the file (each buffer represents a 'chunk' of the whole file).
Streaming is useful for huge files because you only have a few chunks loaded at once, not the whole thing.
When a chunk finishes playing, the engine fills it with the next data to be played, and recycles all buffers like this until the file finishes playing.

So even when crossfading two streamed audio tracks, you'd only be crossfading the buffers that are currently loaded.

-----

About an audio engine, if I were doing anything commercial with Max I'd have a go at Brucey's irrKlang module.
It wraps the irrKlang audio engine.

irrKlang is a commercial solution, sold under several flavours (the same engine for all, but different licenses and terms).
For the 'Hobbyist" license it costs 65€.

Last edited 2012


matibee(Posted 2012) [#3]
I know it's really naive and not thoroughly tested (a couple of games in the wild and a couple of demos) but the best solution I came up with was to load a bunch of ogg files at startup and leave them in ram.

I know they're compressed (and not sure what memory they consume in uncompressed, ready to play, format) but for half a dozen oggs, at 1mb each it wasn't worth worrying about the ram wastage.

This might not help you :) but it's a system I'm going to stick with so if you know of any potential problems, that'll help me.


GfK(Posted 2012) [#4]
Well, loading an OGG file with loadsound tends to take up about 10x as much RAM as the size of the file itself, so a 3MB OGG = 30MB of RAM. I have 9 of them. It's not the loading that takes the time, it's the decompression.

Now that I've got MaxMod2 working I'll stick with that for now. I've had a look at irrKlang and that's only €290 for an Indie licence (€348 with VAT added on), which isn't too bad if it does the job well on all platforms. Though there is a dubious requirement for me to show the irrKlang logo on website and documentation, which is slightly off-putting.