Jump to content
NHL'94 Forums

Editing music/sounds in NHL '94- a start


Asher413

Recommended Posts

Hi all,

This is mostly to capture my thinking, as I do hope to come back to this another day, but I cannot spend any more time listening to my computer play version of "Go fight win!"... And in case anyone else has started the work or has an interest, here's some information for you!

Objective:
Determine where/what the note pitches are in the NHL '94 code

Background: To be able to edit or add new music, somehow those bytes need to be translated out of code into music- then new pieces can be translated from music into code.
I'll start with "Go, Fight, Win!" (The song at offset 00184052 in DEC) Why?  It's first, and it's a simple song in '94 with only a couple of chords. 
Some background (trying not to get too music geek here)- Go Fight win is quarter notes for the first 3 notes, and the first measure's tones are 1-3-4-4#-5 on a scale.  In half steps from the root, they are 0-4-5-6-7 (So the last three notes are chromatic).  It's tempo in NHL '94 is around 90 BPM.
Process: So I'll copy the code from this song in small parts to the start of song 02 (Start of game when Boston is the home team, so it's easy to access in the game) to see if I can ID the first measure's code.  The first 64 bytes are close (the last note of the measure is cut short, but it's enough to work with)
Two patterns stick out to me in those bytes- 27-2B-2C-2D and 33-37-38-39.  27-2B might be too far of a jump, but it might be that what I'm hearing as a single note might be two notes together.  

For notes- I'm looking at decimal 184996 onward. So these are the chunks I'm looking at:  (underlined the sets of 90 for clarity)

90 27 23 00 
90 33 23 14 
80 27 37 03 
80 33 41 0E 
90 37 23 00 
90 2B 23 14 

80 2B 48 03 
80 37 47 10 
90 38 23 00 
90 2C 23 13 

80 2C 16 01 
80 38 2E 06 
90 39 23 00 
90 2D 23 1A 

80 2D 50 02
80 39 50 01

From my experiments I believe:

80/90 have to do with the instrument. Changing all the 90's to 80 met me with silence.  I think you can think of 90 as an on switch and 80 as an off swtich.   But I can't see why you'd have values after a 'off' instrument (3703, 410E for example) so I'm not sure here.  I didn't experiment with changing the 90's to different values, as my goal today was simply the pitch.

I'm certain the second set of bytes are pitches.  If you change the on and off pitches together, you can move around the pitch of the notes.  (SUCCESS!)

I can't figure out the third set, and any attempts to change them ended inconclusively.  It might be a note style?

I thought the 4th set was note length, but I'm struggling with the 00 values.  Changing the 14's up and down made the notes longer and shorter.  Maybe it loads all the notes then plays them for that length?  Again, I can't figure out the off notes bytes there.

Conclusion: I believe I found the pitches, which was my goal for today.  When I get a better grasp on note length, I can probably make the note long enough to calibrate the pitches with a tuner, which means note length will be the next project.

  • Thanks 2
Link to comment
Share on other sites

This is a short and sweet one-

I was correct on the note length.  If put in a value of 50 (32), then cut it in half on the next note at 25 (20), the notes are twice and half as long.  They could be calibrated to a metronome I suppose, but I'd guess if you're creating music you'd find out how long you want a quarter note to be by trial and error perhaps?

On the downside- with my emulator, computer and tuner app on my phone, I am consistently getting notes that are *in between* steps (almost exactly just sharp enough or flat enough that it wants to jump between F and F# for example).  Almost exactly, as I move the pitches up and down.  But- 36 is an F I'll call it (my phone picked it up around 187 Hz, FYI), 34 was an E flat.  It's a start, and I guess if you're out of tune on every note in relation... it works? 

Next step: Explore instrumentation/effects- I'm not sure if I'll focus on the 23 bytes or the 80/90's.  I may try and find other songs in the ROM that aren't organ and see what differences I notice.  I feel like I have the basics for making an organ ditty down now enough to do it though, and I may try that as well.  Lot's of new branches in this project.

 

A side thought I had today- maybe it could be possible to combine the real songs on organs with an attempt to match the goal horn sounds for "modern" ROM's.  It may be a pipe dream, but I think the songs part is very possible,and horns would require instrument or effect work.  I also know the lengths would need love, as someone would have to manage the pointer table or make the songs the same length as the time currently available.---- Edit- I played with this a bit tonight and was able to get a weak sounding first line of "Sweetness" for Florida's horn.  I need to learn more about tone to get a meatier organ, but I'm making real progress and can make any song with sheet music at a basic level now.

Edited by Asher413
More work today
Link to comment
Share on other sites

This is great.  I know there is some information out there on the internet, and even programs, that explain how the Sega Genesis music works and how you can create custom songs.  I looked into this a while back as well, so I can dig up stuff if you haven't.

Link to comment
Share on other sites

Kingraph- I'll see when/if I get stuck.  I don't really do well with coding (basic was the last language I understood), so I'm trying to break it down a way I understand instead of the coding I've found from Google.

Today was a little less, but more information to be taken down on the next steps:

The bytes between the FF's and the start of the notes I have a stronger grasp on (someone hinted piece of these on the boards here as well).

The C# bytes I believe are setting the channel of the instrument, and the next byte I believe is the instruments. The organ songs didn't load multiple instruments often, but the opening song is clearly a number of instruments loaded.  I found (at least in NHL '94, I haven't tested '93 or others) there appears to be instruments loaded/preset/available in the rom between 00 and 1F.  It's hard to place what all are supposed to be, but my notes on what they sounded like to me include three organ sounds, a sitar (18), and my favorite- my wife called it "Finger plucking a rubber band" (14).  I'm leaning toward thinking organ's 03 and 04 sound better than the OB that appears to be the one they used, but YMMV.

Corresponding with that- the 90's that I think are on switches earlier, I think also correspond to the channel numbers.  If you are using the instrument in channel 0 (CO), you put a 90 in those bytes.  Channel 1 (C1) is 91, etc.  The 80's appear to work the same on turning off tones.

So now starting from the start of a 'song', I'm looking to ID the third bytes after the channel, the second/third bytes after the 80/90 command, then I think I've found what makes the sounds and manipulates the sounds.

 

When all this is done, I'll clean this all up into one more clear post, but I'm posting as I go for personal notes, and just in case I give up on the project tomorrow, there's a starting for someone else not to go through the same steps.

 

 

  • Thanks 1
Link to comment
Share on other sites

  • 1 year later...

Unfortunately, no.  My sound card on my laptop didn't work this whole school year.  It's on my list this summer to see if I can fix it.

Which also means it's on my list to get back into a lot of these things once I can hear the sweet sounds of Genesis hockey on the computer again.  Here's to hoping!

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
46 minutes ago, CPLANAS1985 said:

Is there a way to replace music and sounds from NHL '94 with NHLPA '93 -- the Genesis versions!?!?

It's not well documented, but it's been done. Although sometimes the instruments aren't right.

https://forum.nhl94.com/index.php?/topic/11307-how-to-change-and-view-nhl-94-sound-effects-and-music/

 

Link to comment
Share on other sites

  • 1 month later...

Hey I noticed something.. You identified 90/80 as note ON/OFF... That suggests strongly that it's MIDI format.

80 hex = 1000 0000 binary

90 hex = 1001 0000 binary

http://www.music.mcgill.ca/~ich/classes/mumt306/StandardMIDIfileformat.html

Status
D7----D0
nnnn is the MIDI channel no.
Data Byte(s)
D7----D0
Description
1000nnnn 0kkkkkkk
0vvvvvvv
Note Off event.
This message is sent when a note is released (ended).
(kkkkkkk) is the key (note) number.
(vvvvvvv) is the velocity.
1001nnnn 0kkkkkkk
0vvvvvvv
Note On event.
This message is sent when a note is depressed (start).
(kkkkkkk) is the key (note) number.
(vvvvvvv) is the velocity.

Friendlier explanations: https://www.cs.cmu.edu/~music/cmsip/readings/MIDI tutorial for programmers.html

Also by Appendix 2 of the first link, it looks like the 90/80 byte is the 2nd byte in an instruction. The first byte is timing. So rewriting the bytes you quoted...

?? 90 27 23   ♪D#2
00 90 33 23   ♪D#3
14 80 27 37
03 80 33 41
0E 90 37 23   ♪G3
00 90 2B 23  
♪G2
14 80 2B 48
03 80 37 47
10 90 38 23   ♪G#3
00 90 2C 23   ♪G#2

13 80 2C 16
01 80 38 2E
06 90 39 23   ♪A3
00 90 2D 23   
♪A2
1A 80 2D 50
02 80 39 50
01 ...

Plug those notes in here (ignoring timing)...

https://onlinesequencer.net/

image.png

Click play... Does it sound familiar? I can't really place it, but it does sound like music! (edit: yeah it's totally the Go Fight Win song! https://www.youtube.com/watch?v=I6TV1jNI2ck)

 

  • Thanks 1
Link to comment
Share on other sites

3 hours ago, kingraph said:

What did you do??? :D

I tried to replace the Whalers Brass Bonanza song with Toccata & Fugue in D minor, but it seems like can't just drop in internet MIDI file data directly, the game uses a very basic version of the format.

Real version of the song: https://www.youtube.com/watch?v=dkQrj-eEs-M

MIDI version: https://bitmidi.com/toccata-and-fugue-in-d-minor-bwv-565-busoni-piano-arr-mid

Link to comment
Share on other sites

https://www.youtube.com/watch?v=PLNpvLVu2xA

image.png

@031BB2

00    90    39    21
00    90    34    26
00    90    28    26
0C    90    3B    1D
07    80    39    50
10    80    34    50
00    80    28    50
00    90    34    26
00    90    28    26
00    90    39    21
02    80    3B    50
09    90    3B    1D
07    80    39    50
10    80    34    50
00    80    28    50
00    90    34    26
00    90    28    26
00    90    39    21
04    80    3B    50
07    90    3B    1D
07    80    39    50
03    90    39    21
08    80    3B    50
03    80    34    50
00    80    28    50
00    90    3B    1D
07    80    39    50
04    90    3E    21
00    80    3B    50
0B    80    3E    50
00    90    40    21
0B    90    39    21
00    80    40    50
0C    90    3B    1D
07    80    39    50
04    90    3E    21
00    80    3B    50
0B    80    3E    50
00    90    3B    1D
0B    80    3B    50
 

x12

  • Love 2
  • Like 1
  • Wow 1
Link to comment
Share on other sites

Working on a script for making it easy to import MIDI music downloaded from the internet...

It'll take some work to get the script to be able to merge tracks to create songs more accurately (e.g. keyboard + lead guitar tracks).

I was hoping the game would happen to support multiple instruments, but basically you get the organ sound on channel 0 and the marimba sound on every other channel.

Maybe some investigation of the menu screen music would show how extra instruments could be hacked in there... But I suspect it might not be possible, if the other sound channels are being used for gameplay noises.

  • Love 3
Link to comment
Share on other sites

6 hours ago, smozoma said:

Working on a script for making it easy to import MIDI music downloaded from the internet...

It'll take some work to get the script to be able to merge tracks to create songs more accurately (e.g. keyboard + lead guitar tracks).

I was hoping the game would happen to support multiple instruments, but basically you get the organ sound on channel 0 and the marimba sound on every other channel.

Maybe some investigation of the menu screen music would show how extra instruments could be hacked in there... But I suspect it might not be possible, if the other sound channels are being used for gameplay noises.

I would definitely be willing to assist if you need any help. 

Link to comment
Share on other sites

I put the code on github. 

https://github.com/nhl94dotcom/midi_2_nhl94  https://github.com/smozoma/midi_2_nhl94

I can add 'collaborators'

UltraMagnus and I both took a look at NHL95 and it doesn't seem to use the same music system (at least for the organ music), or the songs are compressed so aren't clearly visible in the ROM data. 

Link to comment
Share on other sites

On 9/3/2022 at 2:04 AM, smozoma said:

https://www.youtube.com/watch?v=PLNpvLVu2xA

image.png

@031BB2

00    90    39    21
00    90    34    26
00    90    28    26
0C    90    3B    1D
07    80    39    50
10    80    34    50
00    80    28    50
00    90    34    26
00    90    28    26
00    90    39    21
02    80    3B    50
09    90    3B    1D
07    80    39    50
10    80    34    50
00    80    28    50
00    90    34    26
00    90    28    26
00    90    39    21
04    80    3B    50
07    90    3B    1D
07    80    39    50
03    90    39    21
08    80    3B    50
03    80    34    50
00    80    28    50
00    90    3B    1D
07    80    39    50
04    90    3E    21
00    80    3B    50
0B    80    3E    50
00    90    40    21
0B    90    39    21
00    80    40    50
0C    90    3B    1D
07    80    39    50
04    90    3E    21
00    80    3B    50
0B    80    3E    50
00    90    3B    1D
0B    80    3B    50
 

x12

The Sabbath fan in me is gitty now!  If only we had a devil's horn hand "like" button...
Nice work!!!

 

  • Like 1
Link to comment
Share on other sites

I created a github "organization" to house all the various community NHL94 projects, and transferred the midi_2_nhl94 project into it

https://github.com/nhl94dotcom/midi_2_nhl94

Anyone wanting to work on the project, let me know and I can figure out how to give you editing access!

Link to comment
Share on other sites

  • 2 months later...

https://youtu.be/o--vwFE52iM - Kernkraft 400 (the woaaaaaaa, aaaaooooo, aaaooooaaooo goal song the Bruins have - needs tweaking)

https://youtu.be/SNA5cbHp6YY - Dirty Water

Just a few notes so other newbies can try this tool out:

  • I used Visual Studio and imported Smozoma's Github through the repository download feature - I recommend doing this and installing mido using the built in features if you're new to Python like me.
  • MuseScore has free trials and all of their notes sheets allow you to download midi versions. MidiEditor then is good tool to combine tracks or delete things you may want to. These were more reliable since they were midis made for transposing/learning and not for listening.
  • If you see any values on the Excel output column fourth from the right or furthest right that get up above 30-40, you may want to shorten them if there aren't major gaps in your song.
  • Count the # of bytes whatever track you're replacing has and then convert to decimal and divide by 4 to count how many rows of Excel cells to copy.

 

Edited by seamor
  • Like 1
Link to comment
Share on other sites

  • 2 months later...

So further to @Asher413 original findings and @smozoma handiwork with the python script and video, I did some additional sleuthing and came up with a few things on my own by poking around.

In the image below, you see the start block of the NHL94 Theme (4507A) and in the highlighted area seems to be the initial "control" for the song output.

00 C0 0B 01: where,

C0 = channel
0B = "instrument"

image.png

If you use Smoz' python script on a midi file, it only allows you to output data from ONE channel.

So I thought to myself. What would happen if you combine notes from 2-3 channels together on different octaves and output that? It worked fine... but the interesting thing that occurred was, in the output csv, the separate channels were still there - but the instruction from the script had them playing from the single "90" channel. (see 36 on one channel, 55 on one channel, 60 on one channel) and all playing under 90 or the "0" channel.

image.png

So I went and located every single instance of "55" in that column and highlighted it. The corresponding "90" in the midi instruction to play the note was changed from 90 to 91. I did the same thing for every instance of "60" and made that 92. If you look at the original pic I pasted you'll see the channel numbers.

C0 C1 C2 C3 C6 and C7

You essentially have 6 channels to assign notes to. Looking at the output from the csv in Smoz' script, I went to work and placed notes in certain channels.

image.png

 

Once I had placed enough notes in 2-3 channels, I tried it out, and it worked. Here's a sneak peak of my HNIC mod using two new sounds (brass electric and what I think is a brass synth).

You can hear the tail end of the NHL94 theme when the HNIC theme cuts out, and it uses that brass synth since it was set up in the channels.

 

SO.

If Smoz can figure out how to get 4-6 channels to output into ONE csv from a midi file, and figure out individual channels in the output (90, 91, 92 etc) We should be able to have multiple instruments playing a lot easier than hacking away at a csv a row at a time LOL 

 

  • Thanks 1
  • Wow 3
Link to comment
Share on other sites

  • 2 weeks later...

So I messed around with this a bit further and figured out a few things. I managed to edit together 2 midi tracks to make a custom HNIC theme from the 90s. I used MixPad and altered notes etc to sound similar to the track, then I went to work changing the notes to a single instrument. From there, I exported a midi track and ran it using smoz' python script.

Because there were multiple notes playing at the same time throughout the track (like chords), THAT is how you can cheat and have multiple instruments at once. The thing is, trying to separate them according to tone is super difficult. The EASY way to do it is to simply assign an instrument to a pitch range. It's not 100% foolproof but it's pretty good.

image.png

As you can see in the image above, any note played in the '40' range from column D was assigned channel 0 (90/80). Every pitch with values in the 50s got channel 1 (91/81) and so on and so forth. I ended up with 6 channels and used 3 instruments.

Instruments.png

Channel 0 = 0B
Channel 1 = 08
Channel 2 = 04
Channel 3 = 0B
Channel 6 = 08
Channel 7 = 0B

I wanted more of a brassy sound because of the horns in the actual track and the 0B chorus synth worked fairly well, with 08 having some decent single sound reverb.  

If you notice, I figured out how to get the song to loop. At the end of the original NHL94 theme is a 10 byte footer(?) that I pasted at the end of the midi information I put in from smoz' script. It looks like this:

offset46D82.png

If you copy the highlighted part and slap it at the end of your track, it should loop, regardless of what comes after it.

We're getting there... the sound barrier has been breached LOL

  • Love 4
  • Thanks 1
  • Wow 2
Link to comment
Share on other sites

Nice!

There's an instrument map here: http://www.music.mcgill.ca/~ich/classes/mumt306/StandardMIDIfileformat.html#BMA1_4

Assuming it matches MIDI instruments definitions...

0B = Music Box (Chromatic Percussion)
08 = Clavinet (piano)
04 = Honky-tonk Piano

I don't suppose you can locate the instrument map used for the on-ice organ songs somewhere..? I don't think it's in the song itself, I think it's set up in common before loading the organ songs.

Link to comment
Share on other sites

56 minutes ago, smozoma said:

Nice!

There's an instrument map here: http://www.music.mcgill.ca/~ich/classes/mumt306/StandardMIDIfileformat.html#BMA1_4

Assuming it matches MIDI instruments definitions...

0B = Music Box (Chromatic Percussion)
08 = Clavinet (piano)
04 = Honky-tonk Piano

I don't suppose you can locate the instrument map used for the on-ice organ songs somewhere..? I don't think it's in the song itself, I think it's set up in common before loading the organ songs.

Interestingly enough... part of the reason why it took me so long to go from the first post to this follow-up was this exact thing - trying to map out the midi instrument map. 

I believe EA used a proprietary sound bank and the Genesis soundchip (Yamaha?) creates its own map based on a limited set of sounds. They remapped a bunch of the instruments so there are more organ/brass/percussion sounds and less breathy instruments and/fx wave sounds. Apparently it was a common thing for sound engineers to do so they could add custom sounds to a bank and not follow a traditional midi instrument map. I literally went one-by-one to figure out the tones, and they were all over the map. It seems like the instruments are custom as well - a lot of saw and sine type sounds that warp based on tone and tempo. I didn't delve TOO far into it as it would take me forever, but if you start at 00 hex you get a celesta/glockenspiel/viraphone type tone... but once you hit the 10s to 19 hex, it's percussion (according to the midi map, percussion is in the 100 range) and the sounds aren't like midi sounds. It's weird. I compared it to other VGMs which follow a proper instrument map, and they actually sound like the instruments.

If you go further down the list you get a lot of similar sounding tones with a less/more modulation in the frequency but roughly the same type of sound. I feel like it was a small bank of sounds in a region that were modified.

Oddly enough... the further you go with the numbers 77, 78, 79 etc you start hearing what sounds like "ughs" and "oofs" from bodychecks! That led me to believe it's gotta be a custom soundbank we may need to map out one of these days.

I do think we'll be able to find the instrument map for the arenas. Assuming it uses individual channels, the organ sounds often start with a 0, so they're probably 08, 09, 0A etc. The common percussive snare hit is like 14-15 I think.

  • Love 1
  • Thanks 1
Link to comment
Share on other sites

1 hour ago, Drezz said:

Oddly enough... the further you go with the numbers 77, 78, 79 etc you start hearing what sounds like "ughs" and "oofs" from bodychecks! That led me to believe it's gotta be a custom soundbank we may need to map out one of these days.

So you're saying we can make the Meow Mix commercial, but with guys going "UGH!" and "OOF!"??

Link to comment
Share on other sites

Okay, have to say it, this is fantastic information that I will reference later when I have had more time to learn how to do this.

But now I do have a question. If I cannot find a midi of a song I like, but I do have an NSF, SPC or VGZ version, do I need to convert it first?

Link to comment
Share on other sites

20 minutes ago, von Ozbourne said:

Okay, have to say it, this is fantastic information that I will reference later when I have had more time to learn how to do this.

But now I do have a question. If I cannot find a midi of a song I like, but I do have an NSF, SPC or VGZ version, do I need to convert it first?

Yeah, it's a bit of work. It depends on the synthesizer used to make the track. If it is a rip that used midi instrumentation, you may be able to convert it. Otherwise, you're stuck having to transcribe it yourself. hat's what I had to do with the first half of the HNIC theme as there is no sheet music or midi samples available for it. It's long and tedious.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...