Pulse Channel frequency chart: Difference between revisions
Dr. Floppy (talk | contribs) (Genesis!) |
(PAL can't actually reach G-9, so remove that entry from its table. (period $007 is muted)) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
== MIDI Tuning Table == | |||
Using the [https://en.wikipedia.org/wiki/MIDI_tuning_standard MIDI Tuning Standard] with A=440 Hz, we can derive the equivalent period timer value for the two [[APU Pulse | Pulse]] channels. Due to limitations on the 11-bit period's range, the lowest standard MIDI frequency that can be reproduced with acceptable tuning is A-1 (55 Hz) on NTSC, and G#1 (51.91 Hz) on PAL. Here we show the desired frequency for each MIDI index, the closest period value, and the resulting tuning error (in cents) from the standard. | |||
'''Note''': The [[APU Triangle | Triangle]] channel can make use of the same 11-bit period values. Due to its longer 32-step sequence, it will sound exactly one octave lower (half of the apparent frequency) compared to the equivalent period on Pulse. | |||
{| class="wikitable" style="text-align: right" | |||
|- | |- | ||
| | | colspan="3" bgcolor = DDDDDD style="text-align: center; font-weight: bold" | MIDI | ||
| colspan="3" bgcolor = FFDDDD style="text-align: center; font-weight: bold" | NTSC APU Pulse | |||
| colspan="3" bgcolor = DDDDFF style="text-align: center; font-weight: bold" | PAL APU Pulse | |||
| | |||
| | |||
| | |||
|- | |- | ||
! Index || Note || Frequency || 11bit Period || Frequency || Tuning || 11bit Period || Frequency || Tuning | |||
|- | |||
| 31 || G-1 || 49.00 || bgcolor=FFDDDD | - || - || - || bgcolor=DDDDFF | $7FF || 50.74 || +60c | |||
|- | |||
| 32 || G#1 || 51.91 || bgcolor=FFDDDD | $7FF || 54.62 || +88c || bgcolor=DDDDFF | $7D1 || 51.90 || +0c | |||
|- | |||
| 33 || A-1 || 55.00 || bgcolor=FFDDDD | $7F1 || 55.00 || +0c || bgcolor=DDDDFF | $760 || 55.01 || +0c | |||
|- | |||
| 34 || A#1 || 58.27 || bgcolor=FFDDDD | $77F || 58.26 || +0c || bgcolor=DDDDFF | $6F6 || 58.28 || +0c | |||
|- | |||
| 35 || B-1 || 61.74 || bgcolor=FFDDDD | $713 || 61.73 || +0c || bgcolor=DDDDFF | $692 || 61.74 || +0c | |||
|- | |||
| 36 || C-2 || 65.41 || bgcolor=FFDDDD | $6AD || 65.42 || +0c || bgcolor=DDDDFF | $634 || 65.40 || +0c | |||
|- | |||
| 37 || C#2 || 69.30 || bgcolor=FFDDDD | $64D || 69.31 || +0c || bgcolor=DDDDFF | $5DB || 69.28 || -1c | |||
|- | |||
| 38 || D-2 || 73.42 || bgcolor=FFDDDD | $5F3 || 73.40 || +0c || bgcolor=DDDDFF | $586 || 73.44 || +0c | |||
|- | |||
| 39 || D#2 || 77.78 || bgcolor=FFDDDD | $59D || 77.79 || +0c || bgcolor=DDDDFF | $537 || 77.78 || +0c | |||
|- | |||
| 40 || E-2 || 82.41 || bgcolor=FFDDDD | $54C || 82.43 || +1c || bgcolor=DDDDFF | $4EC || 82.41 || +0c | |||
|- | |||
| 41 || F-2 || 87.31 || bgcolor=FFDDDD | $500 || 87.32 || +0c || bgcolor=DDDDFF | $4A5 || 87.32 || +0c | |||
|- | |||
| 42 || F#2 || 92.50 || bgcolor=FFDDDD | $4B8 || 92.52 || +0c || bgcolor=DDDDFF | $462 || 92.53 || +1c | |||
|- | |||
| 43 || G-2 || 98.00 || bgcolor=FFDDDD | $474 || 98.04 || +1c || bgcolor=DDDDFF | $423 || 98.03 || +1c | |||
|- | |||
| 44 || G#2 || 103.83 || bgcolor=FFDDDD | $434 || 103.86 || +1c || bgcolor=DDDDFF | $3E8 || 103.81 || +0c | |||
|- | |||
| 45 || A-2 || 110.00 || bgcolor=FFDDDD | $3F8 || 109.99 || +0c || bgcolor=DDDDFF | $3B0 || 109.96 || -1c | |||
|- | |||
| 46 || A#2 || 116.54 || bgcolor=FFDDDD | $3BF || 116.52 || +0c || bgcolor=DDDDFF | $37B || 116.49 || -1c | |||
|- | |||
| 47 || B-2 || 123.47 || bgcolor=FFDDDD | $389 || 123.47 || +0c || bgcolor=DDDDFF | $349 || 123.41 || -1c | |||
|- | |||
| 48 || C-3 || 130.81 || bgcolor=FFDDDD | $356 || 130.83 || +0c || bgcolor=DDDDFF | $319 || 130.87 || +1c | |||
|- | |||
| 49 || C#3 || 138.59 || bgcolor=FFDDDD | $326 || 138.61 || +0c || bgcolor=DDDDFF | $2ED || 138.55 || -1c | |||
|- | |||
| 50 || D-3 || 146.83 || bgcolor=FFDDDD | $2F9 || 146.80 || +0c || bgcolor=DDDDFF | $2C3 || 146.77 || -1c | |||
|- | |||
| 51 || D#3 || 155.56 || bgcolor=FFDDDD | $2CE || 155.58 || +0c || bgcolor=DDDDFF | $29B || 155.56 || +0c | |||
|- | |||
| 52 || E-3 || 164.81 || bgcolor=FFDDDD | $2A6 || 164.74 || -1c || bgcolor=DDDDFF | $275 || 164.94 || +1c | |||
|- | |||
| 53 || F-3 || 174.61 || bgcolor=FFDDDD | $280 || 174.51 || -1c || bgcolor=DDDDFF | $252 || 174.64 || +0c | |||
|- | |||
| 54 || F#3 || 185.00 || bgcolor=FFDDDD | $25C || 184.89 || -1c || bgcolor=DDDDFF | $231 || 184.90 || -1c | |||
|- | |||
| 55 || G-3 || 196.00 || bgcolor=FFDDDD | $23A || 195.90 || -1c || bgcolor=DDDDFF | $211 || 196.06 || +1c | |||
|- | |||
| 56 || G#3 || 207.65 || bgcolor=FFDDDD | $21A || 207.53 || -1c || bgcolor=DDDDFF | $1F3 || 207.83 || +1c | |||
|- | |||
| 57 || A-3 || 220.00 || bgcolor=FFDDDD | $1FB || 220.20 || +2c || bgcolor=DDDDFF | $1D7 || 220.15 || +1c | |||
|- | |||
| 58 || A#3 || 233.08 || bgcolor=FFDDDD | $1DF || 233.04 || +0c || bgcolor=DDDDFF | $1BD || 232.99 || -1c | |||
|- | |||
| 59 || B-3 || 246.94 || bgcolor=FFDDDD | $1C4 || 246.93 || +0c || bgcolor=DDDDFF | $1A4 || 246.82 || -1c | |||
|- | |||
| 60 || C-4 || 261.63 || bgcolor=FFDDDD | $1AB || 261.36 || -2c || bgcolor=DDDDFF | $18C || 261.75 || +1c | |||
|- | |||
| 61 || C#4 || 277.18 || bgcolor=FFDDDD | $193 || 276.88 || -2c || bgcolor=DDDDFF | $176 || 277.10 || -1c | |||
|- | |||
| 62 || D-4 || 293.66 || bgcolor=FFDDDD | $17C || 293.60 || +0c || bgcolor=DDDDFF | $161 || 293.54 || -1c | |||
|- | |||
| 63 || D#4 || 311.13 || bgcolor=FFDDDD | $167 || 310.72 || -2c || bgcolor=DDDDFF | $14D || 311.12 || +0c | |||
|- | |||
| 64 || E-4 || 329.63 || bgcolor=FFDDDD | $152 || 329.97 || +2c || bgcolor=DDDDFF | $13A || 329.88 || +1c | |||
|- | |||
| 65 || F-4 || 349.23 || bgcolor=FFDDDD | $13F || 349.57 || +2c || bgcolor=DDDDFF | $129 || 348.70 || -3c | |||
|- | |||
| 66 || F#4 || 369.99 || bgcolor=FFDDDD | $12D || 370.40 || +2c || bgcolor=DDDDFF | $118 || 369.80 || -1c | |||
|- | |||
| 67 || G-4 || 392.00 || bgcolor=FFDDDD | $11C || 392.49 || +2c || bgcolor=DDDDFF | $108 || 392.12 || +1c | |||
|- | |||
| 68 || G#4 || 415.30 || bgcolor=FFDDDD | $10C || 415.84 || +2c || bgcolor=DDDDFF | $0F9 || 415.65 || +1c | |||
|- | |||
| 69 || A-4 || 440.00 || bgcolor=FFDDDD | $0FD || 440.40 || +2c || bgcolor=DDDDFF | $0EB || 440.31 || +1c | |||
|- | |||
| 70 || A#4 || 466.16 || bgcolor=FFDDDD | $0EF || 466.09 || +0c || bgcolor=DDDDFF | $0DE || 465.98 || -1c | |||
|- | |||
| 71 || B-4 || 493.88 || bgcolor=FFDDDD | $0E1 || 494.96 || +4c || bgcolor=DDDDFF | $0D1 || 494.82 || +3c | |||
|- | |||
| 72 || C-5 || 523.25 || bgcolor=FFDDDD | $0D5 || 522.71 || -2c || bgcolor=DDDDFF | $0C6 || 522.18 || -4c | |||
|- | |||
| 73 || C#5 || 554.37 || bgcolor=FFDDDD | $0C9 || 553.77 || -2c || bgcolor=DDDDFF | $0BA || 555.68 || +4c | |||
|- | |||
| 74 || D-5 || 587.33 || bgcolor=FFDDDD | $0BD || 588.74 || +4c || bgcolor=DDDDFF | $0B0 || 587.08 || -1c | |||
|- | |||
| 75 || D#5 || 622.25 || bgcolor=FFDDDD | $0B3 || 621.45 || -2c || bgcolor=DDDDFF | $0A6 || 622.23 || +0c | |||
|- | |||
| 76 || E-5 || 659.26 || bgcolor=FFDDDD | $0A9 || 658.00 || -3c || bgcolor=DDDDFF | $09D || 657.68 || -4c | |||
|- | |||
| 77 || F-5 || 698.46 || bgcolor=FFDDDD | $09F || 699.13 || +2c || bgcolor=DDDDFF | $094 || 697.40 || -3c | |||
|- | |||
| 78 || F#5 || 739.99 || bgcolor=FFDDDD | $096 || 740.80 || +2c || bgcolor=DDDDFF | $08B || 742.24 || +5c | |||
|- | |||
| 79 || G-5 || 783.99 || bgcolor=FFDDDD | $08E || 782.24 || -4c || bgcolor=DDDDFF | $084 || 781.30 || -6c | |||
|- | |||
| 80 || G#5 || 830.61 || bgcolor=FFDDDD | $086 || 828.60 || -4c || bgcolor=DDDDFF | $07C || 831.30 || +1c | |||
|- | |||
| 81 || A-5 || 880.00 || bgcolor=FFDDDD | $07E || 880.79 || +2c || bgcolor=DDDDFF | $075 || 880.62 || +1c | |||
|- | |||
| 82 || A#5 || 932.33 || bgcolor=FFDDDD | $077 || 932.17 || +0c || bgcolor=DDDDFF | $06E || 936.15 || +7c | |||
|- | |||
| 83 || B-5 || 987.77 || bgcolor=FFDDDD | $070 || 989.92 || +4c || bgcolor=DDDDFF | $068 || 989.65 || +3c | |||
|- | |||
| 84 || C-6 || 1046.50 || bgcolor=FFDDDD | $06A || 1045.43 || -2c || bgcolor=DDDDFF | $062 || 1049.63 || +5c | |||
|- | |||
| 85 || C#6 || 1108.73 || bgcolor=FFDDDD | $064 || 1107.53 || -2c || bgcolor=DDDDFF | $05D || 1105.46 || -5c | |||
|- | |||
| 86 || D-6 || 1174.66 || bgcolor=FFDDDD | $05E || 1177.48 || +4c || bgcolor=DDDDFF | $057 || 1180.83 || +9c | |||
|- | |||
| 87 || D#6 || 1244.51 || bgcolor=FFDDDD | $059 || 1242.90 || -2c || bgcolor=DDDDFF | $052 || 1251.96 || +10c | |||
|- | |||
| 88 || E-6 || 1318.51 || bgcolor=FFDDDD | $054 || 1316.01 || -3c || bgcolor=DDDDFF | $04E || 1315.35 || -4c | |||
|- | |||
| 89 || F-6 || 1396.91 || bgcolor=FFDDDD | $04F || 1398.26 || +2c || bgcolor=DDDDFF | $049 || 1404.23 || +9c | |||
|- | |||
| 90 || F#6 || 1479.98 || bgcolor=FFDDDD | $04B || 1471.85 || -10c || bgcolor=DDDDFF | $045 || 1484.47 || +5c | |||
|- | |||
| 91 || G-6 || 1567.98 || bgcolor=FFDDDD | $046 || 1575.50 || +8c || bgcolor=DDDDFF | $041 || 1574.44 || +7c | |||
|- | |||
| 92 || G#6 || 1661.22 || bgcolor=FFDDDD | $042 || 1669.56 || +9c || bgcolor=DDDDFF | $03E || 1649.41 || -12c | |||
|- | |||
| 93 || A-6 || 1760.00 || bgcolor=FFDDDD | $03F || 1747.83 || -12c || bgcolor=DDDDFF | $03A || 1761.24 || +1c | |||
|- | |||
| 94 || A#6 || 1864.66 || bgcolor=FFDDDD | $03B || 1864.35 || +0c || bgcolor=DDDDFF | $037 || 1855.59 || -8c | |||
|- | |||
| 95 || B-6 || 1975.53 || bgcolor=FFDDDD | $038 || 1962.47 || -11c || bgcolor=DDDDFF | $034 || 1960.62 || -13c | |||
|- | |||
| 96 || C-7 || 2093.00 || bgcolor=FFDDDD | $034 || 2110.58 || +14c || bgcolor=DDDDFF | $031 || 2078.26 || -12c | |||
|- | |||
| 97 || C#7 || 2217.46 || bgcolor=FFDDDD | $031 || 2237.22 || +15c || bgcolor=DDDDFF | $02E || 2210.91 || -5c | |||
|- | |||
| 98 || D-7 || 2349.32 || bgcolor=FFDDDD | $02F || 2330.43 || -14c || bgcolor=DDDDFF | $02B || 2361.66 || +9c | |||
|- | |||
| 99 || D#7 || 2489.02 || bgcolor=FFDDDD | $02C || 2485.80 || -2c || bgcolor=DDDDFF | $029 || 2474.12 || -10c | |||
|- | |||
| 100 || E-7 || 2637.02 || bgcolor=FFDDDD | $029 || 2663.35 || +17c || bgcolor=DDDDFF | $026 || 2664.43 || +18c | |||
|- | |||
| 101 || F-7 || 2793.83 || bgcolor=FFDDDD | $027 || 2796.52 || +2c || bgcolor=DDDDFF | $024 || 2808.46 || +9c | |||
|- | |||
| 102 || F#7 || 2959.96 || bgcolor=FFDDDD | $025 || 2943.71 || -10c || bgcolor=DDDDFF | $022 || 2968.94 || +5c | |||
|- | |||
| 103 || G-7 || 3135.96 || bgcolor=FFDDDD | $023 || 3107.24 || -16c || bgcolor=DDDDFF | $020 || 3148.88 || +7c | |||
|- | |||
| 104 || G#7 || 3322.44 || bgcolor=FFDDDD | $021 || 3290.02 || -17c || bgcolor=DDDDFF | $01E || 3352.03 || +15c | |||
|- | |||
| 105 || A-7 || 3520.00 || bgcolor=FFDDDD | $01F || 3495.65 || -12c || bgcolor=DDDDFF | $01D || 3463.76 || -28c | |||
|- | |||
| 106 || A#7 || 3729.31 || bgcolor=FFDDDD | $01D || 3728.69 || +0c || bgcolor=DDDDFF | $01B || 3711.18 || -8c | |||
|- | |||
| 107 || B-7 || 3951.07 || bgcolor=FFDDDD | $01B || 3995.03 || +19c || bgcolor=DDDDFF | $019 || 3996.65 || +20c | |||
|- | |||
| 108 || C-8 || 4186.01 || bgcolor=FFDDDD | $01A || 4142.99 || -18c || bgcolor=DDDDFF | $018 || 4156.52 || -12c | |||
|- | |||
| 109 || C#8 || 4434.92 || bgcolor=FFDDDD | $018 || 4474.43 || +15c || bgcolor=DDDDFF | $016 || 4517.95 || +32c | |||
|- | |||
| 110 || D-8 || 4698.64 || bgcolor=FFDDDD | $017 || 4660.87 || -14c || bgcolor=DDDDFF | $015 || 4723.32 || +9c | |||
|- | |||
| 111 || D#8 || 4978.03 || bgcolor=FFDDDD | $015 || 5084.58 || +37c || bgcolor=DDDDFF | $014 || 4948.24 || -10c | |||
|- | |||
| 112 || E-8 || 5274.04 || bgcolor=FFDDDD | $014 || 5326.71 || +17c || bgcolor=DDDDFF | $013 || 5195.65 || -26c | |||
|- | |||
| 113 || F-8 || 5587.65 || bgcolor=FFDDDD | $013 || 5593.04 || +2c || bgcolor=DDDDFF | $012 || 5469.10 || -37c | |||
|- | |||
| 114 || F#8 || 5919.91 || bgcolor=FFDDDD | $012 || 5887.41 || -10c || bgcolor=DDDDFF | $011 || 5772.94 || -44c | |||
|- | |||
| 115 || G-8 || 6271.93 || bgcolor=FFDDDD | $011 || 6214.49 || -16c || bgcolor=DDDDFF | $010 || 6112.53 || -45c | |||
|- | |||
| 116 || G#8 || 6644.88 || bgcolor=FFDDDD | $010 || 6580.05 || -17c || bgcolor=DDDDFF | $00F || 6494.56 || -40c | |||
|- | |||
| 117 || A-8 || 7040.00 || bgcolor=FFDDDD | $00F || 6991.30 || -12c || bgcolor=DDDDFF | $00E || 6927.53 || -28c | |||
|- | |||
| 118 || A#8 || 7458.62 || bgcolor=FFDDDD | $00E || 7457.39 || +0c || bgcolor=DDDDFF | $00D || 7422.35 || -8c | |||
|- | |||
| 119 || B-8 || 7902.13 || bgcolor=FFDDDD | $00D || 7990.06 || +19c || bgcolor=DDDDFF | $00C || 7993.30 || +20c | |||
|- | |||
| 120 || C-9 || 8372.02 || bgcolor=FFDDDD | $00C || 8604.68 || +47c || bgcolor=DDDDFF | $00B || 8659.41 || +58c | |||
|- | |||
| 121 || C#9 || 8869.84 || bgcolor=FFDDDD | $00C || 8604.68 || -53c || bgcolor=DDDDFF | $00B || 8659.41 || -42c | |||
|- | |||
| 122 || D-9 || 9397.27 || bgcolor=FFDDDD | $00B || 9321.73 || -14c || bgcolor=DDDDFF | $00A || 9446.63 || +9c | |||
|- | |||
| 123 || D#9 || 9956.06 || bgcolor=FFDDDD | $00A || 10169.16 || +37c || bgcolor=DDDDFF | $009 || 10391.29 || +74c | |||
|- | |||
| 124 || E-9 || 10548.08 || bgcolor=FFDDDD | $00A || 10169.16 || -63c || bgcolor=DDDDFF | $009 || 10391.29 || -26c | |||
|- | |||
| 125 || F-9 || 11175.30 || bgcolor=FFDDDD | $009 || 11186.08 || +2c || bgcolor=DDDDFF | $008 || 11545.88 || +56c | |||
|- | |||
| 126 || F#9 || 11839.82 || bgcolor=FFDDDD | $008 || 12428.98 || +84c || bgcolor=DDDDFF | $008 || 11545.88 || -44c | |||
|- | |||
| 127 || G-9 || 12543.85 || bgcolor=FFDDDD | $008 || 12428.98 || -16c || bgcolor=DDDDFF | - || - || - | |||
|} | |||
== Code Friendly Tables == | |||
Here are the period values from the above table in ca65 syntax, split into low/high byte halves for convenient indexing. | |||
'''Note''': These include every MIDI index from 0-127. This means the first ~32 entries in the table contain nonsense values, as the equivalent periods are larger than the range of the 11-bit timer. Programmers may wish to trim these early entries to save space. | |||
=== NTSC Periods === | |||
<pre> | |||
ntsc_period_low: | |||
.byte $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff | |||
.byte $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff | |||
.byte $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff | |||
.byte $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff | |||
.byte $ff, $f1, $7f, $13, $ad, $4d, $f3, $9d | |||
.byte $4c, $00, $b8, $74, $34, $f8, $bf, $89 | |||
.byte $56, $26, $f9, $ce, $a6, $80, $5c, $3a | |||
.byte $1a, $fb, $df, $c4, $ab, $93, $7c, $67 | |||
.byte $52, $3f, $2d, $1c, $0c, $fd, $ef, $e1 | |||
.byte $d5, $c9, $bd, $b3, $a9, $9f, $96, $8e | |||
.byte $86, $7e, $77, $70, $6a, $64, $5e, $59 | |||
.byte $54, $4f, $4b, $46, $42, $3f, $3b, $38 | |||
.byte $34, $31, $2f, $2c, $29, $27, $25, $23 | |||
.byte $21, $1f, $1d, $1b, $1a, $18, $17, $15 | |||
.byte $14, $13, $12, $11, $10, $0f, $0e, $0d | |||
.byte $0c, $0c, $0b, $0a, $0a, $09, $08, $08 | |||
ntsc_period_high: | |||
.byte $07, $07, $07, $07, $07, $07, $07, $07 | |||
.byte $07, $07, $07, $07, $07, $07, $07, $07 | |||
.byte $07, $07, $07, $07, $07, $07, $07, $07 | |||
.byte $07, $07, $07, $07, $07, $07, $07, $07 | |||
.byte $07, $07, $07, $07, $06, $06, $05, $05 | |||
.byte $05, $05, $04, $04, $04, $03, $03, $03 | |||
.byte $03, $03, $02, $02, $02, $02, $02, $02 | |||
.byte $02, $01, $01, $01, $01, $01, $01, $01 | |||
.byte $01, $01, $01, $01, $01, $00, $00, $00 | |||
.byte $00, $00, $00, $00, $00, $00, $00, $00 | |||
.byte $00, $00, $00, $00, $00, $00, $00, $00 | |||
.byte $00, $00, $00, $00, $00, $00, $00, $00 | |||
.byte $00, $00, $00, $00, $00, $00, $00, $00 | |||
.byte $00, $00, $00, $00, $00, $00, $00, $00 | |||
.byte $00, $00, $00, $00, $00, $00, $00, $00 | |||
.byte $00, $00, $00, $00, $00, $00, $00, $00 | |||
</pre> | |||
=== PAL Periods === | |||
<pre> | |||
< | pal_period_low: | ||
.byte $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff | |||
.byte $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff | |||
.byte $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff | |||
.byte $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff | |||
.byte $d1, $60, $f6, $92, $34, $db, $86, $37 | |||
.byte $ec, $a5, $62, $23, $e8, $b0, $7b, $49 | |||
.byte $19, $ed, $c3, $9b, $75, $52, $31, $11 | |||
.byte $f3, $d7, $bd, $a4, $8c, $76, $61, $4d | |||
.byte $3a, $29, $18, $08, $f9, $eb, $de, $d1 | |||
.byte $c6, $ba, $b0, $a6, $9d, $94, $8b, $84 | |||
.byte $7c, $75, $6e, $68, $62, $5d, $57, $52 | |||
.byte $4e, $49, $45, $41, $3e, $3a, $37, $34 | |||
.byte $31, $2e, $2b, $29, $26, $24, $22, $20 | |||
.byte $1e, $1d, $1b, $19, $18, $16, $15, $14 | |||
.byte $13, $12, $11, $10, $0f, $0e, $0d, $0c | |||
.byte $0b, $0b, $0a, $09, $09, $08, $08, $07 | |||
pal_period_high: | |||
.byte $07, $07, $07, $07, $07, $07, $07, $07 | |||
.byte $07, $07, $07, $07, $07, $07, $07, $07 | |||
.byte $07, $07, $07, $07, $07, $07, $07, $07 | |||
.byte $07, $07, $07, $07, $07, $07, $07, $07 | |||
.byte $07, $07, $06, $06, $06, $05, $05, $05 | |||
.byte $04, $04, $04, $04, $03, $03, $03, $03 | |||
.byte $03, $02, $02, $02, $02, $02, $02, $02 | |||
.byte $01, $01, $01, $01, $01, $01, $01, $01 | |||
.byte $01, $01, $01, $01, $00, $00, $00, $00 | |||
.byte $00, $00, $00, $00, $00, $00, $00, $00 | |||
.byte $00, $00, $00, $00, $00, $00, $00, $00 | |||
.byte $00, $00, $00, $00, $00, $00, $00, $00 | |||
.byte $00, $00, $00, $00, $00, $00, $00, $00 | |||
.byte $00, $00, $00, $00, $00, $00, $00, $00 | |||
.byte $00, $00, $00, $00, $00, $00, $00, $00 | |||
.byte $00, $00, $00, $00, $00, $00, $00, $00 | |||
</pre> |
Latest revision as of 12:09, 23 September 2024
MIDI Tuning Table
Using the MIDI Tuning Standard with A=440 Hz, we can derive the equivalent period timer value for the two Pulse channels. Due to limitations on the 11-bit period's range, the lowest standard MIDI frequency that can be reproduced with acceptable tuning is A-1 (55 Hz) on NTSC, and G#1 (51.91 Hz) on PAL. Here we show the desired frequency for each MIDI index, the closest period value, and the resulting tuning error (in cents) from the standard.
Note: The Triangle channel can make use of the same 11-bit period values. Due to its longer 32-step sequence, it will sound exactly one octave lower (half of the apparent frequency) compared to the equivalent period on Pulse.
MIDI | NTSC APU Pulse | PAL APU Pulse | ||||||
Index | Note | Frequency | 11bit Period | Frequency | Tuning | 11bit Period | Frequency | Tuning |
---|---|---|---|---|---|---|---|---|
31 | G-1 | 49.00 | - | - | - | $7FF | 50.74 | +60c |
32 | G#1 | 51.91 | $7FF | 54.62 | +88c | $7D1 | 51.90 | +0c |
33 | A-1 | 55.00 | $7F1 | 55.00 | +0c | $760 | 55.01 | +0c |
34 | A#1 | 58.27 | $77F | 58.26 | +0c | $6F6 | 58.28 | +0c |
35 | B-1 | 61.74 | $713 | 61.73 | +0c | $692 | 61.74 | +0c |
36 | C-2 | 65.41 | $6AD | 65.42 | +0c | $634 | 65.40 | +0c |
37 | C#2 | 69.30 | $64D | 69.31 | +0c | $5DB | 69.28 | -1c |
38 | D-2 | 73.42 | $5F3 | 73.40 | +0c | $586 | 73.44 | +0c |
39 | D#2 | 77.78 | $59D | 77.79 | +0c | $537 | 77.78 | +0c |
40 | E-2 | 82.41 | $54C | 82.43 | +1c | $4EC | 82.41 | +0c |
41 | F-2 | 87.31 | $500 | 87.32 | +0c | $4A5 | 87.32 | +0c |
42 | F#2 | 92.50 | $4B8 | 92.52 | +0c | $462 | 92.53 | +1c |
43 | G-2 | 98.00 | $474 | 98.04 | +1c | $423 | 98.03 | +1c |
44 | G#2 | 103.83 | $434 | 103.86 | +1c | $3E8 | 103.81 | +0c |
45 | A-2 | 110.00 | $3F8 | 109.99 | +0c | $3B0 | 109.96 | -1c |
46 | A#2 | 116.54 | $3BF | 116.52 | +0c | $37B | 116.49 | -1c |
47 | B-2 | 123.47 | $389 | 123.47 | +0c | $349 | 123.41 | -1c |
48 | C-3 | 130.81 | $356 | 130.83 | +0c | $319 | 130.87 | +1c |
49 | C#3 | 138.59 | $326 | 138.61 | +0c | $2ED | 138.55 | -1c |
50 | D-3 | 146.83 | $2F9 | 146.80 | +0c | $2C3 | 146.77 | -1c |
51 | D#3 | 155.56 | $2CE | 155.58 | +0c | $29B | 155.56 | +0c |
52 | E-3 | 164.81 | $2A6 | 164.74 | -1c | $275 | 164.94 | +1c |
53 | F-3 | 174.61 | $280 | 174.51 | -1c | $252 | 174.64 | +0c |
54 | F#3 | 185.00 | $25C | 184.89 | -1c | $231 | 184.90 | -1c |
55 | G-3 | 196.00 | $23A | 195.90 | -1c | $211 | 196.06 | +1c |
56 | G#3 | 207.65 | $21A | 207.53 | -1c | $1F3 | 207.83 | +1c |
57 | A-3 | 220.00 | $1FB | 220.20 | +2c | $1D7 | 220.15 | +1c |
58 | A#3 | 233.08 | $1DF | 233.04 | +0c | $1BD | 232.99 | -1c |
59 | B-3 | 246.94 | $1C4 | 246.93 | +0c | $1A4 | 246.82 | -1c |
60 | C-4 | 261.63 | $1AB | 261.36 | -2c | $18C | 261.75 | +1c |
61 | C#4 | 277.18 | $193 | 276.88 | -2c | $176 | 277.10 | -1c |
62 | D-4 | 293.66 | $17C | 293.60 | +0c | $161 | 293.54 | -1c |
63 | D#4 | 311.13 | $167 | 310.72 | -2c | $14D | 311.12 | +0c |
64 | E-4 | 329.63 | $152 | 329.97 | +2c | $13A | 329.88 | +1c |
65 | F-4 | 349.23 | $13F | 349.57 | +2c | $129 | 348.70 | -3c |
66 | F#4 | 369.99 | $12D | 370.40 | +2c | $118 | 369.80 | -1c |
67 | G-4 | 392.00 | $11C | 392.49 | +2c | $108 | 392.12 | +1c |
68 | G#4 | 415.30 | $10C | 415.84 | +2c | $0F9 | 415.65 | +1c |
69 | A-4 | 440.00 | $0FD | 440.40 | +2c | $0EB | 440.31 | +1c |
70 | A#4 | 466.16 | $0EF | 466.09 | +0c | $0DE | 465.98 | -1c |
71 | B-4 | 493.88 | $0E1 | 494.96 | +4c | $0D1 | 494.82 | +3c |
72 | C-5 | 523.25 | $0D5 | 522.71 | -2c | $0C6 | 522.18 | -4c |
73 | C#5 | 554.37 | $0C9 | 553.77 | -2c | $0BA | 555.68 | +4c |
74 | D-5 | 587.33 | $0BD | 588.74 | +4c | $0B0 | 587.08 | -1c |
75 | D#5 | 622.25 | $0B3 | 621.45 | -2c | $0A6 | 622.23 | +0c |
76 | E-5 | 659.26 | $0A9 | 658.00 | -3c | $09D | 657.68 | -4c |
77 | F-5 | 698.46 | $09F | 699.13 | +2c | $094 | 697.40 | -3c |
78 | F#5 | 739.99 | $096 | 740.80 | +2c | $08B | 742.24 | +5c |
79 | G-5 | 783.99 | $08E | 782.24 | -4c | $084 | 781.30 | -6c |
80 | G#5 | 830.61 | $086 | 828.60 | -4c | $07C | 831.30 | +1c |
81 | A-5 | 880.00 | $07E | 880.79 | +2c | $075 | 880.62 | +1c |
82 | A#5 | 932.33 | $077 | 932.17 | +0c | $06E | 936.15 | +7c |
83 | B-5 | 987.77 | $070 | 989.92 | +4c | $068 | 989.65 | +3c |
84 | C-6 | 1046.50 | $06A | 1045.43 | -2c | $062 | 1049.63 | +5c |
85 | C#6 | 1108.73 | $064 | 1107.53 | -2c | $05D | 1105.46 | -5c |
86 | D-6 | 1174.66 | $05E | 1177.48 | +4c | $057 | 1180.83 | +9c |
87 | D#6 | 1244.51 | $059 | 1242.90 | -2c | $052 | 1251.96 | +10c |
88 | E-6 | 1318.51 | $054 | 1316.01 | -3c | $04E | 1315.35 | -4c |
89 | F-6 | 1396.91 | $04F | 1398.26 | +2c | $049 | 1404.23 | +9c |
90 | F#6 | 1479.98 | $04B | 1471.85 | -10c | $045 | 1484.47 | +5c |
91 | G-6 | 1567.98 | $046 | 1575.50 | +8c | $041 | 1574.44 | +7c |
92 | G#6 | 1661.22 | $042 | 1669.56 | +9c | $03E | 1649.41 | -12c |
93 | A-6 | 1760.00 | $03F | 1747.83 | -12c | $03A | 1761.24 | +1c |
94 | A#6 | 1864.66 | $03B | 1864.35 | +0c | $037 | 1855.59 | -8c |
95 | B-6 | 1975.53 | $038 | 1962.47 | -11c | $034 | 1960.62 | -13c |
96 | C-7 | 2093.00 | $034 | 2110.58 | +14c | $031 | 2078.26 | -12c |
97 | C#7 | 2217.46 | $031 | 2237.22 | +15c | $02E | 2210.91 | -5c |
98 | D-7 | 2349.32 | $02F | 2330.43 | -14c | $02B | 2361.66 | +9c |
99 | D#7 | 2489.02 | $02C | 2485.80 | -2c | $029 | 2474.12 | -10c |
100 | E-7 | 2637.02 | $029 | 2663.35 | +17c | $026 | 2664.43 | +18c |
101 | F-7 | 2793.83 | $027 | 2796.52 | +2c | $024 | 2808.46 | +9c |
102 | F#7 | 2959.96 | $025 | 2943.71 | -10c | $022 | 2968.94 | +5c |
103 | G-7 | 3135.96 | $023 | 3107.24 | -16c | $020 | 3148.88 | +7c |
104 | G#7 | 3322.44 | $021 | 3290.02 | -17c | $01E | 3352.03 | +15c |
105 | A-7 | 3520.00 | $01F | 3495.65 | -12c | $01D | 3463.76 | -28c |
106 | A#7 | 3729.31 | $01D | 3728.69 | +0c | $01B | 3711.18 | -8c |
107 | B-7 | 3951.07 | $01B | 3995.03 | +19c | $019 | 3996.65 | +20c |
108 | C-8 | 4186.01 | $01A | 4142.99 | -18c | $018 | 4156.52 | -12c |
109 | C#8 | 4434.92 | $018 | 4474.43 | +15c | $016 | 4517.95 | +32c |
110 | D-8 | 4698.64 | $017 | 4660.87 | -14c | $015 | 4723.32 | +9c |
111 | D#8 | 4978.03 | $015 | 5084.58 | +37c | $014 | 4948.24 | -10c |
112 | E-8 | 5274.04 | $014 | 5326.71 | +17c | $013 | 5195.65 | -26c |
113 | F-8 | 5587.65 | $013 | 5593.04 | +2c | $012 | 5469.10 | -37c |
114 | F#8 | 5919.91 | $012 | 5887.41 | -10c | $011 | 5772.94 | -44c |
115 | G-8 | 6271.93 | $011 | 6214.49 | -16c | $010 | 6112.53 | -45c |
116 | G#8 | 6644.88 | $010 | 6580.05 | -17c | $00F | 6494.56 | -40c |
117 | A-8 | 7040.00 | $00F | 6991.30 | -12c | $00E | 6927.53 | -28c |
118 | A#8 | 7458.62 | $00E | 7457.39 | +0c | $00D | 7422.35 | -8c |
119 | B-8 | 7902.13 | $00D | 7990.06 | +19c | $00C | 7993.30 | +20c |
120 | C-9 | 8372.02 | $00C | 8604.68 | +47c | $00B | 8659.41 | +58c |
121 | C#9 | 8869.84 | $00C | 8604.68 | -53c | $00B | 8659.41 | -42c |
122 | D-9 | 9397.27 | $00B | 9321.73 | -14c | $00A | 9446.63 | +9c |
123 | D#9 | 9956.06 | $00A | 10169.16 | +37c | $009 | 10391.29 | +74c |
124 | E-9 | 10548.08 | $00A | 10169.16 | -63c | $009 | 10391.29 | -26c |
125 | F-9 | 11175.30 | $009 | 11186.08 | +2c | $008 | 11545.88 | +56c |
126 | F#9 | 11839.82 | $008 | 12428.98 | +84c | $008 | 11545.88 | -44c |
127 | G-9 | 12543.85 | $008 | 12428.98 | -16c | - | - | - |
Code Friendly Tables
Here are the period values from the above table in ca65 syntax, split into low/high byte halves for convenient indexing.
Note: These include every MIDI index from 0-127. This means the first ~32 entries in the table contain nonsense values, as the equivalent periods are larger than the range of the 11-bit timer. Programmers may wish to trim these early entries to save space.
NTSC Periods
ntsc_period_low: .byte $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff .byte $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff .byte $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff .byte $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff .byte $ff, $f1, $7f, $13, $ad, $4d, $f3, $9d .byte $4c, $00, $b8, $74, $34, $f8, $bf, $89 .byte $56, $26, $f9, $ce, $a6, $80, $5c, $3a .byte $1a, $fb, $df, $c4, $ab, $93, $7c, $67 .byte $52, $3f, $2d, $1c, $0c, $fd, $ef, $e1 .byte $d5, $c9, $bd, $b3, $a9, $9f, $96, $8e .byte $86, $7e, $77, $70, $6a, $64, $5e, $59 .byte $54, $4f, $4b, $46, $42, $3f, $3b, $38 .byte $34, $31, $2f, $2c, $29, $27, $25, $23 .byte $21, $1f, $1d, $1b, $1a, $18, $17, $15 .byte $14, $13, $12, $11, $10, $0f, $0e, $0d .byte $0c, $0c, $0b, $0a, $0a, $09, $08, $08 ntsc_period_high: .byte $07, $07, $07, $07, $07, $07, $07, $07 .byte $07, $07, $07, $07, $07, $07, $07, $07 .byte $07, $07, $07, $07, $07, $07, $07, $07 .byte $07, $07, $07, $07, $07, $07, $07, $07 .byte $07, $07, $07, $07, $06, $06, $05, $05 .byte $05, $05, $04, $04, $04, $03, $03, $03 .byte $03, $03, $02, $02, $02, $02, $02, $02 .byte $02, $01, $01, $01, $01, $01, $01, $01 .byte $01, $01, $01, $01, $01, $00, $00, $00 .byte $00, $00, $00, $00, $00, $00, $00, $00 .byte $00, $00, $00, $00, $00, $00, $00, $00 .byte $00, $00, $00, $00, $00, $00, $00, $00 .byte $00, $00, $00, $00, $00, $00, $00, $00 .byte $00, $00, $00, $00, $00, $00, $00, $00 .byte $00, $00, $00, $00, $00, $00, $00, $00 .byte $00, $00, $00, $00, $00, $00, $00, $00
PAL Periods
pal_period_low: .byte $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff .byte $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff .byte $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff .byte $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff .byte $d1, $60, $f6, $92, $34, $db, $86, $37 .byte $ec, $a5, $62, $23, $e8, $b0, $7b, $49 .byte $19, $ed, $c3, $9b, $75, $52, $31, $11 .byte $f3, $d7, $bd, $a4, $8c, $76, $61, $4d .byte $3a, $29, $18, $08, $f9, $eb, $de, $d1 .byte $c6, $ba, $b0, $a6, $9d, $94, $8b, $84 .byte $7c, $75, $6e, $68, $62, $5d, $57, $52 .byte $4e, $49, $45, $41, $3e, $3a, $37, $34 .byte $31, $2e, $2b, $29, $26, $24, $22, $20 .byte $1e, $1d, $1b, $19, $18, $16, $15, $14 .byte $13, $12, $11, $10, $0f, $0e, $0d, $0c .byte $0b, $0b, $0a, $09, $09, $08, $08, $07 pal_period_high: .byte $07, $07, $07, $07, $07, $07, $07, $07 .byte $07, $07, $07, $07, $07, $07, $07, $07 .byte $07, $07, $07, $07, $07, $07, $07, $07 .byte $07, $07, $07, $07, $07, $07, $07, $07 .byte $07, $07, $06, $06, $06, $05, $05, $05 .byte $04, $04, $04, $04, $03, $03, $03, $03 .byte $03, $02, $02, $02, $02, $02, $02, $02 .byte $01, $01, $01, $01, $01, $01, $01, $01 .byte $01, $01, $01, $01, $00, $00, $00, $00 .byte $00, $00, $00, $00, $00, $00, $00, $00 .byte $00, $00, $00, $00, $00, $00, $00, $00 .byte $00, $00, $00, $00, $00, $00, $00, $00 .byte $00, $00, $00, $00, $00, $00, $00, $00 .byte $00, $00, $00, $00, $00, $00, $00, $00 .byte $00, $00, $00, $00, $00, $00, $00, $00 .byte $00, $00, $00, $00, $00, $00, $00, $00