Home‎ > ‎Technical Info‎ > ‎Sega Genesis / Megadrive‎ > ‎

Sound System

FM Note Calculation

FM notes generated on the YM2612 are specified by two numbers: a block number (Block) and a frequency (Fnum) number. Block selects an octave and Fnum selects a note within that octave. Fnum is 12 bits wide and Block is 3 bits wide.

where: 
  • Fnote = the frequency of the desired note (i.e. A4 = 440Hz)
  • Clock-YM is the clock frequency of the YM2612 (NTSC = 7,670,453Mhz - PAL = 7,600,428Mhz)
  • Block is the desired Octave (0 is a valid octave)
Fnum is 12 bits wide and Block is 3 bits wide and are concatenated together when writing data to the YM2612. The 3 Block bits occupy the upper nibble of the most siginificant byte. The data bus to the YM2612 is only 8 bits wide, therefore, these two numbers must be concatenated and then split accordingly as follows:

  D7   D6  D5  D4  D3  D2  D1  D0
 0xA0+  Fnum7  Fnum6  Fnum5   Fnum4   Fnum3  Fnum2  Fnum1  Fnum0
 0xA4+    Block2  Block1   Block0  Fnum11  Fnum10  Fnum9  Fnum8


Conversely, to calculate the actual frequency being output from a particular combination of Fnum and Block:

Example YM2612 NTSC Note Table

Based on A4 = 440Hz, the following octave can be obtained. For higher octaves, all Fnum values will be identical, simply increment the block value.

Example: 
  • C1 -> Block = 0, Fnum = 644 (0x0284)
  • C2 -> Block = 1, Fnum = 644 (0x1284)
  • C4 -> Block = 3, Fnum = 644 (0x3284)
Therefore, software only needs to retain a table of values for a single octave, higher octaves just add 16 (0x10) on the high byte.

 Name  Freq  Block  Fnum  Actual  MSB (h)  LSB (h)
 C1  32.703  0  644  32.715  0x02  0x84
 #/b  34.648  0  682  34.645  0x02  0xAA
 D1  36.708  0  723  36.728  0x02  0xD3
 #/b  38.891  0  766  38.912  0x02  0xFE
 E1  41.203  0  811  41.198  0x03  0x2B
 F1  43.654  0  859  43.637  0x03  0x5B
 #/b  46.249  0  910  46.227  0x03  0x8E
 G1  48.999  0  965  49.021  0x03  0xC5
 #/b  51.913  0  1022  51.917  0x03  0xFE
 A1  55.000  0  1083  55.016  0x04  0x3B
 #/b  58.270  0  1147  58.267  0x04  0x7B
 B1  61.735  0  1215  61.721  0x04  0xBF

PSG Note Calculation

PSG notes generated on the SN76489 are specified by a single 10 bit divider.