#Naomi Hamermesh #Theme from the New World Symphony by Antonin Dvorak (1841-1904) #Duet arrangement from "Learn to Play flute duets" compiled, edited, and arranged by William Eisenhauer. #Percussion part by Naomi Hamermesh from myro import * from myro.chuck import * initChuck() #First I create a shortcut be defining the frequencies for all of the notes I will need in my piece. C = 261.63 D = 293.66 E = 329.63 F = 349.23 G = 392 Gs = 415.3 A = 440 B = 493.88 #Then I define a shortcut function to play a note given an instrument, frequency, beat, and strength. def playIt(instrument,frequency,beat,strength): instrument.setFrequency(frequency) instrument.noteOn(strength) wait(beat) instrument.noteOff(strength) #Next I define a function for the bottom part of the duet using the Plucked String Instrument in Chuck. def newWorldPlucked(): ps = PluckedString() ps.connect() beat = 0.7 ps.setGain(0.3) playIt(ps, C, beat, 1.0) playIt(ps, G/2, beat, 1.0) playIt(ps, E, beat, 1.0) playIt(ps, G/2, beat, 1.0) playIt(ps, C, beat, 1.0) playIt(ps, G/2, beat, 1.0) playIt(ps, E/2, beat, 1.0) playIt(ps, G/2, beat, 1.0) playIt(ps, B/2, beat, 1.0) playIt(ps, G/2, beat, 1.0) playIt(ps, B/2, beat, 1.0) playIt(ps, G/2, beat, 1.0) playIt(ps, F/2, beat*1.5, 1.0) playIt(ps, F/2, beat*0.5, 1.0) playIt(ps, A/2, beat, 1.0) playIt(ps, G/2, beat, 1.0) playIt(ps, C, beat, 1.0) playIt(ps, G/2, beat, 1.0) playIt(ps, E, beat, 1.0) playIt(ps, G/2, beat, 1.0) playIt(ps, Gs/2, beat, 1.0) playIt(ps, B/2, beat, 1.0) playIt(ps, A/2, beat, 1.0) playIt(ps, G/2, beat, 1.0) playIt(ps, F/2, beat, 1.0) playIt(ps, G/2, beat, 1.0) playIt(ps, F/2, beat, 1.0) playIt(ps, G/2, beat, 1.0) playIt(ps, E/2, beat, 1.0) playIt(ps, G/2, beat, 1.0) playIt(ps, G/2, beat, 1.0) playIt(ps, C, beat, 1.0) ps.setGain(0.4) playIt(ps, E, beat*1.5, 1.0) playIt(ps, A, beat*0.5, 1.0) playIt(ps, A, beat*2, 1.0) playIt(ps, G, beat, 1.0) playIt(ps, E, beat, 1.0) playIt(ps, F, beat*2, 1.0) playIt(ps, F, beat, 1.0) playIt(ps, A, beat, 1.0) playIt(ps, G, beat, 1.0) playIt(ps, E, beat, 1.0) playIt(ps, F, beat*2, 1.0) playIt(ps, F, beat, 1.0) playIt(ps, C, beat, 1.0) playIt(ps, F, beat*1.5, 1.0) playIt(ps, A, beat*0.5, 1.0) playIt(ps, A, beat*2, 1.0) playIt(ps, G, beat, 1.0) playIt(ps, E, beat, 1.0) playIt(ps, F, beat, 1.0) playIt(ps, C, beat, 1.0) playIt(ps, F, beat, 1.0) playIt(ps, A, beat, 1.0) playIt(ps, G, beat, 1.0) playIt(ps, E, beat, 1.0) playIt(ps, F, beat, 1.0) playIt(ps, D, beat, 1.0) playIt(ps, F, beat, 1.0) playIt(ps, D, beat, 1.0) ps.setGain(0.3) playIt(ps, C, beat, 1.0) playIt(ps, G/2, beat, 1.0) playIt(ps, C, beat, 1.0) playIt(ps, E, beat, 1.0) playIt(ps, C, beat, 1.0) playIt(ps, G/2, beat, 1.0) playIt(ps, E/2, beat, 1.0) playIt(ps, G/2, beat, 1.0) playIt(ps, B/2, beat, 1.0) playIt(ps, G/2, beat, 1.0) playIt(ps, B/2, beat, 1.0) playIt(ps, G/2, beat, 1.0) playIt(ps, F/2, beat*1.5, 1.0) playIt(ps, F/2, beat*0.5, 1.0) playIt(ps, A/2, beat, 1.0) playIt(ps, G/2, beat, 1.0) ps.setGain(0.6) playIt(ps, E/2, beat*1.5, 1.0) playIt(ps, G/2, beat*0.5, 1.0) playIt(ps, G/2, beat*2, 1.0) playIt(ps, A/2, beat, 1.0) playIt(ps, F/2, beat, 1.0) ps.setGain(0.7) playIt(ps, G/2, beat, 1.0) playIt(ps, C, beat, 1.0) playIt(ps, F/2, beat, 1.0) playIt(ps, A/2, beat, 1.0) playIt(ps, F/2, beat*2, 1.0) ps.setGain(0.6) playIt(ps, E/2, beat*1.5, 1.0) playIt(ps, G/2, beat*0.5, 1.0) ps.setGain(0.7) playIt(ps, C, beat, 1.0) playIt(ps, E, beat, 1.0) playIt(ps, D, beat*1.5, 1.0) playIt(ps, C, beat*0.5, 1.0) playIt(ps, D, beat, 1.0) playIt(ps, A/2, beat, 1.0) playIt(ps, C, beat*6, 1.0) #In order to get the Plucked String to work properly, I need to get Chuck used to it. ps = PluckedString() ps.connect() ps.noteOn(1) wait(5) #Now I will define a function for the top part of the duet using the Voice instrument in Chuck. def newWorldVoice(): v = Voice() v.connect() beat = 0.7 v.setGain(1) playIt(v, E, beat*1.5, 1.0) playIt(v, G, beat*0.5, 1.0) playIt(v, G, beat*2, 1.0) playIt(v, E, beat*1.5, 1.0) playIt(v, D, beat*0.5, 1.0) playIt(v, C, beat*2, 1.0) playIt(v, D, beat*1.5, 1.0) playIt(v, E, beat*0.5, 1.0) playIt(v, G, beat*1.5, 1.0) playIt(v, E, beat*0.5, 1.0) playIt(v, D, beat*4, 1.0) playIt(v, E, beat*1.5, 1.0) playIt(v, G, beat*0.5, 1.0) playIt(v, G, beat*2, 1.0) playIt(v, E, beat*1.5, 1.0) playIt(v, D, beat*0.5, 1.0) playIt(v, C, beat*2, 1.0) playIt(v, D, beat*1.5, 1.0) playIt(v, E, beat*0.5, 1.0) playIt(v, D, beat*1.5, 1.0) playIt(v, C, beat*0.5, 1.0) playIt(v, C, beat*4, 1.0) v.setGain(2) playIt(v, A, beat*1.5, 1.0) playIt(v, C*2, beat*0.5, 1.0) playIt(v, C*2, beat*2, 1.0) playIt(v, B, beat, 1.0) playIt(v, G, beat, 1.0) playIt(v, A, beat*2, 1.0) playIt(v, A, beat, 1.0) playIt(v, C*2, beat, 1.0) playIt(v, B, beat, 1.0) playIt(v, G, beat, 1.0) playIt(v, A, beat*4, 1.0) playIt(v, A, beat*1.5, 1.0) playIt(v, C*2, beat*0.5, 1.0) playIt(v, C*2, beat*2, 1.0) playIt(v, B, beat, 1.0) playIt(v, G, beat, 1.0) playIt(v, A, beat*2, 1.0) playIt(v, A, beat, 1.0) playIt(v, C*2, beat, 1.0) playIt(v, B, beat, 1.0) playIt(v, G, beat, 1.0) playIt(v, A, beat*4, 1.0) v.setGain(1) playIt(v, E, beat*1.5, 1.0) playIt(v, G, beat*0.5, 1.0) playIt(v, G, beat*2, 1.0) playIt(v, E, beat*1.5, 1.0) playIt(v, D, beat*0.5, 1.0) playIt(v, C, beat*2, 1.0) playIt(v, D, beat*1.5, 1.0) playIt(v, E, beat*0.5, 1.0) playIt(v, G, beat*1.5, 1.0) playIt(v, E, beat*0.5, 1.0) playIt(v, D, beat*4, 1.0) v.setGain(1.2) playIt(v, E/2, beat*1.5, 1.0) playIt(v, G/2, beat*0.5, 1.0) playIt(v, G/2, beat*2, 1.0) playIt(v, C, beat*1.5, 1.0) v.setGain(1.3) playIt(v, D, beat*0.5, 1.0) playIt(v, E, beat*2, 1.0) playIt(v, D, beat*1.5, 1.0) playIt(v, C, beat*0.5, 1.0) playIt(v, D, beat, 1.0) v.setGain(1) playIt(v, A/2, beat, 1.0) playIt(v, C, beat*2, 1.0) v.disconnect() wait(beat*3) v.connect() v.setGain(0.8) playIt(v, G/2, beat, 1.0) playIt(v, F/2, beat*2, 1.0) playIt(v, E/2, beat*6, 1.0) #Now I will define a function for the percussion part using the Guiro instrument in Chuck. def newWorldPerc(): s = Shakers() s.connect() s.setGain(4) s.preset(3) beat = 0.7 for i in range(26): wait(beat*0.5) s.noteOn(1) wait(beat*0.5) s.noteOn(0.7) wait(beat*0.5) s.noteOn(0.7) wait(beat*0.5) s.noteOn(1) wait(beat) s.noteOn(1) wait(beat) s.noteOn(1) wait(beat) s.noteOn(1) #Now let's put it all together! #doTogether(newWorldVoice,newWorldPlucked,newWorldPerc)