Skip to content

Instantly share code, notes, and snippets.

@dunvi
Created July 7, 2012 21:09
Show Gist options
  • Save dunvi/3068099 to your computer and use it in GitHub Desktop.
Save dunvi/3068099 to your computer and use it in GitHub Desktop.
praeludium1
import Euterpea
-- praeludium 1 consists almost entirely of a repeating half-base sequence
-- therefore i will write a function that will accept 5 notes that define
-- that sequence. preferably i would be even cooler and write it to take in
-- a single chord that would be immediately interpreted to the correct sequence
-- but, ah well.
-- ghci> playA defPMap newCon praeludium1
playMe = playA defPMap newCon praeludium1
newCon = Context { cTime = 0,
cPlayer = defPlayer,
cInst = AcousticGrandPiano,
cDur = metro 60 qn,
cKey = 0,
cVol = 127 }
addDur :: Dur -> [Dur -> Music a] -> Music a
addDur d ns = let f n = n d
in line $ map f ns
-- the sequence used in praeludium 1 - note that it always repeats 2ce
p1 :: [Dur -> Music Pitch] -> Music Pitch
p1 (n1:n2:ns) = timesM 2 $ down :=: ring :=: arpp
where down = n1 hn
ring = snr :+: (n2 $ den + qn)
arpp = enr :+: (timesM 2 $ addDur sn ns)
--
praeludium1 = foldr1 (:+:) (map p1 aline) :+: a33 :+: a34
--
aline = [a01, a02, a03, a04, a05, a06, a07, a08, a09, a10,
a11, a12, a13, a14, a15, a16, a17, a18, a19, a20,
a21, a22, a23, a24, a25, a26, a27, a28, a29, a30,
a31, a32]
--
a33 = down :=: ring :=: arpp
where down = c 3 wn
ring = snr :+: c 4 (den + dhn)
arpp = enr :+: addDur sn [f 4, a 4, c 5, f 5, c 5, a 4, c 5, a 4, f 4, a 4, f 4, d 4, f 4, d 4]
--
a34 = down :=: ring :=: arpp
where down = c 3 (wn * 3)
ring = snr :+: b 3 (den + dhn) :+: c 4 (wn * 2)
arpp = enr :+: addDur sn [g 5, b 5, d 6, f 6, d 6, b 5, d 6, b 5, g 5, b 5, d 5, f 5, e 5, d 5]
:+: ((e 5 (wn * 2)) :=: (g 5 (wn * 2)) :=: (c 6 (wn * 2)))
--
-- some arpeggios
a01 = [ c 5, e 5, g 5, c 6, e 6]
a02 = [ c 5, d 5, a 5, d 6, f 6]
a03 = [ b 4, d 5, g 5, d 6, f 6]
a04 = a01
a05 = [ c 5, e 5, a 5, e 6, a 6]
a06 = [ c 5, d 5, fs 5, a 5, d 6]
a07 = [ b 4, d 5, g 5, d 6, g 6]
a08 = (b 4):a89
a09 = (a 4):a89
a10 = [ d 4, a 4, d 5, fs 5, c 6]
a11 = [ g 4, b 4, d 5, g 5, b 5]
a12 = [ g 4, bf 4, e 5, g 5, cs 6]
a13 = [ f 4, a 4, d 5, a 5, d 6]
a14 = [ f 4, af 4, d 5, f 5, b 5]
a15 = [ e 4, g 4, c 5, g 5, c 6]
a16 = (e 4):a1617
a17 = (d 4):a1617
a18 = [ g 3, d 4, g 4, b 4, f 5]
a19 = (c 4):a1925
a20 = [ c 4, g 4, bf 4, c 5, e 5]
a21 = [ f 3, f 4, a 4, c 5, e 5]
a22 = [fs 3, c 4, a 4, c 5, ef 5]
a23 = [af 3, f 4, b 4, c 5, d 5]
a24 = [ g 3, f 4, g 4, b 4, d 5]
a25 = (g 3):a1925
a26 = [ g 3, d 4, g 4, c 5, f 5]
a27 = a18
a28 = [ g 3, ef 4, a 4, c 5, fs 5]
a29 = [ g 3, e 4, g 4, c 5, g 5]
a30 = a26
a31 = a18
a32 = [ c 3, c 4, g 4, bf 4, e 5]
a89 = [c 5, e 5, g 5, c 6]
a1617 = [f 4, a 4, c 5, f 5]
a1925 = [e 4, g 4, c 5, e 5]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment