News:

11 March 2016 - Forum Rules

Main Menu

Can anyone help with SNES music?

Started by rainbwsprinklez, February 06, 2020, 10:21:54 AM

Previous topic - Next topic

rainbwsprinklez

My main is DKC. It SEEMS that instruments are loaded separately from track. This makes sense. Is there a method other than port 0x2140-2143 these instruments are loaded from the cpu to the apu? Or are they transmitted via the same port? The latter seems true. Also, is it true that DKC is much more complicated than, say SMW? I can't wrap my head around that. The same APU is used. How are things different?
Anything is possible :)

Bregalad

#1
I have no idea how the DKC sound engine works *BUT* VGMtrans supports this game, which means loveemu successfully reverse-engineered the engine well enough to understand the music format of the game.

Quote from: rainbwsprinklez on February 06, 2020, 10:21:54 AM
My main is DKC. It SEEMS that instruments are loaded separately from track. This makes sense.
Indeed, most SNES games released in the second 2 thirds of the console's lifetime does this. The SPC700 has only RAM for very few instruments stored simultaneously, so switching them dynamically is the only way to have quality music.

QuoteIs there a method other than port 0x2140-2143 these instruments are loaded from the cpu to the apu?
No, those 4 registers is the only mean of communication possible to load data in the SPC700 RAM.

QuoteAlso, is it true that DKC is much more complicated than, say SMW? I can't wrap my head around that. The same APU is used. How are things different?
Yes it's true. Early SNES games (released in the first ~1/3 of the console's lifetime) tend to load instruments only at boot, and never touch them again. This has many advantages, all instruments of the game are available at all times for music and SFX, but sound quality is very limited.

Also early Nintendo games (like SMW and Zelda 3) not only have instruments of the whole game, but also music of the whole game loaded at once on boot! This takes up a lot of RAM, and as such the quality of instruments is even more restricted. The only advantage of this is the speed of changing the BGM which can be done super-fast by a simple write to $2140-$2143 registers.

rainbwsprinklez

#2
Quote from: Bregalad on February 06, 2020, 04:57:47 PM
I have no idea how the DKC sound engine works *BUT* VGMtrans supports this game, which means loveemu successfully reverse-engineered the engine well enough to understand the music format of the game.

Thank you, Bregalad, for that detailed response! I'm having trouble with vgmtrans.exe... am I doing something wrong? I'm loading a rom. Should I load a rom for an spc file

February 06, 2020, 11:09:14 PM - (Auto Merged - Double Posts are not allowed before 7 days.)

or*
Anything is possible :)

Raeven0

Quote from: rainbwsprinklez on February 06, 2020, 10:21:54 AM
Also, is it true that DKC is much more complicated than, say SMW? I can't wrap my head around that. The same APU is used. How are things different?

The SPC700 is a quaint beast. It's a rough imitation of the NES CPU that happens to be connected to a signal processor, and comes equipped with a bare minimum program for moving data between the SNES CPU and itself. So you have to write your own sound engine, in the form of an autonomous program run on a ~1MHz 8-bit processor, and as with all autonomous programs of any complexity there are many possible approaches, with advantages and disadvantages, as well as many levels of technical competence.

rainbwsprinklez

#4
Guys, here is my thinking. Am I off base? There are only ever 8 audio tracks being played at once. Since the track does not include the instruments, the track holds index numbers. So at this time, play instrument 0 at this pitch for this long.

Also, how is ordering done? Is every track done fully at once? Or is each frame done with each instrument? That seems more likely.


February 07, 2020, 07:34:16 AM - (Auto Merged - Double Posts are not allowed before 7 days.)

Changing the SPC track, I notice sound effects are affected too. So, how is that configured into the track? o.o I think I have bitten off more than I can chew here...

AHHHHHHHHHHHHHHHHHHHHH
TPQN! That explains so much! http://loveemu.hatenablog.com/entry/20130819/SNES_Rare_Music_Spec
Anything is possible :)

Bregalad

Quote from: rainbwsprinklez on February 06, 2020, 10:51:12 PM
I'm loading a rom. Should I load a rom for an spc file
I'm fairly confident you're supposed to load an SPC file. This tool is basically a mega-collection of similar tools for lots of different games and different systems though, so it might depend on the game/system whether you should load the full ROM or just the music file.

QuoteSo you have to write your own sound engine, [...]
For homebrew, indeed, but if you're hacking an existing game you don't have to write anything at all and just use what's already there... I guess.
Quote from: rainbwsprinklez on February 07, 2020, 07:11:54 AM
There are only ever 8 audio tracks being played at once. Since the track does not include the instruments, the track holds index numbers. So at this time, play instrument 0 at this pitch for this long.
Sorry but I don't understand your question, at all.

QuoteAlso, how is ordering done? Is every track done fully at once? Or is each frame done with each instrument? That seems more likely.
For DKC I have no idea, I only know the inner working details for Squaresoft games (sound engines by Minoru Akao). They have each track being storen separate, and they're a list of bytes representing various commands such as "set octave", "set instrument", and so on, an a suite of notes which combines the note and the length in a single byte.

They just set which instrument index to use, regardless of what's actually loaded in the instrument table and the RAM itself. The part where the instrument table and RAM is re-loaded with new instruments is done before playing a song.

rainbwsprinklez

Quote from: Bregalad on February 07, 2020, 12:13:42 PM
Sorry but I don't understand your question, at all.

They just set which instrument index to use, regardless of what's actually loaded in the instrument table and the RAM itself. The part where the instrument table and RAM is re-loaded with new instruments is done before playing a song.

The latter part confirms my suspicions! I tend to think strangely and I have to understand things in my own way, so sometimes I make no sense.  :laugh: Thank you though! Doing research now on loveemus documents! http://loveemu.hatenablog.com/entry/20130819/SNES_Rare_Music_Spec
Anything is possible :)