help changing n64 song lookup tables by Volkov73 at 2:57 AM EDT on May 2, 2024
Previously I was using seq64 to edit the music lookup-table for first-party games. It's essentially a table in the rom which has a list of all the locations and lengths of the sequences.

This meant I could have the menu music in Mario 64 be any song from the game. Now I am intending to do the exact same thing for non-first party games.

Can anyone tell me how I'd do this?

Starting with Goldeneye. The menu music is called "folders" (length '03e2' and offset '42812c')
I want to be able to have any other song from the game play, instead of the menu music.

I also intend to do this for other games later on. SubDrag tool lists the length and location of each sequence - but I cannot find any table where I would edit it so when the game reaches the main menu - it instead plays a different audio sequence.

Basically, how should I reliably find these tables in various games (if they even exist). Then I should be able to edit them accordingly

Thanks!

edited 3:07 AM EDT May 2, 2024
by Volkov73 at 7:33 AM EDT on May 2, 2024
Oh, there was also changing of the "instrument set" so yeh I'm not sure now.

My goal is to get clean audio recordings and having the tracks play on the menu screen made for convenient playing of every song in the game in a real setting (official hardware + edited rom).

I managed to do it on other games due to "sound menu" existing, but for Goldeneye there is no such thing. I tried to just start each level but then I get sound effects from the game so I can't record the music cleanly
by WDLmaster at 6:36 AM EDT on May 4, 2024
There's no reliable way to find offset lists. The database used by SubDrag's tools was assembled mostly by hand for each game individually, which basically took years to complete. In the tool's folder is a file called gameconfigmidi.ini which contains the start offsets for each list/song. BUT:

* Different games have different table formats
* Table and sequence data are not necessarily grouped together in ROM
* The table is compressed in some games
* The table might be in the first megabyte of ROM data in which case you need to recalculate the checksum in the ROM header or the game won't boot
* the table might be part of the code section instead of a separated chunk of data.

As for the instrument sets:

Not all formats have that information in the data. The original "compact MIDI" format ("S1") for instance can only have the soundbank changed by code. A later version ("S2") adds further information (like soundbank index) for each sequence in a separate table following the offset table.

The in-house format of Nintendo of Japan ("AudioSeq") has this information stored in a separate chunk along with all other offset tables. Unfortunately, the position of this chunk is inconsistent across different games and in some instances (Zelda) it's even compressed and part of a lager chunk of data. This version can have multiple soundbanks attached to a sequence.

Another widely used format is SNG but as far as is can tell this only has support for one soundbank. This is also the format which has no easily identifiable offset table. I have seen some games with a table but I think in most cases it's part of the code and thus mangled with other stuff.




edited 7:23 PM EDT May 4, 2024
by Volkov73 at 2:04 AM EDT on May 5, 2024
Perhaps there's is easier way to achieve this.

Would it be an easier task to do something else within each game to play specific audio tracks? Some games have a sound test menu so that's fine. Others might have a dev option gameshark code which might allow you to play a specific song. That's fine.

But for some games the only thing I can do is go to that area within the game. Sometimes this can generate other sfx from the game.

I have no problem editing the songs as I wish. But now I need to get audio recordings of it.

Any ideas?

edit: I guess one option is making .miniusf files for playback outside of the emulator, but this is a last ditch effort as I want them to play on console, and I also don't know about making usf

edited 4:27 AM EDT May 5, 2024
by WDLmaster at 5:25 AM EDT on May 5, 2024
The only alternative I can think of right now would be setting the instrument count for the SFX soundbank(s) to zero. This effectively "removes" all other sounds from the game. You still need to track down the offset table for SFX. But there are some games which share the same soundbank with SFX and music! In that case you have to edit the offset table by setting the specific instrument pointer to zero.
by Volkov73 at 8:59 AM EDT on May 5, 2024
I understand it's a lot of manual work, don't worry I am all for it.
How would one track down these values to null out?
by WDLmaster at 11:19 AM EDT on May 5, 2024
Depending on the game this can range from easy task to nearly impossible. The best cases are those that use the original standard soundbank format. You could use the gameconfigsound.ini from SubDrag's SoundTool to find the offset table(s). Each table starts with "B1" (0x4231) and is always 8-byte aligned. The next 2 bytes are the number of banks. There's no easy way to tell which bank is which (SFX or music).

Later games use the newer (but far worse!) audio engine that have their offset tables start with the text string "N64 PtrTablesV2" so they're easier to find.

edited 11:25 AM EDT May 5, 2024
by Volkov73 at 10:17 PM EST on January 15, 2025
Thank you WDLmaster, I did not know about this 'Sound Tool'
I ended up blanking a bunch of hex data around that location and was able to mute all the in game sfx, allowing me to cleanly record the edited versions of the music I made.

Hopefully it's this easy for the next game, which is the banjo games
by WDLmaster at 6:52 AM EST on January 16, 2025
This could be a problem, especially with Banjo Tooie because it has it's own "Pointer Table" version. SFX and Music instruments are in the same soundbank which makes isolating instruments much more complicated.
by Volkov73 at 2:35 AM EST on January 17, 2025
Maybe a way to set velocity data to 00 for the sfx only? I've never messed with instrument data before, usually I just 00 specific notes (highly time consuming) or 00 an entire channel in the sequence header (which works well unless it's channel 0, that seems to have the bpm info on it).
I was using midi tool output debug file to help reverse engineer this for a while, but it stopped making the txt files for some reason

I'll keep going with Goldeneye as I am currently making progress, and see about the banjo games next. They are desirable to get done in the end

edited 2:40 AM EST January 17, 2025

edited 2:52 AM EST January 17, 2025
by Volkov73 at 1:28 AM EST on January 23, 2025
hey WDL, just letting you know I tried the same thing on Banjo-Kazooie - using the sound list tool to find the CTL offset value and filling a large portion that area with '00' values

I booted up the game and about 2/3rd of the sfx are gone, but some are still there. I'll keep trying - but it was enough to get the first song done!

https://www.youtube.com/watch?v=EwcfMU1qOXc&ab_channel=VideogameBackingTracks
by Volkov73 at 2:57 AM EST on February 2, 2025
Hoping WDL comes back to read this, or someone else can shed some light

I'm trying mute some sfx in Banjo-Kazooie (so I can record the songs cleanly from real game)

For the Title Theme - I need to be able to mute the frog sfx and the 2nd sfx banjo makes (or both)
For the other four songs, the problem was due to the bubble sfx you get when near the water in-game

If I make the sequences play in another location, then some instruments dont play right/at all.

Any idea on how to mute these sounds?

Here's what I had done so far to get clean audio recordings:
find the Ctl offset (0xd846c0) and then I just null the values after this position
0xd846c8 to 0xd8679b i made '00', and then 2/3rds of the game sfx are muted with no side effects

I did 55 songs and I would love to be able to do the last 5 <3
by WDLmaster at 8:43 AM EST on February 2, 2025
First of all: the "proper" way to disable an entire soundbank is to set the count to zero instead of overwriting stuff with "00". The 2 bytes right after the "B1" (start of the soundbank) is the instrument count. Set those to "0000" to effectively make it an "empty" soundbank.

But the problem with this game is that SFX are also included in the instrument bank. The following instruments are SFX: 0, 15, 16, 26, 27, 31, 32, 33, 34, 35, 37, 38, 39, 41, 42, 43, 45, 46, 47, 50, 52, 57, 59, 61, (62), 65, 67, 69, (72), 75, 84 and 85.

You have to locate the list of instrument pointers and set each one to "00000000". Find the instrument bank first, then go 40532 bytes forward to land on the start of the instrument pointers. Each group of 4 bytes is one entry. Count "4 * instrument number" to reach the position you want to have "disabled" and set those 4 bytes to 0.


edited 8:44 AM EST February 2, 2025
by Volkov73 at 1:44 PM EST on February 2, 2025
This is for Banjo-Kazooie, right? How do I find the instrument bank? :')
by WDLmaster at 2:03 PM EST on February 2, 2025
Depends on the version of the ROM. I guess you have the US version, in which case the offset is 15351472 (the instrument pointers start at 15392004).

The offsets for each game can be found in "gameconfigmidi.ini" of the N64MidiTools by SubDrag.

And yes, this is for Banjo Kazooie. Banjo Tooie cannot be edited like this because the Soundbanks are compressed.
by Volkov73 at 7:32 PM EST on February 2, 2025
Thank you I will have a look tonight.

I tried messing with banjo tooie. Console crashes when changing note velocity to 00, however it works by 00 the channel pointer info at the start of the sequence, I'm able to temporarily mute each channel. I can record some song this way but there's that annoying slide whistle sfx every time you change area. In banjo kazooie I just stopped the slide note whistle notes from playing in the sequence. But strangely whenever I edit the whistle slide sequence file in banjo tooie (just a two note sequence with pitch bend data) any edits to this sequence cause crashes.

I'll keep messing around with it, but I'm just blanking and changing random data on the sequence bin and importing it back and see what happens. That's how I've managed to figure out everything else so far, but I might be stuck on banjo tooie
by Volkov73 at 4:30 AM EST on February 3, 2025
I went to 15392004 and found 00009418, changed it to 00000000 and game crashed during the intro, probably instead of playing that sound

Whatever I did earlier, blanking part of the ctl (14173896-14182314) has muted 95% of the sfx during the intro theme, only the frog sfx is still playing and banjo's second noise.

i'll keep poking around, but any help would be appreciated
by Volkov73 at 5:13 AM EST on February 3, 2025
Okay, so I completely overlooked that there was a second ctl set for Banjo-Kazooie, starting at 15351472

I did as earlier, and 00'd a massive chunk of data and the frog sfx stopped. By raw trial and error, I managed to deduce that going to location 15351604 - you will find bytes '7F7F' and changing that to '0000' made the frog sfx stop playing
Banjo's second sigh noise was muted by changing a nearby value at 15351524, from 7F7F to 0000 also

There's still hope to get the last few songs recorded after all <3

I might have to just guess a lot to mute the rest

edited 5:40 AM EST February 3, 2025

edited 6:39 AM EST February 3, 2025
by WDLmaster at 7:46 AM EST on February 3, 2025
Ok, I actually never thought about this solution. What you did there was setting the attack and decay volumes to zero. If it works – why not.

About the sliding whistle: try setting the channel pointer to zero (there's only one channel) instead of modifying the sequence by hand.

edited 7:59 AM EST February 3, 2025
by Volkov73 at 8:53 AM EST on February 3, 2025
Yes, it as funny I changed each 7F to 00 at first and noticed it was slightly quieter each time, but when changing both 7F's to 00, then it was silent, it makes total sense now that it was the AD settings.

As for your suggestion on Banjo-Tooie - simply exporting the whistle slide-up sequence .bin and importing it without any changes makes the game crash upon booting.
Changing the channel pointer to zero (at the start of the sequence data) has been a staple for me muting specific channels for a long time

Are you saying there's another way to edit the rom to prevent this sequence from playing? Is there a lookup table which points to each sequence and says how long it goes for or something else?

If I could stop this whistle slide up/down sounds, then its possible I can edit the Banjo-Tooie sequences and record a few songs, with a lot of effort - I'll keep trying!
by WDLmaster at 10:17 AM EST on February 3, 2025
I think the problem is not the edited MIDI itself but the re-importing of data. I never worked with those MIDI tools but if the newly imported data is longer (uncompressed?) it overwrites data of the next song.

Yes, there should be a "master offset table" for each file in the ROM. That list could also contain a flag or other value which tells the loader if a file is compressed or not. At least in theory it should be possible to relocate any file to the end of the ROM (and in uncompressed form) but I never tried such a thing.

What happens if you re-import a file that consists only of zeros? The minimum header size in this format is 8 bytes (4 bytes delta time per quarter note, 4 bytes channel count). 00000180 00000000 should be enough to qualify as "valid" file with zero channels.

If nothing helps you could also silence the ADPCM samples themselves. A huge chunk in the wavetable is SFX only. But as with Banjo Kazooie, some SFX is located between the instrument sounds.
by Volkov73 at 11:52 AM EST on February 3, 2025
cool that works

now i can do any songs that dont have sfx or require walking from the level entrance (footprint sounds)

if i could manually identify the sounds somehow i could go through and silence them?
by WDLmaster at 12:36 PM EST on February 3, 2025
Well, this will be super complicated, you'll love this :D

I just had a look at the ROM again and came to the conclusion that finding the offsets for each ADPCM sample is equally complicated as setting attack and decay volume for each sample to zero. The complicated part is figuring out which sample is SFX and which is not. At offset 27348454 starts a huge list with sample information. Each entry is 216 bytes long. There are 938 (!) entries in the list, referencing 827 samples.

As far as I can tell the first 150120 bytes are SFX only and can safely be filled with zeros. After that start the instruments. Bytes 14 and 15 of each list entry is the attack and decay volume for each instrument (it's actually keyzones, not instruments).

I have to take a deeper look into it, maybe there's a way to identify what is SFX.


Go to Page 0

Search this thread

Show all threads

Reply to this thread:

User Name Tags:

bold: [b]bold[/b]
italics: [i]italics[/i]
emphasis: [em]emphasis[/em]
underline: [u]underline[/u]
small: [small]small[/small]
Link: [url=http://www.google.com]Link[/url]

[img=https://www.hcs64.com/images/mm1.png]
Password
Subject
Message

HCS Forum Index
Halley's Comet Software
forum source