Originally posted by koolaidman
Rare games sometimes used the AMSeq format for their N64 games. I told SubDrag that there was data in AUDIO.bin that looked like the sequence format in Diddy Kong Racing and he was able to add support in N64MidTool for it. There are some problems with the converted sequences as I said when I released everything, here are some that I encountered:
1.) Pitch problems - as you said, there are some pitch problems in songs that heavily depend on it. For the song you listed I tried to shrink the pitch change values but nothing seemed to sound quite right so I left it to go work on other songs. For that song in particular I knew it was exactly the same as the one used in SFA so I figured it wasn't important to fix that particular one, but you're right that there are more that aren't used that have the same problem. But sometimes there were songs (like Discovery Falls) where the pitch changes are actually too weak. And most of the other songs had pitch changes that were just right. So you'll have to talk to SubDrag about this one.
2.) Program/Patch changes mid song - this wasn't much of a problem since ValleyBell's program worked wonderfully to split the individual channels that had changes and carry their pitch/patch settings over. But since it was an automated process it might've messed some stuff up (in fact there were one or two songs that didn't want to go through his program so I had to resave the MIDI file from a DAW elsewhere and open that up instead). One song that really had this problem bad was the Northern Wastes one. This song is really crazy as it basically has 3 songs in one MIDI file (a lot of the songs do this), each song with it's own channels and using some channels from the other songs. Thankfully I was able piece together something based on IOnEI Falcon's 1 hour video and the officially released version (during the game's original production) but it still sounds inaccurate because I wasn't as familiar with the song at the time so I just left it as is. There were a lot more problems with this song specifically which I'll get into later.
3.) Possible missing channels/notes - not as much as a problem because there weren't many places where it seemed like it was missing channels/notes. The only places that seemed noticeable were the ones for the Test of ____ tracks and Ice Mountain Race where the vocals were missing but the voice samples are actually still in MUSIC.bin (where all the other instrument samples are kept). The officially released music from DP was probably not taken directly from an N64, so there were probably some things that needed to be fixed during the conversion process to the game.
4.) Incorrect notes - also not as much of a problem, but there were some songs that seemed to be using the wrong samples (originally, Discovery Falls was like this but was an easy fix). This might have more to do with the soundfont I made rather than the converted MIDI, but I remember double checking this to make sure it wasn't a problem in other songs but I still ended up having the same problem here and there. (00000052 00081BD8 being the biggest case since nothing seems to work for it and there's no telling what the original sounded like).
5.) Problems with the soundfont - As I said, the instrument samples were taken from MUSIC.bin. The samples were extracted with N64SoundTool, which also has it's share of problems too. Luckily, the majority of the samples in MUSIC.bin were exactly 22khz, but there were still some that had a different rate. I had to manually fix this in Audacity, but since the samples had to be rerendered I lost the root key and loop point for the sample so these had to be recalculated. As a result, there are some parts where the instruments sound a little off, the biggest offender being the piano patch (which I still have no clue how to fix since it appears to be right but still sounds way off). To make matters worse, a lot of the patches used a variety of samples (for instance, there was one patch that had vocal expressions, drums, AND sfx all in one) and to top it all off, instead of having each sample have one root key the game spans the sample across multiple keys in range of the root key. Luckily I don't think I messed that up, but there might be problems with some of the samples themselves still.
6.) No looping - can't be helped I think. You can use some creative license to make up your own loop point for the song though. A lot of the songs sound very good even without a loop, like a soundtrack version.
I've done quite a bit of hacking around with the sound and midi files in recent days, and I think I've come to a good, if broad, understanding of them. Enough so that I could make my own extractors and stupid'n'simple converters, at any rate. Here's some things I've noted:
Pitch problems -- what sticks out to me here is that the instrument sounds contain parameters for detune and bend range, along with attack/release/decay times and key base/ranges and other things. Were these preserved in creating the soundfont? I've yet to look into the sf2 format very much, or the soundfont you provided, but missing the detune and bend range info could probably account for some of the off-key issues.
Program/Patch changes mid song -- I'm not sure where this is actually an issue, at least in the technical sense. I've been able to track-for-track convert the songs and they will play fine. Though as noted, there are some peculiarities in that some songs are actually multiple songs in one (e.g. the Northern Wastes), but I imagine these would be handled by fading in and out specific tracks during gameplay... probably by having an extra 'master' volume control per track that can be controlled externally by the game logic. So to 'extract' the individual songs, you'd just mute specific tracks.
Possible missing channels/notes -- This still has me stumped. There's a couple possibilities I can think of. One, the data just isn't there for some reason. For the ice mountain race, perhaps the devs thought the vocals didn't fit with the visuals or gameplay and took them out for the in-game version. The other possibility is that they're there, but are somehow triggered by game logic. For the Krazoa tests, I could imagine the game logic signaling the audio system with a specific "Test of ___" 'instrument' to use based on which test the player was doing (which would be an odd way to do it surely, especially since the tests seem to have their own songs, but I've seen games do some really odd things before).
Another side issue here is with MIDI itself. In General MIDI, track channel 10 (don't know why I said track) is designated as the percussion/drum channel, and defaults to using bank 128 where the standard drum set is. Music creation programs tend to let you easily change that, so it may not be an issue for generating flacs or mp3s, but people that play the MIDIs using the soundfont will have wrong or missing output for that channel (and unfortunately you may not be able to move it if a given song needs all 16 channels).
Incorrect notes -- Notes that have the wrong pitch or key could be due to the aforementioned detune or bend range parameters, if they were indeed lost when creating the soundfont. As for "00000052 00081BD8", I'm not actually sure if that's a problem, specifically. I could see that song as being something that plays in an options menu or when paused or something.
Problems with the soundfont -- I don't have much on this. I do intend to look into the soundfont eventually, to see if I can spot anything amiss in it.
No looping -- Yeah, this is not strictly possible, because of short-comings in the MIDI file spec. There's one or two non-standard ways to do looping, but in general they only loop all tracks at once (and generally at the end), while the original songs could do per-track nested looping with specific loop counts. There is actually one (non-standard) way you can do per-track looping, which is to use Apogee's EMIDI extensions that they used for their games in the mid 90s. But even that would require having a MIDI player that understands it.
All that said, I'm still going to keep looking into this. Something that kinda bugs me about the conversion is that it basically just copies the MIDI events verbatim, only handling special cases like the note-on delta time*, meta events, loop points, or the repetition marker (0xFE; never thought I could hate a hex value so much) to get something that resembles a proper MIDI stream. But there's very little checking on the stream, to see if there may be any non-standard controller changes which just get ignored in the playback, or if it may have even re-purposed some standard controllers.
Another thing is that AUDIO.bin has a non-negligible amount of non-sequence data interspersed with the sequence and track data. It may just be junk in unused sections of the file, but I don't know. Considering cartridge limitations and how far even the music goes to save space (MIDI like this is already small enough, but there's cases where the sequence data will use a 4-byte 0xFE repetition marker to "replay" a 6-byte segment), that it seems unbecoming of it to have so much junk in there. But I have a difficult time thinking of what it could be.
* Incidentally, the note-on delta time is something I've seen before in another MIDI-like format (HMI). Instead of having an explicit note-off event, the note-on event specifies how long until release.
|