Skip to content

Instantly share code, notes, and snippets.

@qoelet
Last active December 21, 2015 16:39
Show Gist options
  • Save qoelet/6335326 to your computer and use it in GitHub Desktop.
Save qoelet/6335326 to your computer and use it in GitHub Desktop.
import Euterpea
t251 :: Music Pitch
t251 = let dMinor = d 4 wn :=: f 4 wn :=: a 4 wn
gMajor = g 4 wn :=: b 4 wn :=: d 5 wn
cMajor = c 4 bn :=: e 4 bn :=: g 4 bn
in dMinor :+: gMajor :+: cMajor
-- solution for exercise 2.1
twoFiveOne :: Pitch -> Dur -> Music Pitch
twoFiveOne p d = (note d p :=: note d (trans (3) p) :=: note d (trans (7) p)) :+:
(note d (trans (5) p) :=: note d (trans (9) p) :=: note d (trans (12) p)) :+:
(note (d*2) (trans (-2) p) :=: note (d*2) (trans (2) p) :=: note (d*2) (trans (5) p))
-- *Main> t251 == (twoFiveOne (D,4) wn)
-- True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment