* Modal Cycle 2 ** Processing *** DONE Keys Data #+tblname: keys-table | c | d | e | f | g | a | b | | g | a | b | c | d | e | fis | | d | e | fis | g | a | b | cis | | a | b | cis | d | e | fis | gis | | e | fis | gis | a | b | cis | dis | | b | cis | dis | e | fis | gis | ais | | ges | aes | bes | ces | des | ees | f | | des | ees | f | ges | aes | bes | c | | aes | bes | c | des | ees | f | g | | ees | f | g | aes | bes | c | d | | bes | c | d | ees | f | g | a | | f | g | a | bes | c | d | e | *** DONE Generate Triad #+name: gen-triad(key="c",root="c") #+begin_src ruby :var keys=keys-table :var key_of=keys-table[*,0] :results silent key_id = key_of.index(key) @key = keys[ key_id ] @root_id = @key.index(root) def triad(key,root,value,interval) " < #{@key.fetch((@root_id + value -1) % 7)} \ #{@key.fetch((@root_id + value +1) % 7)} \ #{@key.fetch((@root_id + value +3) % 7)} > \ #{interval} " end "\\relative g {" + "\n" + triad(key, root, 4, 4) + triad(key, root, 4, 4) + triad(key, root, 4, 4) + triad(key, root, 4, 4) + "|\n" + triad(key, root, 5, 4) + triad(key, root, 5, 4) + triad(key, root, 5, 4) + triad(key, root, 5, 4) + "|\n" + triad(key, root, 4, 4) + triad(key, root, 4, 4) + triad(key, root, 4, 4) + triad(key, root, 4, 4) + "|\n" + triad(key, root, 5, 4) + triad(key, root, 5, 4) + triad(key, root, 5, 4) + triad(key, root, 5, 4) + "|\n" + "}" #+end_src *** DONE Generate arpeggio #+name: gen_arpeggio(key="c", root="c") #+begin_src ruby :var keys=keys-table :var key_of=keys-table[*,0] :results silent key_id = key_of.index(key) @key = keys[ key_id ] @root_id = @key.index(root) def arpeggio(key, root,ascending) if ascending == 1 x,y = 0, 1 else x,y = 7, -1 end notes = "" 8.times do notes += @key.fetch((@root_id + x) % 7) + "16 " x = x + y end notes + "r2" end "\\relative g {" + arpeggio(key , root , 1) + " } | r1 | \ \\relative g'' {" + arpeggio(key , root , 0) + " } | r1 | \n" #+end_src *** DONE Generate Bass Line #+name: generate_bassline(root="c") #+begin_src ruby :results silent one_bar = " #{root}8 #{root} #{root} #{root} " + "#{root} #{root} #{root} #{root}'16 #{root},16 " "\\relative g, { " + "\n" + one_bar + "|\n" + one_bar + "|\n" + one_bar + "|\n" + one_bar + "|\n} " #+end_src ** Version SCHEDULED: <2011-07-08 Fri> #+begin_src lilypond \version "2.12.3" #+end_src ** Arpeggios #+begin_src lilypond Arps = { <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> < g, d, g' b c g > 1 } #+end_src ** Triads #+begin_src lilypond Triads = { <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> } #+end_src ** Drums (four bars) #+begin_src lilypond DrumsFourBars = { \drummode { bd16 hh16 hh16 hh16 sn16 hh16 hh16 hh16 bd16 hh16 hh16 hh16 sn16 hh16 hh16 hh16 | bd16 hh16 hh16 hh16 sn16 hh16 hh16 hh16 bd16 hh16 hh16 hh16 sn16 hh16 hh16 bd16 | bd16 hh16 hh16 hh16 sn16 hh16 hh16 hh16 bd16 hh16 hh16 hh16 sn16 hh16 hh16 hh16 | bd16 hh16 hh16 hh16 sn16 hh16 hh16 hh16 bd16 hh16 hh16 hh16 sn16 hh16 sn16 bd16 | } } DrumsSixteenBars = { \DrumsFourBars \DrumsFourBars \DrumsFourBars \DrumsFourBars } #+end_src #+begin_src lilypond Drums = { \DrumsSixteenBars \DrumsSixteenBars \DrumsSixteenBars \DrumsSixteenBars \DrumsSixteenBars \DrumsSixteenBars \DrumsSixteenBars \DrumsSixteenBars \DrumsSixteenBars \DrumsSixteenBars \DrumsSixteenBars \DrumsSixteenBars \DrumsSixteenBars \DrumsSixteenBars \DrumsSixteenBars \DrumsSixteenBars \DrumsSixteenBars \DrumsSixteenBars \DrumsSixteenBars \DrumsSixteenBars \DrumsSixteenBars \DrumsFourBars } #+end_src ** Bass #+begin_src lilypond Bass = { <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> } #+end_src ** Number of bars to compile (showLastLength) #+begin_src lilypond % showLastLength = R1*9 #+end_src ** Score #+begin_src lilypond \score { << \new Staff { \key c \major \set Staff.midiInstrument = #"acoustic grand" \Arps } \new Staff { \key c \major \set Staff.midiInstrument = #"acoustic grand" \Triads } \new Staff { \clef bass \key c \major \set Staff.midiInstrument = #"slap bass 2" \Bass } \new DrumStaff { \Drums } >> \layout { } \midi { \context { \Score tempoWholesPerMinute = #(ly:make-moment 120 4) } } } #+end_src ** Paper #+begin_src lilypond \paper { #(define dump-extents #t) indent = 0\mm line-width = 200\mm - 2.0 * 0.4\in ragged-right = #"" force-assignment = #"" line-width = #(- line-width (* mm 3.000000)) } #+end_src ** Header #+begin_src lilypond \header { title = \markup \center-column {"Modal Cycle"} composer = \markup \center-column { "Music by" \small "Martyn Jago" } poet = \markup \center-column { "ob-lilypond" \small "example 3" } } #+end_src