Wii JADE engine *.wam (DSP) - stereo issues by Droolie at 11:30 PM EDT on April 2, 2018
Hi guys,
Rayman Raving Rabbids 1 & 2, like all JADE engine games, use *.wam files for their audio. On the Wii, these are DSP with a different header. I found the coef table in the ELF, so to play these files I wrote a QuickBMS script that extracts header info (sample rate, channels, etc.) and the stream from the *.wam and puts all that and the coef table in a *.genh.
Here's the problem though: they're all stereo, but only a mono *.genh sounds good, though the blocks for each channel are still interleaved post-conversion. Did I just not find the right interleave, or is there more to it? Any help?
Here are some examples, and my script so far (exports as stereo atm): Examples and script
Really? I thought it was the right one since it definitely looks like a coef table (though it's one 0x20 block only, so one channel?) and its offset in the ELF is marked by "gcSND_gst_GameCubeCoefficientsTable".
Also, the files, when played as mono DSP, sound pretty much perfect, except that the blocks for each channel play sequentially instead of at the same time in different channels. I was wondering if it isn't possible that it's processed by the audio engine as mono but that the resulting stream is played in stereo... though I don't know how that would work.
Thanks so much, they sound almost perfect now! The last second or so of the streams still don't play right though. Seems to me like VGMStream tried to read past the end of the stream, because adding zeroes to the end of the genh removed some annoying pops/clicks at the end. Here's the updated script and some examples: examples Did I get the number of samples calculation wrong?
Your calculations are fine, but IIRC files need a feature that isn't available in GENH (the interleave in the last block is smaller).
Ex. with interleave 0x6400 in 2ch, if the data size is 0x2D5A00, up to 0x2D5000 it's normal interleave (0x2D5000 = 0x6400*2 * 0x3A) + 0xA00 of smaller interleave (0xA00 = 500*2 * 0x1).
vgmstream can do this but I need to add the format (or you could mutate the last block from 0x500*2 to 0x6400*2).
Thanks for the help bnnm! And also a quick thank you for all the fantastic work you do on vgmstream! :)
I edited the script so it now mutates the last block as you said, and it works wonderfully. I also found out how the files store their loop points, so I also included that in the script (they should be correct, though I haven't checked every file). It works for all the *.wam (music), *.waa (ambience) and *.wad (sound effect) files from Rayman Raving Rabbids 1 & 2, and almost certainly other JADE engine games.
Here's the final script: https://pastebin.com/rCjK3NJc Hopefully it is of some help for other people looking into JADE engine games in the future.