jombo23 / N64-Tools

N64 Tools
The Unlicense
239 stars 113 forks source link

All tools assign instruments incorrectly for San Francisco Rush 2049 #34

Open JillCrungus opened 2 years ago

JillCrungus commented 2 years ago

When exporting MIDIs from San Francisco Rush 2049, the tool is just assigning instruments in sequential order (track 1 gets instrument 0, track 2 gets instrument 1, etc.), which definitely doesn't seem to be correct and results in a mangled sound when the game's soundfont is applied.

Either the game really assigns instruments in this way and the DLS export is broken (incredibly unlikely) or the tools are assigning instruments wrong.

SubDrag commented 2 years ago

This is a Factor 5 game. Did you try using Write DLS Combined banks? That should get you the more correct lookup.

JillCrungus commented 2 years ago

This is a Factor 5 game. Did you try using Write DLS Combined banks? That should get you the more correct lookup.

Can you elaborate on the right usage of this? It outputs more banks and I assumed that the banks would map to tracks but none of the tracks seem to sound correct regardless of the bank used to play them.

SubDrag commented 2 years ago

I believe every song gets its own associated bank (basically it remaps the real numbers mapped to 0-15). So you want to play the song with the analogous bank.

JillCrungus commented 2 years ago

I believe every song gets its own associated bank (basically it remaps the real numbers mapped to 0-15). So you want to play the song with the analogous bank.

That was my assumption, but no matter which bank I use the tracks always seem to sound completely wrong.

SubDrag commented 2 years ago

It should match 1:1 - one DLS per midi. If that's not sounding right, I'm not sure, maybe this game has a lookup of instruments different than the standard.

SubDrag commented 2 years ago

OK yeah this game is not working properly (San Francisco 2049). There are no "Layer groups" in the Factor 5 info, so there is no sample lookup... I uhh, don't know what this Factor 5 game does differently, but it's something, or the wrong file somehow. I checked all the other Factor 5 games and they're all fine. It's just a Rush 2049 issue.

SubDrag commented 2 years ago

Yeah it uses the Sound Macro list, unlike the other games which all use Layers. Also note it's not a 1:1 of song # to group. Sorry I don't think there'll be a solution any time soon. For some reason the sampleId id it spits out are not the real numbers and are some kind of mapping that is unique to that game.

But yeah I would have to say Factor 5 games are going to be a bit of a struggle right now due to song lookup and possibly not lining up, but this one in particular is off.

SubDrag commented 2 years ago

OK I see the issue - actually all Factor 5 games are off. Working on it.

SubDrag commented 2 years ago

OK I was accidentally not looking up by "Sfx id". So it was the wrong samples. Can you try the latest? You will still have to cross-reference on your own, what soundbank goes to what midi, but it should at least be music samples now.

SubDrag commented 2 years ago

If this is actually correct, let me know if you figure out what maps to what, and can default that game to work that way. Might line up 1:1 though on numbers in this one.

JillCrungus commented 2 years ago

If this is actually correct, let me know if you figure out what maps to what, and can default that game to work that way. Might line up 1:1 though on numbers in this one.

The soundbank tool shows a warning about there not being a layer offset when exporting the soundbanks which I assume is normal given what you've mentioned.

The results are definitely sounding better in the latest release. The banks seem to contain more appropriate samples now, but things still seem amiss. While the samples are clearly better, it's still the case that things aren't matching up at all and in some cases I've even hunted through every patch in every bank and been unable to find patches that correspond to certain instruments in some tracks, so unless I missed something, something still seems wrong.

SubDrag commented 2 years ago

Wait the instruments don't even exist in the sound tool? Maybe if you hone in on one song and try and sort out what it should be versus which is closest bank and what is there today... Maybe can find a pattern.

JillCrungus commented 2 years ago

Wait the instruments don't even exist in the sound tool? Maybe if you hone in on one song and try and sort out what it should be versus which is closest bank and what is there today... Maybe can find a pattern.

I couldn't find certain instruments in the exported banks is what I meant. I've been testing using a specific track and went through every bank trying to get a specific instrument to match but regardless of which bank or patch was used I couldn't get a match. It is entirely possible I just missed it I suppose.

SubDrag commented 2 years ago

Try using the N64 sound tool. It has all samples. Not just those by songs.

JillCrungus commented 2 years ago

Try using the N64 sound tool. It has all samples. Not just those by songs.

I exported all the samples with the sound tool and was able to locate the sample for the channel I'm testing with with them (named "BANK_00_INSTR_0015_SND_0000"). I'm almost certain that it wasn't in any of the soundbanks when I checked them, though it was a bit of a tedious process so it may be in there and I just missed it.

SubDrag commented 2 years ago

Can you pick one song and identify all the correct sound indexes versus midi track? I might just be off slightly... But I won't know till know the correct answer.

That one you found that was missing not sure what song or track you meant it was for?

JillCrungus commented 2 years ago

Can you pick one song and identify all the correct sound indexes versus midi track? I might just be off slightly... But I won't know till know the correct answer.

That one you found that was missing not sure what song or track you meant it was for?

I can make an attempt, I'm not certain if I'll be able to pin down every sound in the track but I can try. I've been testing using the US release of the game and the track I've been testing with is the one exported by the soundbank tool as "00000007 003218B0". It's supposed to sound like this: https://youtu.be/HXIElifH98c

The sample I mentioned is intended for the start of MIDI track 8 in that song (the drum from about 24 seconds into that video)

Something I've just realised that's worth nothing, it seems like that track is intended to switch instruments as the latter end of it is almost certainly not for percussion but the actual MIDI doesn't change patch (I'm not super knowledgeable on how it'd work internally here, none of the notes in the latter end are shared with the ones used for the drum at the start so maybe this would be a case where the instrument would just have different samples assigned for the notes used in that section, hence no actual patch change?). If instruments can change that might make it even more difficult to pin down all the samples.

SubDrag commented 2 years ago

Yeah an attempt would help me see if there is a pattern. Is it only the drum track always off? Those are a bit different for Factor 5. Against which combined soundbank.

JillCrungus commented 2 years ago

Yeah an attempt would help me see if there is a pattern. Is it only the drum track always off? Those are a bit different for Factor 5. Against which combined soundbank.

Almost all of the tracks are off when using the soundbanks, so it's difficult to tell which bank is even correct (especially since there seems to be missing instruments.)

Since this is track 00000007, I did try using bank 07. When using that bank, the instrument for MIDI track 11 is actually the correct one, but when played back it's an octave too high. All the other tracks are completely off. (Worth nothing that bank 0A has the same result of MIDI track 11 being correct in track 07, but doesn't really seem to line up with track 0A?)

SubDrag commented 2 years ago

Thanks that was really helpful. OK, I think getting closer. It seems the instruments were assigned wrong...it was using the channel, instead of the instrument. Getting better but no all the way. Can you try grabbing again and see what happens now and what is off now?

JillCrungus commented 2 years ago

Thanks that was really helpful. OK, I think getting closer. It seems the instruments were assigned wrong...it was using the channel, instead of the instrument. I'm wondering now if the key base they give you is not centered the same? Can you try grabbing again and see what happens now.

Definitely getting there. Some of the instruments are correct now. Though, a few tracks are still off (the aforementioned drum sound - MIDI track 8, seems to be one of them.

The pitches are also definitely wrong, though I'm not sure that if it's consistent how much they're off by or not at the moment.

SubDrag commented 2 years ago

I found one more problem a moment ago. Just to be safe regrab and see instruments if they're OK now. Hmm drum track may be special, but maybe let's worry about the others first. Are all key base off by a consistent amount?

DLS Format doesn't seem to support volume for instruments, which may be a factor.

SubDrag commented 2 years ago

OK I found out I was using the wrong sampling rate on instruments...can you redownload and try again. It actually sounds like music now I think.

JillCrungus commented 2 years ago

OK I found out I was using the wrong sampling rate on instruments...can you redownload and try again. It actually sounds like music now I think.

I'm not really hearing a difference between the version I just downloaded and the last one.

Oh, I will note that if I tick the "1/2 sampling rate" box in the soundbank tool then some of the tracks sound more correct though I'm not sure they all are (it's hard to tell since some of the instruments still seem to be wrong) so maybe the sample rate is still off?

I'll try and start matching tracks to exported soundbank instruments from the sound tool some time soon

SubDrag commented 2 years ago

If you click preview it sounds decent, I think. The sampling rates should be better now though? I wonder if it's the special drum track mainly causing the problems. Are you making it so your midi software is not treating channel 9 as drum track? It should not be.

All the key bases appear to be 0x3C. Most sampling are 11025. ADSR should all be full. It's weird there's nothing special at all. I don't know why it's off - do you use Synthfont? Maybe it's an issue there...

I think your original theory of midi number and equivalent song id is probably right.