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
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 5:20 pm 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.
What I was trying to explain was that if you play the NTSC versions of Mega Man 1/2 on an NTSC console and you play the PAL versions of Mega Man 1/2 on a PAL console, the note frequencies are nearly identical while the PAL versions play more slowly than the NTSC versions. If you hear them playing at the same speed but in different keys, then you're not actually playing the PAL versions on a true PAL console - maybe you're actually using something with a Dendy-style CPU (with a /15 clock divider instead of the /16 on an authentic RP2A07)?

For clarity, I've attached recordings of the Mega Man 2 intro+titlescreen from both the NTSC and PAL versions - if they don't match yours, then there's something wrong with your setup.
Attachments
mm2ntsc.mp4
(1.25 MiB) Downloaded 17 times
mm2pal.mp4
(1.4 MiB) Downloaded 18 times
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

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

Post by rainwarrior »

Wow. Mega Man 2 adjusted the pitch for PAL but left the tempo slow??
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

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

Post by rainwarrior »

Coughdrop wrote: Fri Dec 30, 2022 5:20 pmSo the amount of pitch changed is standard when it comes to 60Hz > 50Hz yeah?
This pitch is not really to do with 60hz or 50hz. That's the video refresh rate. The default consequence of this is just that the tempo and gameplay is 20% slower in PAL if the game isn't adapted to compensate. This affects most video game consoles in the same way.

The change in pitch comes from a different CPU frequency used in the PAL console. The audio runs from the same clock as the CPU, and its pitch changes with the CPU frequency. I think this is sort of unique to the NES, I don't think most consoles have a pitch change like this for NTSC vs PAL.

The specific frequency was chosen based on a division of the clock their were using for PAL video, so it is related to the 60/50hz difference in that way, but the choice is also a little bit arbitary, as the Dendy console demonstrated by using a CPU frequency that was PAL compatible but much closer to the NTSC NES' rate.
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 3:24 pm 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.
If the definition is that loose then I suppose so. But I often have difficulty differentiating note from note when trying to cover a song in a tracker for example, even after playing them back to back. I don't consider myself to have that much musical skill.
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 »

I once made a game genie code that subtracted one half step from PAL Mr. Gimmick, improving it on NTSC. I think it was some instruction that set or cleared the carry flag before the addition, and I changed it to the other one, and that had the effect of subtracting one half step.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

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

Post by rainwarrior »

Oh, that's an interesting thought! If the music engine has a table of semitones, which most do, manipulating the lookup by +1 could indeed have that effect. So, maybe yeah that approximation could be a game-genie-sized patch for many games, if you wanted to.


The times I've done a pitch conversion, my approach was to replace the pitch table... but always I was doing it because I wanted the precise tuning to match the relative change in DPCM rate, which you can't quite get with just +1 semitone. The difference is not exactly 1 semitone, so approximating the difference that way would still leave you slightly out of tune vs. the DPCM...

Though, in the case of trying to play PAL Mr. Gimmick on an NTSC machine, a -1 semitone change would still a big improvement. Being closer to in tune, even if not perfect, is much better than being more than a whole semitone out.

The difference is actually about 128 cents, where a semitone is only 100 cents, so a coarse adjustment like that gets you to about 28 cents from correct.

The DPCM internal pitch tables are inconsistent from each other by a few cents already (and the PAL table has 2 unfortunate errors that are a bit more off), so there's a limit to how precise it can be, but you can still do a bit better by replacing the game's pitch tables.
User avatar
za909
Posts: 249
Joined: Fri Jan 24, 2014 9:05 am
Location: Mijn hart woont al in Nederland

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

Post by za909 »

The thing about Mega Man 1 and 2 is that I believe they never touch the pulse sweep registers, so whatever was left there stays there. This isn't an issue normally other than that the sweep causes the pulses to immediately stop when going to the lowest octave, as described in known errata. The true issue with this is that if the Game Genie touches the sweep registers, which it does to create its sound effects, the sweep will stay active as the game starts up and it will stay active the entire time the game is running. The game might continuously rewrite the low period registers on each frame and thereby discarding whatever the updated period result from the sweep units were, so the end result is a kind of wiggly, sometimes almost arpeggiated effect on top of all the sounds.
Post Reply