Oh, Yamaha, why must you be so impenetrable? I've been hacking up some sound-test software and poring over tech documents with an eye towards writing a music engine that supports the OPLL chip found in MSX-Music cartridges and MSX-2+ machines, and chief among the things that baffle me about the chip (just after why maximum volume is 0) is the crazy moon logic that drives the frequency-control registers.
It took me the better part of the afternoon to even wrap my head around how it works, but it's my understanding that, given the 9-bit "F-number" and the 3-bit "block," the formula is:
Frequency = Fnum * (2 ^ Block-1) * 50000 / 2^18
where 50000 is the master frequency for the chip. The crazy thing is, and this took me hours of wracking my brain and actual direct confirmation on my own unit to understand, even though the block value would logically serve as an octave-selector, the ranges overlap! Block value 1 gives the various F-numbers output frequencies from about 0.19Hz to 97Hz, block 2 covers from 0.38Hz to 194.93Hz, and so on and so forth.
This means that, even though there's exactly as much register space devoted to frequency control as on the PSG or SCC, the huge majority of the range is completely redundant. I'm wondering if I shouldn't just hard-code the block value to 7, since that gives a range from ~12Hz to ~6KHz, more than covering the full piano keyboard. I'm just not 100% sure on this, since it means that a range of frequencies with over 4000 values on the PSG/SCC is going to be squashed to under 512 on the OPLL!
If I wanted to make use of all the bits, it'd be a simple thing to work out a pre-calculated note table with the optimum block/fnum combination for each note (and, in fact, I already did.) But the question then is, how do I handle pitch bends? They're not too difficult to figure out in a linear frequency range, but when you bring the block numbers into it, it's madness.
Does anyone have any thoughts on this or experience with coding for Yamaha FM chips? I keep thinking that there has to be something I missed, but I can't seem to find anything that would make this make any kind of sense at all...