Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Issue loading WAV audio sound sample

This thread is locked; no one can reply to it. rss feed Print
Issue loading WAV audio sound sample
Bluebird
Member #15,421
December 2013

I have a WAV file I got off the web. I notice that trying to load it, al_load_sample_f returns NULL. I already used this function successfully to load other WAVs, and if I swap out the file data for another WAV file, it loads fine and plays the sound, so I'm 100% certain there is no problem in my code, I suspect there is a problem with the file.

For reference if I run file on all my WAVs here's what I get on the console:

file ./*.wav
./bullet-ricochet.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 44100 Hz
./heavy-woosh.wav:     RIFF (little-endian) data, WAVE audio
./money-pickup.wav:    RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 44100 Hz
./powerup.wav:         RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44100 Hz

It's the SECOND file in the list that Allegro doesn't wanna load ... it plays fine in other programs though (tested mocp).

Should I just chalk this up to it being some arcane WAV and just settle for changing it to OGG? (I'll probably do that anyway via audacity.) But I was wondering if this is normal or if there's an oversight in the acodec addon.

Also, dunno if it's just me or my browser, but putting a $ inside a monospace block causes the preview button to hang. :P

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Bluebird
Member #15,421
December 2013

I figured it was an arcane format; yes it works if I export it as MS 16bit PCM.

Just to test, I also tried exporting as 32bit from audacity, but no sound. So it looks like only 16bit PCM is supported. I wonder how common other formats are ...

Audacity would let me export as .... checks .... wow that's a lot of allowed formats for WAV.

torhu
Member #2,727
September 2002
avatar

Audio software will often save in higher resolution to allow for further editing with less loss of quality. Like 32-bit integer, or 32 or 64 bit floating point. And WAV is the standard format for audio on Windows, so you sometimes get files like that. If it was 24 bit, that's something that's also used for distributing, so it would of course be nice if it Allegro supported that. But it's for high-end audio, not really relevant for games.

Go to: