
#15-110 Lab 8 Sound
# composer.py

from snd110 import *

#Time in Seconds of Smallest
# note in our song
tempo = 0.15

#Define the duration
# of each note based
# on the tempo
sixteenth = tempo
eighth = 2*sixteenth
quarter = 2*eighth
half = 2*quarter
dotted_half = 3*quarter 
whole = 4*quarter

#Musical Note Frequency Definitions
C4 = 261.626   # middle C
C4sh = 277.183 # C#/Db
D4 = 293.665   # D
D4sh = 311.127 # D#/Eb
E4 = 329.628
F4 = 349.228
F4sh = 269.994
G4 = 391.995
G4sh = 415.305
A4 = 440
A4sh = 466.164
B4 = 493.833
C5 = 523.251 # C (1 octave higher than C4)
C5sh =554.365
D5 = 587.330
D5sh = 622.254
E5 = 659.255
F5 = 698.456
F5sh = 739.989
G5 = 783.991
G5sh = 830.609
A5 = 880
A5sh = 932.328
B5 = 987.767
C6 = 1046.5
C6sh = 1108.73
D6 = 1174.66
D6sh = 1244.51
E6 = 1318.51
F6 = 1396.91
G6 = 1567.98

#A song is composed of a note
# (frequency) and the length
# that a note is played.
lullaby = [ [B4, half], [D5, quarter], [A4, half], [G4, eighth],
            [A4, eighth],[B4, half],  [D5, quarter],[A4, dotted_half],
            [B4, half], [D5, quarter], [A5, half], [G5, quarter],
            [D5, half], [C5, eighth], [B4, eighth], [A4, dotted_half],
            [B4, half], [D5, quarter], [A4, half], [G4, eighth],
            [A4, eighth], [B4, half], [D5, quarter],[A4, dotted_half],
            [B4, half], [D5, quarter], [A5, half], [G5, quarter],
            [D6, 7*quarter],[D6, half],[C6, eighth],[B5, eighth],
            [C6, eighth], [B5, eighth], [G5, half], [C6, half],
            [B5, eighth], [A5, eighth], [B5, eighth],[A5, eighth],
            [E5, half], [D6, half], [C6, eighth], [B5, eighth],
            [C6, eighth], [B5, eighth], [G5, quarter], [C6, quarter],
            [G6, 3*half], [0, 2*half] ]

def write_song(song,file_name):
    return None


class_song = []
