rhargreaves / mega-drive-midi-interface

Control the Sega Mega Drive's Yamaha YM2612 and PSG with MIDI
GNU General Public License v3.0
92 stars 8 forks source link

Fix NTSC FM frequencies #27

Closed dquenne closed 2 years ago

dquenne commented 2 years ago

Testing on my NTSC Genesis, the pitches were off for FM voices (but fine for PSG). Tried out the frequencies from here and things were in tune.

jaffa225 commented 2 years ago

Testing on my NTSC Genesis, the pitches were off for FM voices (but fine for PSG). Tried out the frequencies from here and things were in tune.

I was curious where you got the low B value from, so I checked the original site you linked to. It doesn't seem linear, as you can see from my quick check of their math:

1146-1081=65 1081-1021=60 (-5) 1021-964=57 (-3) 964-910=54 (-3) 910-858=52 (-2) 858-810=48 (-4) 810-765=45 (-3) 765-722=43 (-2) 722-681=41 (-2) 681-644=37 (-4)

And since it seems your 607 implies you subtracted 37 again, I think it may be closer to subtract 34 (a change of -3 from 37): 644-34=610

Sorry for nitpicking, but since I didn't see where your low B came from, I had to try calculating it myself.

I have been unable to build the ROM myself, when last attempted, so I'm unable to test your changes. I own an NTSC Sega Genesis, but I don't own a Mega Drive to compare with, even if I could build it. If you have any hints on compiling it on GNU/Linux I wouldn't mind hearing them.

Edit: I built it at last! I just needed a .jar file built easily from marsdev, combined with the rest from gendev, and a change to the Makefile ("GCC_VER?=9.3.0"). I still wasn't able to build the tests, but "make bin/out.bin" worked to build the EverDrives' ROM. So far I could hear no difference in pitch, though I was listening through headphones! To me, they both sound correct. I guess I'll have to try simpler music next, so layering doesn't keep convincing me of their false similarity. I did modify mine for a low B frequency of 610, but that doesn't seem a likely cause.

Thanks,

Lucas

rhargreaves commented 2 years ago

Hi dquenne,

I only have a PAL Mega Drive but I'll take a look at running this in an emulator to see if the pitches need adjusting...

Rob

rhargreaves commented 2 years ago

Hi dquenne,

You're right that the frequencies were off for NTSC. They're also wrong for PAL... 🤦 I'll remove the distinction as I don't think the difference warrants handling them separately. Thanks for bringing it to my attention!

Rob

rhargreaves commented 2 years ago

@jaffa225

If you're struggling to build the ROM, I'd recommend building it using Docker (docker-make). That way you do not need any dependencies present on your local machine. They are all contained with the docker container.

jaffa225 commented 2 years ago

@rhargreaves

I wasn't really struggling anymore (except for those tests not building), nevertheless I followed your suggestion, and docker-make built it much more easily. I now have a very up-to-date perfect image, thanks to you!

I was reticent to install the docker repository, but think I would have been worse off with ever deprecated manually installed docker packages.

Thanks again!,

Lucas