stuij/apex-audio-system

example wav file doesn't produce sound

Closed this issue · 1 comments

stuij commented

The examples use the Ambulance.wav file to test SFX. But when playing it in the produced .gba file you can only hear a faint click at the beginning of the file.

When playing the file on my PC, it sounds fine, and the output of soxi shows it's in the right format:

$ soxi Ambulance.wav

Input File     : 'Ambulance.wav'
Channels       : 1
Sample Rate    : 16000
Precision      : 8-bit
Duration       : 00:00:00.97 = 15564 samples ~ 72.9562 CDDA sectors
File Size      : 15.6k
Bit Rate       : 128k
Sample Encoding: 8-bit Unsigned Integer PCM

So we need to do some investigation on what is going on here.

When converting to signed raw, the file plays fine in a GBA:
ffmpeg -i Ambulance.wav -f s8 -ar 16000 -acodec pcm_s8 AAS_Data/Ambulance.raw

I haven't tested this yet, but I'm betting this is a problem with all WAV files. This is happening both on Linux and Windows.

stuij commented

Turns out that in the program that converts the wav file to the AAS internal format has a major bug. When converting the wav's unsigned samples to signed format, the source pointer was never advanced, so the same value was used for all the samples.

This breaks all WAV file conversions, so I'm doubting that the sources I got from the original author were used for the last closed source release back in 2008. But I haven't checked conv2aas from that release, so it's possible that that issue was already present then.

fixed by: 9004c6a