How sound on the SNES works.
There is a device in the SNES. This device consists of an 8-bit CPU (Sony SPC700) and 64KB of RAM mounted on a circuit board. It's connected to the main board by a series of pins, and communication with it is carried out through one of four ports. Other than that, though, this device is completely separate physically and logically from the console.
The SPC700 runs at a whole 1.024MHz, has six internal registers, and can execute 256 opcodes. Obviously it's not as powerful as the computers of today, but in and of itself it's quite capable of performing many tasks. However, there are no input or display devices attached to it, so what good does it do us?
Well, the SPC700 does have a 16-bit DSP attached. This DSP functions much like the wave table sound cards today, capable of mixing 8 voices simultaneously at various pitch and volume. Programs can be written for the SPC700 that play music with the DSP just like people write programs for your PC that play music with your sound card.
The SNES' sound module consist of:|
(1) the sound engine: SPC700 8-bit CPU above and DSP unit below, both designed and manufactured by Sony
(2): 9112 32k SRAM manufactured by Sharp
(3): D6376 2 channel 16-bit DAC manufactured by NEC
(4): 9124 32k SRAM manufactured by Hitachi
(5): 2904 Dual Op-Amp manufactured by JRC
(6): I/O connector to the mainboard
This device was designed by Nintendo and manufactured by Mitsumi.
Knowing that background, it's easier to understand how the music on the SNES works. A composer at [some gaming company] puts together a happy little tune using a sequencer on a PC. He then gives this song to the game programmers. They in turn place this song, along with some graphics, data, and code into a game. Part of that code consists of a program written for the SPC700 that can play this song. Most likely when the game boots it uploads this program to the SPC's RAM. Then at intervals in the game different songs are uploaded and played by this program.
Here's where the problem arises. The format of this song could be anything from a standard MIDI file to a proprietary format devised by the gaming company. But that doesn't matter, because the game programmers wrote a program that can play this song. Well, it doesn't matter to the common gamer anyway. For those of us who actually listen to video game music (admit it, some game music is actually pretty good) this is a problem because we don't know to play these songs!
Keep that thought for a second while I switch topics. Imagine if you could freeze the current state of your PC, and save all of your RAM to disk. Later on your computer crashes, but rather than rebooting, you just load all that data back into memory. Now your computer is back where it was as if nothing had changed. (This option to save the state of the machine is actually utilized by some laptops as a way to conserve power when sleeping, but you're probably more familiar with emulators using it as a cheap way to save the game.)
Now, coming back, you're playing your favorite SNES game on your PC. You look down at the dusty SNES console on the floor and wonder if your friend still has the Chrono Trigger cart you let him borrow last year, but then your attention is suddenly turned back to the monitor as that kick ass theme starts playing. You want to save the music, so you dump it to the hard drive, and later play it in a loop a few hundred times (or maybe not that long) with SPCAmp.
How is this possible? The emulated SPC has in its RAM both the song and the program needed to play it. When you save the song, you're mearly freezing the state of the SPC, and saving all the memory to disk. It's still unknown what the song is and how to play it, but you now have the program that can interpret it. By means of an emulator you can load this small memory dump and continue playing the song. The program inside has no idea that it's not really inside an SNES, or that it was even stopped at any time.
Instruments have to be stored using BRR blocks in order to be utilized by the DSP. By looking for characteristics in the data that matches BRR compression methods we can find stored waveforms. But since there's no standard format for the music, we don't have anything to search for. This is why .SPC's can't be ripped from ROMs directly.
Written by Anti Resonance, extracted from the SPC Tool's ReadMe.html