A
1
Super Mario 64 Soundbank Thingy
2
3
I'm no coder but I can try my best to describe what's happening. Read the sound folder's README in "(PC port directory)/sound" before reading this.
4
5
Base Note
6
For those using modern DAW's, the base note (I.E Middle C) will be C5, as is the default for Anvil Studio and FL Studio. Any sample that is dumped from the port will play at it's base samplerate at the base note as any other audio player.
7
8
Soundbank
9
The current soundbank that is used will be displayed as "sample_bank" at the top of the JSON
10
11
Envelopes
12
Envelopes are the ADSR - Attack, Decay, Sustain, Release - for midi playback, with instruments being assigned to them. I have no idea what the parameters of the envelopes exactly do, but I bet it controls those 4 things. However I definitely know what the instruments do.
13
14
Instruments - Release Rate
15
Instruments have a release rate (release_rate), which affects the in-game reverb - essentially a delay effect. Percussion instruments typically have a rate of 10 - which is very little reverb - while sustaining instruments have rates that can go as high and above 200.
16
17
Instruments - Envelope
18
Instruments have an envelope to assign to, affecting their ADSR.
19
20
Instruments - Sound
21
Instruments have a sound assigned to them, which is picked from the soundbank sample's HEX ID's. Sometimes there are multiple samples per instrument (sound_hi, sound_lo), which are seperated as ranges (normal_range_lo, normal_range_hi)
22
23
Instruments - Range
24
These instruments have a range of 0 (A♯1) to ???. C5 starts at 39. The range parameters affect the "sound" sample's range before transitioning to "sound_hi" or "sound_lo", where the value given is the last key "sound" can play.
25
26
Instruments - Tuning
27
Rarely, there are tuning presents within these instruments. These will be enclosed in brackets and have a "tuning" parameter within a "sound", "sound_hi", or "sound_lo" parameter. The tuning offsets the pitch of instrument so that it's range is not reflective of it's pitch, but usually follows an equal temperment scale.
28
29
Tuning Formula
30
32,000 * Rate Multiplier, Where Rate Multiplier is the number that follows the tuning parameter. The game always sets the samplerate to the instrument that is tuned to the product of this formula at the base note, which is why the pitch offsets.
31
32
Percussion
33
The percussion channel filled with manually tuned and placed sounds. The entries listed from top to bottom will fill the channel from the bottom up, starting at A♯1. Pitch scaling does not apply here, meaning that the Tuning Formula is all that's needed to find the samplerate for that specific key. Most of the percussion instruments are equal tempered, meaning that they can be played directly on a piano roll. A few aren't, and have a weird tuning system. The "pan" parameter ranges from 1 - 128, with 128 being right most.
34
35
Calculating Rate Multiplier
36
Mainly for those replacing sounds in the game engine, but also DAW users not using completely different sounds. If the instrument you're replacing has a tuning present, and you want to use a HQ sound, calculate the rate multiplier with this: Divide your HQ sound's samplerate by the samplerate of the instrument you're replacing. Take that product and multiply by the tuning present of the instrument you're replacing. That is all you need to do, however just for pre-caution, make sure that the result of the Tuning Formula is a whole number. Do this by applying the Tuning Formula on the rate multiplier you got, and rounding that result. Then divide by 32,000, and use as your multiplier
37
38
Quirks about the soundbanks and engine
39
127600 hz is the approximate limit for the port's audio engine, which is an emulation of the N64's engine. This is why on the Instruments table there are columns for the highest note out of every song for each instrument, as this spreadsheet was created to work around that. 0C is an unused soundbank, which means SM64 was intended to use one more song, but never came. The instruments it was supposed to use were left behind. Interestingly, one guitar instrument is slightly changed, with Accoustic Guitar being able to play 1 step higher than normal. Possibly an error.