News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: SNES sound samples  (Read 7233 times)

SunGodPortal

  • Hero Member
  • *****
  • Posts: 2921
  • 2 + 2 = 5
    • View Profile
SNES sound samples
« on: November 28, 2014, 12:13:41 am »
Anybody here know much about how to replace the instrument samples in a SNES ROM? Most of the docs and utilities I've seen collectively cover every aspect of SNES sound except for this.
War is Peace. Freedom is Slavery. Ignorance is Strength.

Jorpho

  • Hero Member
  • *****
  • Posts: 4193
  • The cat screams with the voice of a man.
    • View Profile
Re: SNES sound samples
« Reply #1 on: November 28, 2014, 01:40:50 am »
That's probably because there's no consistent way of doing it that can be applied universally.  You'd probably have to hack apart the game's sound engine to do it.

You probably already know about replacing BRR data.
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

SunGodPortal

  • Hero Member
  • *****
  • Posts: 2921
  • 2 + 2 = 5
    • View Profile
Re: SNES sound samples
« Reply #2 on: November 28, 2014, 07:00:23 pm »
It sounds like I'll soon have access to all of the game specific data I will need regarding the sound engine *fingers crossed* and I know how to get all the BRR samples I'm looking for but I don't know anything about how to insert them. This might be a long shot, but if a sample is the same size as what I want to replace, couldn't I just open my ripped sample into a hex editor, copy the data and then paste it over what I want to replace (assuming that I know exactly where it is)?
War is Peace. Freedom is Slavery. Ignorance is Strength.

justin3009

  • Hero Member
  • *****
  • Posts: 1617
  • Welp
    • View Profile
Re: SNES sound samples
« Reply #3 on: November 28, 2014, 07:19:39 pm »
That's basically exactly what you do actually.  As long as your sound sample is converted back to a .brr and it's the same size, you can just slap it over the old data.
'We have to find some way to incorporate the general civilians in the plot.'

'We'll kill off children in the Juuban district with an infection where they cough up blood and are found hanging themselves from cherry blossom trees.'

SunGodPortal

  • Hero Member
  • *****
  • Posts: 2921
  • 2 + 2 = 5
    • View Profile
Re: SNES sound samples
« Reply #4 on: November 28, 2014, 07:23:17 pm »
Awesome. That's pretty much the only step that I dreaded because I was expecting something MUCH more complicated.
War is Peace. Freedom is Slavery. Ignorance is Strength.

JCE3000GT

  • Sr. Member
  • ****
  • Posts: 433
    • View Profile
Re: SNES sound samples
« Reply #5 on: November 28, 2014, 11:11:59 pm »
Keep in mind some games like for example Final Fantasy 6/3us have data that specifies loop points.  This means the game manages the sample loop points itself.  This of course is a moot point if you are replacing percussion or other samples that do not loop.  What game or games are you intetested in replacing the instrument samples for?

That's basically exactly what you do actually.  As long as your sound sample is converted back to a .brr and it's the same size, you can just slap it over the old data.

Don't forget that some games (especially Square games) will have a pointer to both BRRs and the SPC sequences so you can use larger BRRs if the game's pointers can be altered to an empty block of data in the ROM file.  Eh, that was a long sentence...


SunGodPortal

  • Hero Member
  • *****
  • Posts: 2921
  • 2 + 2 = 5
    • View Profile
Re: SNES sound samples
« Reply #6 on: November 29, 2014, 01:03:47 am »
I'm working with Final Fantasy IV.

True, I was wondering how much the the loop point and pointer issues would come into play.

First, I feel it should be noted that I don't intend to use ANY of the game's original music. It may be worth noting that my game won't be nearly as long and will probably have around 20 pieces of music instead of 50-something.

Second, how much I intend to do with the instrument samples probably depends on the level of hassle it ends up being, though I don't expect it to be easy (programming the music certainly won't be given there is no editor for it). There are a few instruments like the marimba/xylophone and whistle that are of absolutely no use to me since my music will have more of a gothic-baroque-rock vibe. Others, like the strings and organ ARE useful but if I can swap them out for better ones I'd like to. At minimum I'd like to upgrade the drums (maybe from Chrono Trigger) and replace the useless samples with ones that I need like a harpsichord (assuming I can find one) and maybe extra strings or organs for variety/added texture.
War is Peace. Freedom is Slavery. Ignorance is Strength.

Madsiur

  • RHDN Patreon Supporter!
  • Full Member
  • *****
  • Posts: 174
  • FF6 hacker
    • View Profile
Re: SNES sound samples
« Reply #7 on: November 29, 2014, 09:22:49 am »
RS3 has some really good samples. I made a patch that add most of RS3 samples, as well as some FF4 and FF5 samples into FF6. Those samples were ripped by Tsushiy, who used them for his FF6T-Edition hack. You could always apply the patch to FF6 and then copy the brr data you need into your hack. Here's the link: http://www.ff6hacking.com/forums/showthread.php?tid=2558

Bregalad

  • Hero Member
  • *****
  • Posts: 2649
    • View Profile
Re: SNES sound samples
« Reply #8 on: November 29, 2014, 10:26:34 am »
In the SPC memory, the sample table is at $1f00, and contains both starting point and loops pointers. The pitch adjustment table is at $ff00, and is a byte per sample, but for samples used in music it starts at $ff40, since the samples for music starts at $40.

As for where those are stored in the game I have absolutely no idea but it should be simple to spot writes to these memory locations in the code.

Quote
Keep in mind some games like for example Final Fantasy 6/3us have data that specifies loop points.  This means the game manages the sample loop points itself.
No, this is hard-coded in the SPC hardware so all SNES games will work like that.

SunGodPortal

  • Hero Member
  • *****
  • Posts: 2921
  • 2 + 2 = 5
    • View Profile
Re: SNES sound samples
« Reply #9 on: November 29, 2014, 06:31:22 pm »
So far all the samples I've chosen came from Treasure of the Rudra's (Rudra no Hihou), also by Square. I'm still looking for a harpsichord though... :( I know I at least like the hi-hat sound from FFIV, but that's only one sound. I've been using Snessor '95 to rip them but I'm not really satisfied with that method. It seems kind of pointless to rip them as wav and then have to convert them back to brr. Some of the other programs I tried just didn't seem to work with my comp tho. Still, how many of these I intend to use will depend on how much of a nightmare it ends up being to insert them into the FFIV ROM.
War is Peace. Freedom is Slavery. Ignorance is Strength.

JCE3000GT

  • Sr. Member
  • ****
  • Posts: 433
    • View Profile
Re: SNES sound samples
« Reply #10 on: November 29, 2014, 11:10:50 pm »
I'm working with Final Fantasy IV.

True, I was wondering how much the the loop point and pointer issues would come into play.

First, I feel it should be noted that I don't intend to use ANY of the game's original music. It may be worth noting that my game won't be nearly as long and will probably have around 20 pieces of music instead of 50-something.

Second, how much I intend to do with the instrument samples probably depends on the level of hassle it ends up being, though I don't expect it to be easy (programming the music certainly won't be given there is no editor for it). There are a few instruments like the marimba/xylophone and whistle that are of absolutely no use to me since my music will have more of a gothic-baroque-rock vibe. Others, like the strings and organ ARE useful but if I can swap them out for better ones I'd like to. At minimum I'd like to upgrade the drums (maybe from Chrono Trigger) and replace the useless samples with ones that I need like a harpsichord (assuming I can find one) and maybe extra strings or organs for variety/added texture.

I was able to locate pretty much everything except the sample loop points.  Though you can run a quick test by repointing a sample to a large empty block and importing another BRR to see if the BRR loops (if imported from another ROM). You might be able to run a trace to see if you can locate where it's stored in the ROM.  Just an idea.

If you haven't yet located the SPC sequence and BRR pointers/offsets please see below.  Sorry, I stopped mapping the offsets for the last few BRR samples.  I'm still looking through my notes on the pointer data.

Instrument sample indexes for SPC sequences [NO HEADER]: $2400E (32 bytes each, 2304 total bytes)

$239C8 are a set of pointers but I don't have my old notes in front of me to know if they are for the SPCs or BRRs...or both.  My backup was on Slick Productions but they are under construction now.  Perhaps someone here has that data saved somewhere. 

Code: [Select]
[no header]

3770E: Nothing [00]
37727: Final Fantasy [01]
37AE8: Wishing Tower [02]
37BE6: Fanfare (Dummy) [03]
37D0F: Yellow Chocobo [04]
3804A: Black Chocobo [05]
3830C: Underworld [06]
38871: Zeromus [07]
393E4: Victory Fanfare [08]
3963C: Town [09]
39837: Rydia [0A]
39C1C: Boss Music [0B]
3A435: Mt. Ordeals [0C]
3A7D0: Overworld [0D]
3ABDB: Big Whale [0E]
3B092: Sad Music [0F]

3B1FA: Tent/Cabin [10]
3B2BC: Golbez [11]
3B5A3: Sorrow [12]
3B785: Rosa [13]
3BAF5: Baron Castle [14]
3BDAF: The Prelude [15]
3C361: Suspicions [16]
3C503: Tower of Zot [17]
3C8CE: Airship [18]
3CC15: Tower of Bab-il [19]
3CFA3: Fight 2 [1A]
3D463: Within the Giant [1B]
3D8AD: Cave of Summoned Monsters [1C]
3DAEA: Destruction [1D]
3DD10: Lunar Path [1E]
3DF4D: Surprise! [1F]

3E043: Dwarf Castle [20]
3E255: Palom/Porom [21]
3E508: Calcobrena [22]
3E6A7: Hurry! [23]
3E8F7: Cid [24]
3EC78: Into the Darkness [25]
3F13A: Dancing Music [26]
3F411: Fight 1 [27]
3F8D4: Castle Eblan [28]
3FAE4: Character Joined! [29]
3FBFF: Character Died [2A]
3FCE3: Chocobo Forest [2B]
3FDC7: Opening [2C]
40139: Sad 2 [2D]
40227: Castle Fabul [2E]
40435: Fanfare (Became a Paladin) [2F]

40666: Lard Ass Chocobo [30]
407A2: Moon's Surface [31]
40A84: Toroia [32]
40E4C: Mysidia [33]
41163: Lunar Subterrane [34]
41462: Ending Part 1 [35]
41F76: Ending Part 2 [36]
42E5C: Ending Part 3 [37]

Code: [Select]
$2498A: Strings
$2612C: Harp?
$2623C: Grand Piano
$26544: Harp
$28877: Pipe Organ
$293B9: Trumpet
$2956B: Flute
$296F0: Xylophone
$2B5BE: Bass Guitar
$2BBA8: Timpani
$2DEDB: Electric Piano
$2F3D1: Snare Drum 1
$30339: Kick Drum
$3088A: Snare Drum 2
$31B40: Conga Drum
$32DF6: Cymbals (loop)
$340FD: Hihat
$00000: Cowbell
$00000: Shaker
$00000: Whistle
$00000: Conga Drum
$00000: Chocobo
« Last Edit: November 29, 2014, 11:29:04 pm by JCE3000GT »

JCE3000GT

  • Sr. Member
  • ****
  • Posts: 433
    • View Profile
Re: SNES sound samples
« Reply #11 on: December 07, 2014, 12:13:20 am »
Ok, Slick Productions is back up so here's a link to the info. 

http://slickproductions.org/forum/index.php?topic=163.0

Bahamut ZERO

  • Hero Member
  • *****
  • Posts: 906
    • View Profile
Re: SNES sound samples
« Reply #12 on: August 24, 2015, 03:39:42 pm »
Although it's been awhile since this thread was made, I figured I'd go ahead and ask this:

I've been playing around with switching instruments in some of the songs for my FF4 project, and some of the instruments just sound god awful, particularly the instrument named "Chocobo" (the rape whistle noise heard constantly when riding a black chocobo). Currently there's a small handful of intruments I consider expendable.

I've been also reading up on the SPC and BRR Samples, though none of the sources I've come across mention BRR Samples for more than a sentence (if even that). Which brings me to ask:

-Are BRRs in a game generally differing sizes from one another, or do they have set data space per instrument?-

I had a second question but I notice JCE's above reply has a majority of the instrument samples mapped out better than on the Slick page with FF4's SPC info.  Talk about a day maker!

Like Super Mario Land? Then you'll love my first completed Rom Hack: Maniac on the Run!

Bregalad

  • Hero Member
  • *****
  • Posts: 2649
    • View Profile
Re: SNES sound samples
« Reply #13 on: August 24, 2015, 04:24:00 pm »
Quote
Are BRRs in a game generally differing sizes from one another
Of course they differ in size. The S-DSP will continue decompressing samples until bit[0] of the header byte is set. Then the sample playback will either stop (if bit[1] is clear) or loop (if bit[1] is set).

As for the instrument you're talking about, it sounds just as awful than a real whistle I guess. You can't blame the SPC or FF4 for that.

Dr. Floppy

  • Restricted Access
  • Hero Member
  • *
  • Posts: 972
  • Make America GREAT Again!
    • View Profile
    • BaddestHacks.net
Re: SNES sound samples
« Reply #14 on: August 25, 2015, 02:01:29 am »
PM Rotwang if you want to know about SNES sound samples. He's the undisputed master of the art!

Bahamut ZERO

  • Hero Member
  • *****
  • Posts: 906
    • View Profile
Re: SNES sound samples
« Reply #15 on: August 29, 2015, 03:54:25 pm »
Of course they differ in size. The S-DSP will continue decompressing samples until bit[0] of the header byte is set. Then the sample playback will either stop (if bit[1] is clear) or loop (if bit[1] is set).


Ah, okay!


Quote
As for the instrument you're talking about, it sounds just as awful than a real whistle I guess. You can't blame the SPC or FF4 for that.


I wasn't  blaming FF4 or the SPC for why I can't stand the whistle.  I just don't have a use for it since I plan on changing the Black Chocobo song.


PM Rotwang if you want to know about SNES sound samples. He's the undisputed master of the art!

Will do!





Like Super Mario Land? Then you'll love my first completed Rom Hack: Maniac on the Run!

Bahamut ZERO

  • Hero Member
  • *****
  • Posts: 906
    • View Profile
Re: SNES sound samples
« Reply #16 on: September 11, 2015, 03:19:58 pm »
Haven't recieved a message back yet (hopefully my slow interwebs didn't botch things up in the sending process), but in the meantime I've been playing around with what instruments are played in different songs.  Ironically enough, I found that the Chocobo whistle works very well for the star-streaking sound heard during the Moon Overworld song. :)


I also decided to mess around and plug the BRR offsets into a hex calculator to get some sort of grasp on the size of the BRR samples themselves. Not exactly sure if it's an accurate way of figuring that out, but for those who are curious I have them listed below.  Instrument names follow the terminology of Chillyfeez's FFIV Music Hacking Guide, other then the fact I renamed "Whistle" to "Ocarina" and  "Chocobo" to "Whistle".

Also, only 01 - 10 have their offset differences recorded as of now, as not all of the offsets are known (so I have no offset to subtract 11's offset from)


Code: [Select]
##   Offset     Name                Hex Difference           

01   $2498A:  Strings (Bowed)            17A2
02   $2612C:  Strings (Plucked)           110
03   $2623C:  Grand Piano                 308
04   $26544:  Edward's Harp              2333
05   $28877:  Organ                             B42
06   $293B9:  Trumpet                           1B2
07   $2956B:  Flute                             185
08   $296F0:  Xylophone                    1ECE
09   $2B5BE:  Bass Guitar                   5EA
0A   $2BBA8:  Timpani                      2333
0B   $2DEDB:  Electric Piano               14F6 
0C   $2F3D1:  Snare Drum (Low)             F68
0D   $30339:  Kick Drum                     551
0E   $3088A:  Snare Drum (Hard)        12BC
0F   $31B40:  Conga Drum (Light)       12B6
10   $32DF6:  Cymbals (Crash)          1307
11   $340FD:  Hihat                                ?
12   $00000:  Cowbell                            ?
13   $00000:  Shaker                             ?
14   $00000:  Ocarina                            ?
15   $00000:  Conga Drum (Full)            ?
16   $00000:  Whistle                            ?



Now I just need to know a bit about BRR sample headers and I'll hopefully be good to go. Most importantly, the general size and location of them:

1: Are the headers generally located at the beginning of each BRR sample, or are they stored in a different index elsewhere?

2: Do they have a generally uniform size (8,16,32 bytes?) or do they vary from game to game?
Like Super Mario Land? Then you'll love my first completed Rom Hack: Maniac on the Run!