Game Genie sound pitch shifting, possible? (Question)

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

User avatar
Coughdrop
Posts: 6
Joined: Thu Dec 01, 2022 11:57 am

Game Genie sound pitch shifting, possible? (Question)

Post by Coughdrop »

Hello!

I've been thinking about this for a while ever since i got my PAL Nes converted to NTSC, Some games on NES have PAL versions that were very lazily optimized for 50hz, there are some that only have the music changed to be an octave higher than the US versions,other than that they are the exact same. I'm mainly referring to Mega Man and Mega Man 2 here, exactly the same as all other versions except the pitch of the music, even the speed is the same.

So my question is: would it be possible to change the octave back to what it is in the NTSC versions of the game through the use of Game Genie? Or is the whole soundtrack shifted to a higher octave byte by byte in the PAL version? i feel like if it's a couple s of a difference somewhere a Game Genie should be able to do the trick, It'd be great to have a way to optimize these carts for play on an NTSC system, i'm sure there's other games that would benefit from it as well.

Thanks for reading and i hope someone knows if this is something feasible!
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: Game Genie sound pitch shifting, possible? (Question)

Post by Quietust »

Coughdrop wrote: Fri Dec 30, 2022 9:54 am I'm mainly referring to Mega Man and Mega Man 2 here, exactly the same as all other versions except the pitch of the music, even the speed is the same.
I think your emulator is misconfigured and is running the games in NTSC mode - when I run them in PAL mode, the music plays back in the correct key ("octave" isn't the word you're looking for - that's going up by 12 semitones, not just one or two) but at a slower tempo.

Either way, adjusting a PAL game's soundtrack to match both the pitch and tempo of the corresponding NTSC release would almost certainly require far more than the 3 bytes a Game Genie is capable of modifying.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
User avatar
Individualised
Posts: 310
Joined: Mon Sep 05, 2022 6:46 am

Re: Game Genie sound pitch shifting, possible? (Question)

Post by Individualised »

Quietust wrote: Fri Dec 30, 2022 10:15 am I think your emulator is misconfigured and is running the games in NTSC mode - when I run them in PAL mode, the music plays back in the correct key ("octave" isn't the word you're looking for - that's going up by 12 semitones, not just one or two) but at a slower tempo.
I'm sure that's what they were trying to say - that the pitch is correct but the tempo is wrong in the PAL versions of the game running on a PAL NES. They want to know how to change the pitch of the PAL version of the game to sound correct on a NTSC system.
User avatar
rainwarrior
Posts: 8735
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Game Genie sound pitch shifting, possible? (Question)

Post by rainwarrior »

Things you can do with a Game Genie... you probably can't accomplish this with it. You may notice that Mega Man 2 has a sound bug if you start it with a Game Genie, but compensating for pitch takes more than a few bytes change.

Mr. Gimmick has code in PAL that runs the music engine twice every 5th frame to make the music run at the correct tempo in PAL without having to change the music. That kind of thing is simple enough that a game genie could disable it... though of course there's not much reason to, because we normally want the music to play at the correct speed, rather than too slow.

.

So... maybe we should discuss the topic of converting an NTSC soundtrack to PAL. (Or vice versa, everything here applies the other way too.) You can skip to the summary below if you want a shorter version.

While correcting music speed/tempo so that it is not too slow is important, changing its pitch doesn't really do anything useful. The relative meaning of all the harmony in the music is exactly the same when ~1 semitone lower in the PAL version. Most humans are not capable of noticing a pitch difference like that, unless you have them side by side. People that can notice this otherwise have a sense called absolute pitch, which most of the population does not possess. (I do have absolute pitch, and I do notice it, but I still find it an unimportant difference despite this.)

Changing the pitch by a semitone is not meaningful. Changing the pitch by a much larger amount (e.g. an octave) would make a real difference, but 1 semitone is just not enough to be important. There is nothing inherently good or bad about it being 1 semitone lower in the PAL version. The 50hz/60hz tempo difference is important, and people notice slow music. The slightly lowered pitch is extremely minor.

However, if you want to change this, usually it would involve patching the ROM to replace some internal pitch tables. This is too much for a game genie, but it can be done as a patch. However, there are some properties of the NES sound that changing the internal pitch values will affect. For instance, there is a "click" if certain frequency ranges are crossed, the Mega Man 2 ending has a vibrato A pitch that clicks. On PAL it clicks in the same place a semitone lower (i.e. same internal value). If you change those internal values to adjust the pitch for PAL, this moves those clicking points to different parts of the music, which the composer will have never tested against. So... adjusting values for pitch has other consequences on the music which must be tested for differences. This is another reason why it is not normally a good idea to try and compensate for this 1 semitone difference. (The differences are often OK, but there are differences, and they should be tested and evaluated.)

There is one thing that makes an exception here, which is DPCM samples. Unfortunately the PAL NES does not just play DPCM samples 1 semitone lower, but they have all been returned to compensate for the lowered pitch. This means that the same DPCM sample data will play back at the same pitch (approximately) on NTSC and PAL, even though the rest of the sound chip has a lowered pitch.

This is great for DPCM sounds which do not interact with the pitch of the music. A voice sound will sound the same on NTSC and PAL with no needed change. However, if you're using DPCM sounds which are tuned with a pitch and part of the music, this becomes a problem that you have to compensate for.

Sunsoft games like Mr. Gimmick and Ufouria adjust their internal music pitch data +1 semitone in the PAL region to compensate for the DPCM difference (as well as compensating the speed/tempo as mentioned above). This keeps their DPCM bassline samples in-tune with the game. The other way to compensate for this would have been to replace the DPCM sample data with samples that are tuned -1 semitones lower, but in general it's easier to replace the pitch tables than DPCM. However this does come with the drawbacks mentioned above, and it should be tested to make sure it hasn't created other issues.

.

So... there is no way to make PAL NES soundtracks sound perfectly the same as on NTSC. Every adaptation has advantages and drawbacks.

Summary:
  • Compensating the tempo difference between 50hz and 60hz is important. The Sunsoft method of doubling every 5th frame of music update is practical, though it has the drawback of 1 in 5 frames being "skipped" over in sound. The difference tends to be minor, but if you have an instrument with a 1-frame click, it might get skipped over in some rhythms.
  • An alternative way to correct the tempo exists in some music engines, like Famitracker. This instead adjusts the rates it generates new notes. However this has a different drawback that even thought the notes start at a compensated time, the instrument data does not skip any frames so the shape of each note is slower. This causes its own difference in the sound (e.g. a piano tone decays to silent more slowly), and generally I find this has more problems than the 1-in-5 doubling method.
  • Normally I would advise against trying to compensate the pitch, unless you have DPCM musical sounds that are tuned (Sunsoft bass, Mario 3 kettle drums, etc.). Otherwise changing this has other unintended consequences on the sound. Because the 1 semitone difference is not musical meaningful, it is better to keep the internal pitch data exactly the same if you can, because it will prevent other non-pitch properties of the sound from changing too.
  • In the tuned DPCM case, you could alternatively compensate with a new retuned set of DPCM samples, though this is usually less practical than replacing the internal pitch table. (DPCM data is large, and the available playback rates on the NES make it tricky to retune them without other differences.)
  • A final option is just to adjust the whole soundtrack for PAL manually and replace the entire data in the PAL version. This won't be exactly the same, but gives the composer an opportunity to make it sound the way they want, at least. This is time consuming, and requires creation of an extra music data set, though. Usually the methods above are very good.
Anyway, no you can't really do any of these things with a Game Genie.

I had to investigate NTSC/PAL music conversion techniques extensively during various NES music compilation projects, which led me to the conclusions above. For those compilations I had to pick the method of conversion track-by-track, because no one technique was appropriate for everything.
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Game Genie sound pitch shifting, possible? (Question)

Post by Dwedit »

Some games were made for PAL then badly ported to NTSC, such as Addams Family or Krusty's Fun House. Sound pitch is correct on PAL only, and is wrong on NTSC, but tempo is corrected for 60/50FPS.


Also, regarding first post, not "octave". You want "half-step" or "semitone".
Last edited by Dwedit on Fri Dec 30, 2022 12:38 pm, edited 1 time in total.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
rainwarrior
Posts: 8735
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Game Genie sound pitch shifting, possible? (Question)

Post by rainwarrior »

I think The Addams Family did it right. They correctly adjusted the tempo so that the music does not play too fast on NTSC.

The pitch shifts by 1 semitone, but allowing the pitch to shift like this is not incorrect.

That's a good conversion, not a bad one. (In terms of music, at least.)

The bad conversions have wrong tempo.

The absolute worst i've seen is Ufouria on Virtual Console which uses the PAL ROM in an NTSC emulator and the entire bassline is out of tune the whole game.
Last edited by rainwarrior on Fri Dec 30, 2022 12:40 pm, edited 1 time in total.
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Game Genie sound pitch shifting, possible? (Question)

Post by Dwedit »

Listen to the theme song from the 1964 TV version of Addams family. PAL game matches the pitch of that song, NTSC version does not.

Likewise, PAL Krusty's Fun House matches the sound pitch of the SNES version, while NTSC version does not.
Last edited by Dwedit on Fri Dec 30, 2022 12:42 pm, edited 1 time in total.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
rainwarrior
Posts: 8735
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Game Genie sound pitch shifting, possible? (Question)

Post by rainwarrior »

For the purposes of a conversion, I think it simply doesn't matter if the pitch matches the theme song on the TV show recording. Pitch is not wrong or right in this way. Not in this small a difference. It's only a significant difference if you want to put them side by side at the same time.

Maybe an analogy is how Karaoke machines let you pitch a song up or down to better match your voice. It's better to be able to sing the notes properly than it is to sing them at the same pitch as a different version which isn't being compared side by side...

I think in the case of NES conversion it's better to leave the music data as-is with the pitch shifted, so that the data changes don't cause other sound changes in the voicing which I think are much more meaningful than this small difference in absolute pitch.

It's not wrong to replace your tuning tables and shift it back up/down, either, and making their absolute pitch the same, but it does alter things like tuning precision, octave-crossing-clicks, etc. which leaving it as-is does not. Both ways are a very valid approach, IMO.
Last edited by rainwarrior on Fri Dec 30, 2022 12:54 pm, edited 1 time in total.
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Game Genie sound pitch shifting, possible? (Question)

Post by Dwedit »

Sounds like that's just a philosophical question over whether the absolute pitch of a song matters or not.

I'll point to an example song, in Pipe Dream, there's Music 3, a nice upbeat funky song. If you listen very carefully, you can hear that the song uses exclusively black keys. If you were to transpose the song to any other key, that would no longer hold true.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Game Genie sound pitch shifting, possible? (Question)

Post by lidnariq »

Or you just retune your piano so that it's not tuned to A440 and so it's still on just the pentatonic black keys.
User avatar
rainwarrior
Posts: 8735
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Game Genie sound pitch shifting, possible? (Question)

Post by rainwarrior »

Dwedit wrote: Fri Dec 30, 2022 12:54 pmIf you listen very carefully, you can hear that the song uses exclusively black keys. If you were to transpose the song to any other key, that would no longer hold true.
In what sense do you think "black keys only" is meaningful to the game? At any other transposition we just call this the pentatonic scale, which occurs in all sorts of music at all different pitches.

Often when written for piano, using a key that puts the pentatonic scale on the black keys is physically convenient for the player. In that sense it has a real meaning for the performer, though in the general case a well trained perfomer wouldn't normally have any trouble playing the same at any other transposition. (Specifically designed physically demanding studies are of course an exception... though not entirely.)

Pipe Dream isn't played at a piano keyboard. It doesn't have a visual piano keyboard. How is this "black keys" reference supposed to be understood by the audience? If someone doesn't have absolute pitch, how do they know it's black keys and not any other transposition of the pentatonic scale?

Also, not all keyboads are tuned to A=440Hz, though most electronic keyboards are by default at least. Physical pianos in the real world vary a lot, in my experience. The tuning of the black keys themselves is variable.

Baroque music is categorically performed at the "wrong" pitch all the time. It didn't have precise tuning standards, but what they did have is known to be a lower pitch than the A440 it is very often played at. Does it matter? Not very much. The difference between singers, orchestras, individual instruments outweigh the meaning of this difference a hundredfold.

When preparing any musical arrangment or transcription of an existing tune, I feel that adjusting the pitch to better suit your target instruments/performers is probably one of the first things you should consider doing. The Chrono Trigger Brink of Time Secret of Forest arrangement transposes up a semitone vs the original, and I wouldn't ever perceive this difference as a fault with the arrangment. I suspect that semitone wasn't arbitrary, and made the instrumentation physically easier in some way, but even if it wasn't I don't see a loss of any significance here.
User avatar
rainwarrior
Posts: 8735
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Game Genie sound pitch shifting, possible? (Question)

Post by rainwarrior »

Dwedit wrote: Fri Dec 30, 2022 12:54 pmSounds like that's just a philosophical question over whether the absolute pitch of a song matters or not.
Some of it is philosophical, but the I feel the largest part of it is not.

Without doing direct side-by-side comparisons, most humans are just not capable of perceiving this difference. For the large majority of people, if you played The Adams Family PAL for them one day, and The Adams Family NTSC the next, they would not be able to tell you which was which. The difference is too small to be perceived. For this reason I think it's a good conversion, at least re: the pitch issue.

Side by side comparisons are an exception. Trying to play along on a musical instrument is an exception. Someone who possesses absolute pitch is an exception, and feelings about how much it matters varies among this group, especially those with synaesthetic connections between specific pitches and feelings.

The waters are also muddied by historical associations of particular keys with moods, etc. which could be subjectively true for the person writing, but are likely based on physical instrumentation details (e.g. G minor on a violin would use that open G which has a very distinctive sound, historical non-equal tuning systems), or maybe just based on associations with particular popular tunes. I don't remember the name of the article I read years ago, but it noted a general lack of agreement or consistency, except when certain popular pieces appeared (e.g. some of Beethoven's symphonies like the Eroica or Pastorale had a clear impact on the list makers), and referenced relevant studies about the lack of absolute pitch sense.


I don't feel this is in the same category as the 50/60hz tempo difference. Shadow of the Beast on NTSC Genesis plays its music too fast, and this is very noticeable. People who played the PAL version yesterday and the NTSC version today are very likely to pick up on this difference. That's a bad conversion, to me.
User avatar
Individualised
Posts: 310
Joined: Mon Sep 05, 2022 6:46 am

Re: Game Genie sound pitch shifting, possible? (Question)

Post by Individualised »

rainwarrior wrote: Fri Dec 30, 2022 11:33 am Most humans are not capable of noticing a pitch difference like that, unless you have them side by side. People that can notice this otherwise have a sense called absolute pitch, which most of the population does not possess. (I do have absolute pitch, and I do notice it, but I still find it an unimportant difference despite this.)
I wouldn't say that. I certainly don't have absolute pitch yet I can easily tell if a song being played 1 semitone out of its usual key. And I think most gamers would notice the Super Mario theme or Green Hill Zone or any other song from a game that they've heard hundreds of times being played 1 semitone lower.
User avatar
rainwarrior
Posts: 8735
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Game Genie sound pitch shifting, possible? (Question)

Post by rainwarrior »

Individualised wrote: Fri Dec 30, 2022 3:07 pmI certainly don't have absolute pitch yet I can easily tell if a song being played 1 semitone out of its usual key.
You have absolute pitch.

There are differing degrees of it, and some people put arbitrary definitions on when you can call it "perfect pitch" or "absolute pitch" which might set a higher bar, but what you are describing is an absolute pitch sense, and most people can't do what you're describing. The number of people is certainly higher than the "1 in 10,000" sometimes seen, but I don't have a good bibliography on hand and can't seem to quickly find a good relevant study right now...

However, if you play them back to back for comparison, everyone can tell they are different. This fact makes it really hard to discuss, because it takes a lot more effort to do properly delayed comparisons, and it's hard to self test. Direct comparisons are meaningful and very perceptible (mid-song key-changes are a common demonstration), but I don't feel they're fair in this evaluation of whether the port is well prepared musically. The port does not contain a direct comparison.
User avatar
Coughdrop
Posts: 6
Joined: Thu Dec 01, 2022 11:57 am

Re: Game Genie sound pitch shifting, possible? (Question)

Post by Coughdrop »

rainwarrior wrote: Fri Dec 30, 2022 11:33 am Things you can do with a Game Genie... you probably can't accomplish this with it. You may notice that Mega Man 2 has a sound bug if you start it with a Game Genie, but compensating for pitch takes more than a few bytes change.
Wow, Thanks for the super thorough explanation Rainwarrior!!

I guess i've been cursed with perfect pitch :P I can definitely tell the difference just by hearing the Pal version on an NTSC system uncompared, maybe it's because i know the Mega Man 1 and 2 soundtrack very well but the second it started playing it sounded off, funny as i saw a list online that stated both Mega Man 1 and 2 were exactly the same as NTSC, so i got a PAL copy of 1 as it's easier to get here in europe but immediately noticed it was a little higher in pitch. I guess the person that made the list didn't notice at all, which is understandable if not all people can hear it like you said.

Shame it's not possible with a Game genie, i was thinking about it after i made the post and it does seem like a big task for something able to edit so little, but what you mentioned with Mr. Gimmick was something i assumed all NES games might have, like a single value to switch, instead of having to rewrite every tone one by one.

So the amount of pitch changed is standard when it comes to 60Hz > 50Hz yeah? i wonder how many NES games have the same exact problem.

But in any case i think i'll just get a Famicom copy, as now that i've heard it i can't unhear it :lol:
Post Reply