jombo23 / N64-Tools

N64 Tools
The Unlicense
239 stars 113 forks source link

N64SoundListTool - Extracted sound decoding failed - Star Wars Rogue Squadron #47

Closed JackCarterSmith closed 1 year ago

JackCarterSmith commented 1 year ago

Hi,

I'm not sure about doing thing correctly: I used a RS-N64_USA rom with N64SoundListTool (using master (71ecb5e) version and latest release from march 11th) and all the sound seem "badly" decoded (see in linked file). ExtractedSound.zip

I'm not sure if it's me who doesn't set a parameter correctly or if it's my file who doesn't work.

Anyone can give me a tips please?

SubDrag commented 1 year ago

You have a mismatched ROM. Make sure you download the correct one. I verified the Rogue Squadron sound against ROM with MD5 of: [47CAC4E2A6309458342F21A9018FFBF0] Good Name=Star Wars - Rogue Squadron (U) (M3) [!].z64 Header Code=66A24BEC-2EADD94F-C45

Sounds correct, yours is parsing garbage data. There's a 1.0 and Rev A. Perhaps using wrong one?

JackCarterSmith commented 1 year ago

That's my conclusion for now, wrong ROM... But I can't found a good one on www. (So bad I can't dump my own cartridge x)

Instead, I'm managed to use your MORTDecoder class standalone with raw data from PC version. I discuss it in another post of RS datas parsing (https://github.com/dpethes/rerogue/issues/13). That's work great! But I found some bugs/missing features in it (with PC version):

I'm not sure about the 8000/16000 samplerate switch is present/necessary on N64 ROM version, I can't test it for now, but the question is still opened.

SubDrag commented 1 year ago

I think the N64 rip has the same bug in parsing. It seems on longer sounds there is an extra 0.5 seconds of bad data, followed by the good full sound.

Here's an example.

Sound05.zip

Unclear why it's off...started too early, or some minor problem somehow in the beginning.

SubDrag commented 1 year ago

OK I was just starting output at the wrong spot - fix is here, all rips should be good now. See this commit on what you should also change: https://github.com/jombo23/N64-Tools/commit/4fe107327f8a602097bed6ab57374612dc4d707a Sound05Corrected.zip

SubDrag commented 1 year ago

I'll close this thread as I believe the issue is fixed and can track PC work on your github issue - I don't find any sounds the wrong sample rate on N64 rip. They all seem 8000 (probably to save space).

JackCarterSmith commented 1 year ago

Yes I don't think the MORT decoder is broked (for N64 and PC). Probably a wrong configuration of my MSVC toolchain/toolset...

I'll close this thread as I believe the issue is fixed and can track PC work on your github issue - I don't find any sounds the wrong sample rate on N64 rip. They all seem 8000 (probably to save space).

You right I presume, even textures have been resized in N64 version. And if the game use programmable RSP chip on N64 for HW accelerated decoding, all make sense!

OK I was just starting output at the wrong spot - fix is here, all rips should be good now. See this commit on what you should also change: 4fe1073

Great I've tried to remove ~0.5s of sound in wav file before, but you made a proper way to do! Thanks, it's running pretty good now. I can't try with N64 file, but for the issue about MORT decoder, it's okay for me now 👍

SubDrag commented 1 year ago

I found some 16000 sounds in N64 (well the one you posted), so they do exist, I just hadn't noticed before. I'm not sure why you're having issues, I think the best explanation is you still don't have a valid ROM matching MD5, so it's parsing over junk data.

JackCarterSmith commented 1 year ago

Do you have something like a flag to know if the sound is 8000 or 16000 in N64 datas? I've .n64 type file, should I need to find a .z64 one?

SubDrag commented 1 year ago

I had mentioned in other thread. It's at offset 6 the sampling rate.

SubDrag commented 1 year ago

Just find a valid rom matching md5 or try another region.