News: 11 March 2016 - Forum Rules

Author Topic: Can anyone help with SNES music?  (Read 3081 times)

rainbwsprinklez

  • Jr. Member
  • **
  • Posts: 46
  • Anything is possible :)
    • View Profile
Can anyone help with SNES music?
« on: February 06, 2020, 10:21:54 am »
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

  • Hero Member
  • *****
  • Posts: 2763
    • View Profile
Re: Can anyone help with SNES music?
« Reply #1 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.

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.

Quote
Is 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.

Quote
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?
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.
« Last Edit: February 06, 2020, 05:04:38 pm by Bregalad »

rainbwsprinklez

  • Jr. Member
  • **
  • Posts: 46
  • Anything is possible :)
    • View Profile
Re: Can anyone help with SNES music?
« Reply #2 on: February 06, 2020, 10:51:12 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*
« Last Edit: February 06, 2020, 11:09:14 pm by rainbwsprinklez »
Anything is possible :)

Raeven0

  • Jr. Member
  • **
  • Posts: 44
    • View Profile
Re: Can anyone help with SNES music?
« Reply #3 on: February 07, 2020, 01:34:15 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

  • Jr. Member
  • **
  • Posts: 46
  • Anything is possible :)
    • View Profile
Re: Can anyone help with SNES music?
« Reply #4 on: February 07, 2020, 07:11:54 am »
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
« Last Edit: February 07, 2020, 01:01:41 pm by rainbwsprinklez »
Anything is possible :)

Bregalad

  • Hero Member
  • *****
  • Posts: 2763
    • View Profile
Re: Can anyone help with SNES music?
« Reply #5 on: February 07, 2020, 12:13:42 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.

Quote
So 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.
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.

Quote
Also, 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

  • Jr. Member
  • **
  • Posts: 46
  • Anything is possible :)
    • View Profile
Re: Can anyone help with SNES music?
« Reply #6 on: February 07, 2020, 01:08:15 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 :)