and now, to AT LAST silence your persistent clamoring, a brief thread about game boy tones and tuning. ahem. the frequency of each of the three tone-generating oscillators on the game boy are set with an 11-bit value (eight bits in one memory-mapped register, three in the other). that means there are 2048 possible frequencies. here's a chart showing a scatterplot of the frequency of each of the GB's oscillator values, along with a scatterplot of the frequency of all 128 possible midi notes
here's the reason I was thinking about all of this. now that I can send values back and forth between game boy software and the microcontroller on my custom game boy cart, i did what anyone in my situation would do: i made a game boy photoresistor theremin
and only now is it occurring to me that i should have graphed differences in percentage, rather than absolute hertz difference. oh well. anyway, that's all, i just thought that it was interesting to look at these differences! more on the math and underlying hardware here https://gbdev.io/pandocs/Audio_Registers.html and i used this table http://www.devrs.com/gb/files/sndtab.html to check my work. the end!
however! here's a chart showing the difference in frequency between each midi note and the frequency of the tone *nearest* to that midi note that it's possible for the game boy to generate. you can see that there's actually a fairly small range of midi notes that can be approximated by the game boy without sounding "out of tune" (depending on what you consider to be out of tune. no one except whiplash guy is going to notice 2–3Hz, but 100Hz is obviously going to not sound right)
if we zoom in on the values in the C-3 to C-7 range (two octaves below middle C + two octaves above), you see that the difference in frequency there is pretty minimal (note that this chart is using a linear scale on the Y axis, not log like the previous two). above this range, I think the game boy will sound significantly out of tune with other MIDI-tuned instruments. makes me wonder if some of what we hear as the distinctive "sound" of authentic chiptunes comes from this aberration in tuning!
this chart shows some weirdnesses, e.g., that the bottom 35 MIDI notes are too low in frequency for the game boy to generate, and some of the game boy's frequencies are above MIDI range. but for the most part, it looks like the curve of game boy frequencies lines up with and is in "tune" with the "correct" frequencies, which is kind of a cool trick (i'm using MIDI note frequencies as a proxy here for "correct" frequencies, which I know is debatable!)