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

Author Topic: Zelda 1 sound effects  (Read 3449 times)

gzip

  • RHDN Patreon Supporter!
  • Jr. Member
  • *****
  • Posts: 19
    • View Profile
Zelda 1 sound effects
« on: March 28, 2020, 08:13:50 pm »
I've been looking through Trax's bank 0 disassembly and this line caught my eye:

Code: [Select]
185B: Table for ? (6E bytes)
Here's what I found so far (these are ROM locations):

Code: [Select]
186B    shield sound pointer
186C    boomerang stun pointer
186D    rod sound pointer
186E    pick up heart pointer
186F    dialog sound pointer
1870    bomb placement pointer
1871    low hearts pointer

1872    low hearts sound
1887    shield sound
1892    rod sound
18B1    dialog sound (also affects arrow chirp)
18B7 boomerang stun sound
18C7    pick up heart sound
18D2    bomb placement sound

So this is a table for some of the sound effects as listed above. For example, the table starts at $186B with the byte $1C. Add the offset to the table start address to get the sound location ($186B + $1C = $1887). The offset for bomb placement is $67 so the sound starts at $18D2 ($186B + $67 = $18D2).

I also found the following sounds using the technique outlined later in this thread. I'm not sure where the corresponding table is located.

Code: [Select]
1F09-1F0E    stairs sound
1FC2-1FCB    sword swoosh sound
1FCC-1FD0    boomerang swish sound
1FD1-1FE0    fire sound
1A4D-1A64    bomb explosion sound

« Last Edit: April 18, 2020, 11:54:07 pm by gzip »

bogaabogaa

  • Full Member
  • ***
  • Posts: 149
    • View Profile
Re: Zelda 1 sound effects
« Reply #1 on: March 31, 2020, 05:12:13 am »
I guess you talk of the PRG ROM offset. Also impotent seems the ROM dump you are working. Like legend of Zelda US PRG1..

Music pointer seem to be described here: http://datacrystal.romhacking.net/wiki/The_Legend_of_Zelda:Music_Pointers

Also you seem to have found a table with some values representing sound effects. If you change them some actions have different sounds. Not sure if all actions are represented in that table. I am sure you could list and name sound effects from value $00-$ff with some try and error. May be make your findings public.
CV ROM DiscordServer
https://discord.gg/PvFgxRg

gzip

  • RHDN Patreon Supporter!
  • Jr. Member
  • *****
  • Posts: 19
    • View Profile
Re: Zelda 1 sound effects
« Reply #2 on: April 01, 2020, 12:35:42 am »
This is the US PRG0 version. The music pointers on datacrystal are in the same file I linked to, first thing.

I believe the sound effects I listed are all that are in this particular table (since code starts up right after). I may poke around the other unknown tables to see if I can locate more sound effects like sword slash, boomerang swoosh, etc. Maybe Trax can update his text file and/or I can create another page on datacrystal.

Please speak up if anyone has any further insight or if they get curious and hack the sounds as well. I'd also be interested if there are any tools that make it easier to edit the music.

Dracula X

  • Full Member
  • ***
  • Posts: 121
    • View Profile
    • My YouTube Page for ROM hacking
Re: Zelda 1 sound effects
« Reply #3 on: April 01, 2020, 04:44:38 pm »
FCEUX or Mesen Code/Data/Logger should help you find sound effects. The blue color in hex is what you need to look for in Hex Editor in ROM mode. Log the sound that you're looking for until it's finished. Once it's finished, look for it in the Hex Editor in ROM mode. NSF is much easier. Try to search for that hex number that you found in a real hex editor in the ROM file. If you didn't get the whole file, start the sound over and you should get all the data for that sound.
« Last Edit: April 02, 2020, 03:35:06 pm by Dracula X »
I might go back to Thunder Force II hacking again.

gzip

  • RHDN Patreon Supporter!
  • Jr. Member
  • *****
  • Posts: 19
    • View Profile
Re: Zelda 1 sound effects
« Reply #4 on: April 03, 2020, 02:43:08 am »
Thanks DX, that was very useful. I was able to find several more sound effects, all of which are using the noise channel. I've added the data to the original post. Here's what I did in case anyone wants to reproduce:

1) Open your Zelda nsf file in FCEUX
2) Locate the sound you want
3) Open the Code/Data Logger (under the Debug menu) and start it
4) Play only the sound you are interested in
5) Open the Hex Editor (also under Debug) and select View > ROM File
6) Locate the bytes highlighted in blue (that's your sound data, hack away)
7) Go back to the Logger, press Reset Log, and repeat steps 2-6 for other sounds

Note that the offsets in step 6 are identical to the game offsets. (I've read that nsf is basically just a pared down version of the game, but I didn't realize the sounds would be in the exact same locations.)

Dracula X

  • Full Member
  • ***
  • Posts: 121
    • View Profile
    • My YouTube Page for ROM hacking
Re: Zelda 1 sound effects
« Reply #5 on: April 03, 2020, 10:55:34 am »
You're welcome! In Mesen CDL, you can see that in action in the Hex Editor.
I might go back to Thunder Force II hacking again.

gzip

  • RHDN Patreon Supporter!
  • Jr. Member
  • *****
  • Posts: 19
    • View Profile
Re: Zelda 1 sound effects
« Reply #6 on: April 05, 2020, 08:30:23 pm »
The Data Logger also uncovered several sounds in PCM. These include things like the flying sword, link damage, dungeon door slam, boss sounds, etc.

I've successfully edited these PCM sounds using the following workflow:

1) Locate the audio in-game using the steps in the post above (nsf locations are different for these)
2) Copy the PCM hex data (highlighted in cyan) and save it into a file (e.g. sword.pcm)
3) Use dpcmc to convert it to a WAV file (e.g. dpcmc -f sword.pcm)
4) Edit the resulting WAV file in Audacity
5) Export the audio as Unsigned 8-bit WAV (File > Export Audio....; Save as type: Other uncompressed files)
6) Convert the sound back using dpcmc (e.g. dpcmc sword_8bit.wav)
7) Open the resulting file in your hex editor and copy/paste the data back into the ROM

bogaabogaa

  • Full Member
  • ***
  • Posts: 149
    • View Profile
Re: Zelda 1 sound effects
« Reply #7 on: April 08, 2020, 01:37:38 pm »
You can also do breakpoints for writes to CPU BUS $600-$604. When you use Mesen you do a condition like A>=$01. Probably most sounds will be stored with Accumulator. Like this you can find all the sounds and music triggers also the hard coded once.
When this is what you are looking for.
CV ROM DiscordServer
https://discord.gg/PvFgxRg

gzip

  • RHDN Patreon Supporter!
  • Jr. Member
  • *****
  • Posts: 19
    • View Profile
Re: Zelda 1 sound effects
« Reply #8 on: April 19, 2020, 12:31:23 am »
I've updated the original post with more accurate information and created a page on Data Crystal.