SamboyCoding/Fmod5Sharp

IMAADPCM issue

Closed this issue · 24 comments

this is a reference to this issue on assetripper AssetRipper/AssetRipper#411 in the last 2 comments.

After i finish ripping assets from the game and listening to the wav files that got exported, it will play 0 seconds of nothing.

Upon inspecting the compression format on the wav files, i found out they're ADPCM compressed.

i found no ADPCM support.

ADPCM is most likely referring to one of these two:
https://github.com/SamboyCoding/Fmod5Sharp/blob/master/Fmod5Sharp/FmodAudioTypeExtensions.cs#L12-L13>
AssetRipper only uses Fmod5Sharp for supported types.

However, the full list can be found here:
https://github.com/SamboyCoding/Fmod5Sharp/blob/master/Fmod5Sharp/FmodAudioType.cs

Since GCADPCM is Nintendo related, IMAADPCM is probably the type you're encountering.

i found no ADPCM support.

ADPCM is most likely referring to one of these two: https://github.com/SamboyCoding/Fmod5Sharp/blob/master/Fmod5Sharp/FmodAudioTypeExtensions.cs#L12-L13> AssetRipper only uses Fmod5Sharp for supported types.

However, the full list can be found here: https://github.com/SamboyCoding/Fmod5Sharp/blob/master/Fmod5Sharp/FmodAudioType.cs

Since GCADPCM is Nintendo related, IMAADPCM is probably the type you're encountering.

Yeah, im encountering the IMAADPCM type. Sorry if i mixed things up. I'm new to this Fmod kind of stuff.

I only was able to find a couple of IMAADPCM files but I found both mono and stereo versions, and all were able to be correctly reconstructed in my tests. Not sure what's going on here.

I'll see if I can use the api to produce test banks of each type.

I only was able to find a couple of IMAADPCM files but I found both mono and stereo versions, and all were able to be correctly reconstructed in my tests. Not sure what's going on here.

If you want, i'll send one of the non working wav files so you can compare the faulty wav file in hex or other with the working one (if it helps).

That would help, yea

That would help, yea

Ok, heres one faulty wav file that i chose to upload:
https://www.mediafire.com/file/tmmhtua60bd728w/1.wav/file (i had to upload with mediafire since github dosent support wav files, I hope you dont mind.)

Edit: i did a little experiment with the faulty wav file and a working version from AssetStudio by switching the non working wav files first bytes with AssetStudio's working version. And when i played the modified version of the broken wav file, i got it to work but all i heard was some weird buzzing noise.

and im talking about these first bytes at the beginning:

the broken wav file first bytes:

Screenshot 2022-06-27 212425

and AssetStudio's working version first bytes:

Screenshot 2022-06-27 211630

I'm still not sure why the wav files are broken tho. Probably a error is happening and causing the audioclips to get reconstructed with wrong data?

I can't do anything with the wav, i need the fsb - set the export format to raw fsb in ripper, and upload that file here

Hope it helps finding out this confusing issue.

Sorry if i bother both of you but any updates on this issue? Been wondering if the issue was discovered.

@githubexplorer2342 this issue is low priority since it doesn't cause any crashes. Also, for AssetRipper rips, you can replace the bad audio files with output from tools that use FMOD (which is restricted to non-commercial license terms).

In regards to progress, I started making a non-commercial tool for creating fsb files of any sound type. It should help with creating test files. Also, it'll make inserting new audio into asset bundles easier.

Yes, i know the issue isnt that much of a big deal and that it can be resolved by getting working audio files from other software that use FMOD but i was curious.
Regards to the tool you're making, i hope the development goes well @ds5678! 😄

So I tested this locally and I don't get an empty file back - I get a 6 second file, but yes, it is corrupted.

So I tested this locally and I don't get an empty file back - I get a 6 second file, but yes, it is corrupted.

I wonder what could be causing the file to be corrupted. Possibly somethings going wrong?

Ok, found the issue, FMOD uses two different kinds of IMA AD PCM - the normal one, and the one created for the original xbox. I support the former, I don't support the latter, and that's what this file is.

I don't really have time to fully implement that algorithm right now, but I know where to look.

Aha, so thats why it was corrupted.

I don't really have time to fully implement that algorithm right now, but I know where to look.

@SamboyCoding Do you have some links that might help the community contribute to this? @githubexplorer2342 seems to care a lot about this issue. Fmod5Sharp is a small codebase, so they could work on this if provided the resources.

There's an implementation of the decoder here in C. This would just have to be integrated into FmodImaAdPcmRebuilder, and used instead of the existing decoder if the number of channels is 1 (i.e. a mono IMAADPCM sample).

Hello! Little update: the wav files still wont work but its no big deal. I can just use other software to make fsb back to wav.

I can assure you they do work, I tried with the one you provided.

I can assure you they do work, I tried with the one you provided.

for some reason when i exported with the new version of AssetRipper, the wav files still didnt work. I can send one of the wav files to prove that they still dont work.