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

Author Topic: How to extract sound effects? (Esp. TMNT1)  (Read 2110 times)

pinkpuff

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
How to extract sound effects? (Esp. TMNT1)
« on: December 15, 2015, 06:22:47 am »
I'm trying to acquire the sound effects from the first TMNT game for NES (the Ultra one).

I was unable to find any existing sound files that anyone else had already ripped so I tried my best to accomplish this on my own. I discovered that if you pause immediately after beating a "mini-boss" just as the victory music starts to play and let the music finish in the pause screen, when you unpause, it will still wait to start the regular stage music back up, during which time you can record the sound effects "manually" without the music playing in the background.

Unfortunately, this method can only go so far. There are some things it is difficult or may even be impossible to record in such a situation. For example, as the game does not allow the screen to scroll during this time, and it will not play the victory theme until all enemies on screen have been defeated, I don't think it's possible to record the "enemy damage" or "enemy destroyed" sounds this way. "Get item" would likely be extremely challenging as well. Not to mention any sound effects that are exclusive to the intro, cuscenes, and/or the overworld.

Is there any known method for extracting sound effects from an NES file in general, or any ideas for how to accomplish a similar result for this game in particular?

Thanks,
- PP
Let's dance!

dougeff

  • Sr. Member
  • ****
  • Posts: 359
    • View Profile
Re: How to extract sound effects? (Esp. TMNT1)
« Reply #1 on: December 15, 2015, 09:34:16 am »
Do you want to 1. record them (create a .WAV), or 2. get the code for the sound fx to use in another game?

1.If you know Rom hacking, you could change the BG music to silence, and then record the sound as you play the game.

2. Would require a disassembly of the music code.
nesdoug.com -- blog/tutorial on programming for the NES

pinkpuff

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: How to extract sound effects? (Esp. TMNT1)
« Reply #2 on: December 15, 2015, 04:20:40 pm »
I want to record them as WAV files or similar.

How do I accomplish #1?
Let's dance!

SunGodPortal

  • Hero Member
  • *****
  • Posts: 2915
  • 2 + 2 = 5
    • View Profile
Re: How to extract sound effects? (Esp. TMNT1)
« Reply #3 on: December 15, 2015, 06:42:50 pm »
Many times an NSF archive will have the SFX too (usually either before or after the music tracks). Not sure if the TMNT one does or not. If it did, I'd rip them with Winamp.

http://www.zophar.net/music/nsf.html

EDIT:
Okay, I checked and the available NSF file for TMNT does NOT have the SFX.

Either way, here's an easy way if the SFX are in the NSF file:
1) load NSF file into Winamp
2) find the track with the SFX you want to dump
3) switch on the "Disc Writer" output plugin
4) press play

Done.
« Last Edit: December 15, 2015, 09:54:13 pm by SunGodPortal »
War is Peace. Freedom is Slavery. Ignorance is Strength.

mz

  • Sr. Member
  • ****
  • Posts: 326
    • View Profile
Re: How to extract sound effects? (Esp. TMNT1)
« Reply #4 on: December 15, 2015, 06:46:43 pm »
How do I accomplish #1?
This is the easiest way:
1. Open RAM Search in FCEUX or any cheat search functionality in any other emulator.
2. Make the game play any music or silence.
3. Start search.
4. Make the game change the music or silence to something different than before.
5. Continue search for *modified* values.
6. Repeat steps 4 and 5 until you're left with very few RAM addresses.
7. Create a cheat to modify that RAM address to the value of silence (usually 0).
There has to be a better life.

optomon

  • Full Member
  • ***
  • Posts: 246
  • Rite of Spring
    • View Profile
Re: How to extract sound effects? (Esp. TMNT1)
« Reply #5 on: December 15, 2015, 09:48:34 pm »
Should be able to add sound effects to the nsf file by hacking it slightly knowing that it is a Konkani game. I know that the fceux records . WAV files from the emulator.

Chpexo

  • Hero Member
  • *****
  • Posts: 731
    • View Profile
.
« Reply #6 on: December 16, 2015, 07:01:35 pm »
.
« Last Edit: January 01, 2016, 11:44:27 am by Chpexo »

Disch

  • Hero Member
  • *****
  • Posts: 2583
  • NES Junkie
    • View Profile
Re: How to extract sound effects? (Esp. TMNT1)
« Reply #7 on: December 17, 2015, 11:40:20 am »
I'm disappointed that not all NSF files contain sound effects. [snip] If anyone wants to point me to a comprehensive guide about NSF...

Whether or not the sfx can be included in the NSF often depends on how they are programmed into the game.

NSFs operate on some basic assumptions:
- Each track is prepped by an "Init routine" which does some rudimentary setup
- A "Play routine" is called every frame to advance the logic and playback the song

This works well for music because that's how virtually all music engines operate.  The init routine will either prep some pointers, or set some internal flag which tells the music driver to load a new song.  Then the play routine will run the music driver to step through the score and play back the actual song.

Some (but not all) music drivers embed sfx capabilities into the driver.... so that sfx are played back the same way music is.  For those games, sfx can be easily included in the NSF because they're treated just like any other song.

Other games (FF1 is an example), don't have sfx in the music driver, and instead have multiple different playback routines for sfx (often in different banks).  Some sfx playback is even hardcoded in game logic!  So if you want to try to include those in an NSF rip, you'd have to rip several different playback mechanisms, and write a chunk of custom code to "fork" init and play logic to choose the correct mechanism for the selected track.

It's more difficult than it might seem... since it requires a pretty solid understanding of where all the data is in the ROM.  Rippers generally don't have to delve that deep into the ROM or get that much of an understanding of the underlying engine.  They just have to find the play routine and extract it --- which can often by found easily by doing a stack trace from an APU register write.

In FF1's case... some of the sfx aren't even updated every frame... but are paused for it to complete animations.  So if you just pull out the sfx engine and play it back normally, the sfx will not sound how it does in-game.


So yeah... sfx in NSFs is a can of worms.  It's not that the rippers were lazy and didn't include them... it's that sometimes it just isn't practical to include them.


As for comprehensive guides on NSFs.... the format itself is pretty basic:

http://wiki.nesdev.com/w/index.php/NSF


Aside from what I just mentioned above and the ref page describing the format, I'm not sure what else you'd need to know... but if you have further questions I'd be happy to answer them.

Chpexo

  • Hero Member
  • *****
  • Posts: 731
    • View Profile
.
« Reply #8 on: December 18, 2015, 02:46:53 am »
.
« Last Edit: January 01, 2016, 11:44:17 am by Chpexo »

pinkpuff

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: How to extract sound effects? (Esp. TMNT1)
« Reply #9 on: December 18, 2015, 06:12:41 am »
This is the easiest way:
1. Open RAM Search in FCEUX or any cheat search functionality in any other emulator.
2. Make the game play any music or silence.
3. Start search.
4. Make the game change the music or silence to something different than before.
5. Continue search for *modified* values.
6. Repeat steps 4 and 5 until you're left with very few RAM addresses.
7. Create a cheat to modify that RAM address to the value of silence (usually 0).

When I tried this I couldn't quite get an address that corresponded to the track that was playing. Maybe I'm doing it wrong?

EDIT:
Pfft. Nevermind, I was doing it wrong. I found it. 10A, 10B, 10C, and 10D. Froze those at 0, boom. Music gone, sound effects intact.
Thanks everyone for your help!!
« Last Edit: December 18, 2015, 06:19:53 am by pinkpuff »
Let's dance!