#include <stdint.h>
#include "player.h"

#define NOTE_FREQUENCY(f) ((uint16_t)(PSG_CLOCK/(32*f)))

uint16_t note_periods[] = {
    NOTE_FREQUENCY(16.35),      // C-0
    NOTE_FREQUENCY(17.32),      // C#0
    NOTE_FREQUENCY(18.35),      // D-0
    NOTE_FREQUENCY(19.45),      // D#0
    NOTE_FREQUENCY(20.60),      // E-0
    NOTE_FREQUENCY(21.83),      // F-0
    NOTE_FREQUENCY(23.12),      // F#0
    NOTE_FREQUENCY(24.50),      // G-0
    NOTE_FREQUENCY(25.96),      // G#0
    NOTE_FREQUENCY(27.50),      // A-0
    NOTE_FREQUENCY(29.14),      // A#0
    NOTE_FREQUENCY(30.87),      // B-0

    NOTE_FREQUENCY(32.70),      // C-1
    NOTE_FREQUENCY(34.65),      // C#1
    NOTE_FREQUENCY(36.71),      // D-1
    NOTE_FREQUENCY(38.89),      // D#1
    NOTE_FREQUENCY(41.20),      // E-1
    NOTE_FREQUENCY(43.65),      // F-1
    NOTE_FREQUENCY(46.25),      // F#1
    NOTE_FREQUENCY(49.00),      // G-1
    NOTE_FREQUENCY(51.91),      // G#1
    NOTE_FREQUENCY(55.00),      // A-1
    NOTE_FREQUENCY(58.27),      // A#1
    NOTE_FREQUENCY(61.74),      // B-1

    NOTE_FREQUENCY(65.41),      // C-2
    NOTE_FREQUENCY(69.30),      // C#2
    NOTE_FREQUENCY(73.42),      // D-2
    NOTE_FREQUENCY(77.78),      // D#2
    NOTE_FREQUENCY(82.41),      // E-2
    NOTE_FREQUENCY(87.31),      // F-2
    NOTE_FREQUENCY(92.50),      // F#2
    NOTE_FREQUENCY(98.00),      // G-2
    NOTE_FREQUENCY(103.83),     // G#2
    NOTE_FREQUENCY(110.00),     // A-2
    NOTE_FREQUENCY(116.54),     // A#2
    NOTE_FREQUENCY(123.47),     // B-2

    NOTE_FREQUENCY(130.81),     // C-3
    NOTE_FREQUENCY(138.59),     // C#3
    NOTE_FREQUENCY(146.83),     // D-3
    NOTE_FREQUENCY(155.56),     // D#3
    NOTE_FREQUENCY(164.81),     // E-3
    NOTE_FREQUENCY(174.61),     // F-3
    NOTE_FREQUENCY(185.00),     // F#3
    NOTE_FREQUENCY(196.00),     // G-3
    NOTE_FREQUENCY(207.65),     // G#3
    NOTE_FREQUENCY(220.00),     // A-3
    NOTE_FREQUENCY(233.08),     // A#3
    NOTE_FREQUENCY(246.94),     // B-3

    NOTE_FREQUENCY(261.63),     // C-4
    NOTE_FREQUENCY(277.18),     // C#4
    NOTE_FREQUENCY(293.66),     // D-4
    NOTE_FREQUENCY(311.13),     // D#4
    NOTE_FREQUENCY(329.63),     // E-4
    NOTE_FREQUENCY(349.23),     // F-4
    NOTE_FREQUENCY(369.99),     // F#4
    NOTE_FREQUENCY(392.00),     // G-4
    NOTE_FREQUENCY(415.30),     // G#4
    NOTE_FREQUENCY(440.00),     // A-4
    NOTE_FREQUENCY(466.16),     // A#4
    NOTE_FREQUENCY(493.88),     // B-4

    NOTE_FREQUENCY(523.25),     // C-5
    NOTE_FREQUENCY(554.37),     // C#5
    NOTE_FREQUENCY(587.33),     // D-5
    NOTE_FREQUENCY(622.25),     // D#5
    NOTE_FREQUENCY(659.26),     // E-5
    NOTE_FREQUENCY(698.46),     // F-5
    NOTE_FREQUENCY(739.99),     // F#5
    NOTE_FREQUENCY(783.99),     // G-5
    NOTE_FREQUENCY(830.61),     // G#5
    NOTE_FREQUENCY(880.00),     // A-5
    NOTE_FREQUENCY(932.33),     // A#5
    NOTE_FREQUENCY(987.77),     // B-5

    NOTE_FREQUENCY(1046.50),    // C-6
    NOTE_FREQUENCY(1108.73),    // C#6
    NOTE_FREQUENCY(1174.66),    // D-6
    NOTE_FREQUENCY(1244.51),    // D#6
    NOTE_FREQUENCY(1318.51),    // E-6
    NOTE_FREQUENCY(1396.91),    // F-6
    NOTE_FREQUENCY(1479.98),    // F#6
    NOTE_FREQUENCY(1567.98),    // G-6
    NOTE_FREQUENCY(1661.22),    // G#6
    NOTE_FREQUENCY(1760.00),    // A-6
    NOTE_FREQUENCY(1864.66),    // A#6
    NOTE_FREQUENCY(1975.53),    // B-6

    NOTE_FREQUENCY(2093.00),    // C-7
    NOTE_FREQUENCY(2217.46),    // C#7
    NOTE_FREQUENCY(2349.32),    // D-7
    NOTE_FREQUENCY(2489.02),    // D#7
    NOTE_FREQUENCY(2637.02),    // E-7
    NOTE_FREQUENCY(2793.83),    // F-7
    NOTE_FREQUENCY(2959.96),    // F#7
    NOTE_FREQUENCY(3135.96),    // G-7
    NOTE_FREQUENCY(3322.44),    // G#7
    NOTE_FREQUENCY(3520.00),    // A-7
    NOTE_FREQUENCY(3729.31),    // A#7
    NOTE_FREQUENCY(3951.07),    // B-7
};