# Musical note frequencies in the 12 equal temperament system

let frequency_A4: Frequency = 440 Hz  # the A above middle C, A4

fn note_frequency(n: Scalar) -> Frequency = frequency_A4 * 2^(n / 12)

print("A5: {note_frequency(12)}")  # one octave higher up, 880 Hz
print("E4: {note_frequency(7)}")
print("C4: {note_frequency(-3)}")
assert_eq(note_frequency(12), 2 * frequency_A4)
assert_eq(note_frequency(7),  659.255 Hz, 1 mHz)
assert_eq(note_frequency(-3), 369.994 Hz, 1 mHz)
