\version "2.19.47" \include "articulate.ly" % This file demonstrates how to generate sheet music and video from a single % lilypond source file. Put it into a directory together with videohelper.ily % and the mkvideo script, then translate it with % % lilypond JSBI1 % ./mkvideo % % mkvideo features: % % 1. mkvideo is fast as it runs processes in parallel if possible % % 2. mkvideo keeps music and audio synchronized even if there are % tempo changes in the music and if the number of systems per % page is not constant % % Some INSANE tempo changes to test sync algorithm % voiceone = \relative c' { \time 4/4 \set Score.tempoHideNote = ##f \tempo "Schnell" 4=80 r16 c[d e] f[d e c] g'8[c b^\prall c] d16[g, a b] c[a b g] d'8[g f^\prall g] e16[a g f] e[g f a] g[f e d] c[e d f] e[d c b] a[c b d] c[b a g] fis[a g b] \tempo 4=60 % only for testing a8[d,] c'8.[^\mordent d16] b[a g fis] e[g fis a] g[b a c] b[d c e] d[b32 c d16 g] b,8[^\prall a16 g] g8 r r4 r16 g[a b] c[a b g] fis8^\prall r \tempo 4=40 % only for testing r4 r16 a[b c] d[b c a] b8 r r4 r16 d[c b] a[c b d] c8 r r4 r16 e[d c] \tempo 4=60 % only for testing b[d cis e] d8[cis d e] f[a, b! cis] d[fis, gis a] b[c] d4 ~ d16[e, fis gis] \tempo 4=50 % only for testing a[fis gis e] e'[d c e] d[c b d] c[a' gis b] a[e f d] gis,[f' e d] c8[b16 a] a16[a' g f] e[g f a] g2 ~ g16[e f g] a[f g e] f2 ~ f16[g f e] d[f e g] \tempo 4=80 % only for testing f2 ~ f16[d e f] g[e f d] e2 ~ e16[c d e] f[d e c] d[e f g] a[f g e] f[g a b] c[a b g] c8[g] e[d16 c] c[bes a g] f[a g bes] a[b c e,] \set Score.tempoHideNote = ##t \tempo 4=65 d [ \tempo 4=50 c' \tempo 4=35 f, \tempo 4=20 b] \tempo 4=60 1^\fermata\arpeggio \bar "|." } voicetwo = \relative c { \clef "bass" r2 r16 c[d e] f[d e c] g'8[g,] r4 r16 g'[a b] c[a b g] c8[b c d] e[g, a b] c[e, fis g] a[b] c4 ~ c16[d, e fis] g[e fis d] g8[b, c d] e[fis g e] b8.[c16] d8[d,] r16 g[a b] c[a b g] d'8[g fis g] a16[d, e fis] g[e fis d] a'8[d c d] g,16[\clef "treble" g' f e] d[f e g] f8[e f d] e16[a g f] e[g f a] g8[f g e] f16[bes a g] f[a g bes] a[g f e] d[f e g] f[e d c] b[d c e] d[c b a] gis[b a c] \clef "bass" b8[e,] d'8.[^\mordent e16] c[b a g!] fis[a gis b] a[c b d] c[e d f] e8[a, e' e,] a8[a,] r4 r16 e''16[d c] b[d cis e] d2 ~ d16[a b c] d[b c a] b2 ~ b16[d c b] a[c b d] c2 ~ c16[g a bes] c[a bes g] a8[bes a g] f[d' c bes] a[f' e d] e16[d, e f] g[e f d] e8[c d e] f16[d e f] g8[g,] 1 _\fermata \arpeggio \bar "|." } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% PRINT version A4 %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # ( set-global-staff-size 17.0 ) \book{ \header { composer = "Johann Sebastian Bach (1685-1750)" title = "Invention 1" opus = "BWV 772" tagline = ##f } \paper { #(set-paper-size "a4") left-margin = 1.5\cm line-width = 18\cm top-margin = 1.5\cm bottom-margin = 1.5\cm horizontal-shift = 0\mm ragged-bottom = ##f ragged-last-bottom = ##f print-page-number = ##f } \score { \new PianoStaff << \set PianoStaff.connectArpeggios = ##t \context Staff = "one" << \voiceone >> \context Staff = "two" << \voicetwo >> >> \layout{ indent = 0.0 } } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% VIDEO version %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #(set! paper-alist (cons '("video" . (cons (* 21 cm) (* 10.5 cm))) paper-alist)) \include "videohelper.ily" # ( set-global-staff-size 24 ) \book{ \header { title = \markup \center-column { \line \bold \fontsize #5 { Invention 1 } \vspace #.25 \line \bold \fontsize #2 { Johann Sebastian Bach } \vspace #.5 \line \medium \fontsize #0 { Video made with the help of Lilypond} \line \medium \fontsize #0 { and other open source tools.} \vspace #.5 \line \medium \fontsize #0 { Demonstrates how to synchronize video and audio even in } \line \medium \fontsize #0 { the presence of tempo changes and in case of a variable} \line \medium \fontsize #0 { number of systems per page.} } tagline = ##f } \paper { #(set-paper-size "video") left-margin = 1\cm line-width = 19.5\cm top-margin = 1\cm bottom-margin = 1\cm horizontal-shift = 0\mm ragged-bottom = ##f ragged-last-bottom = ##f print-page-number = ##f max-systems-per-page = #2 } \pageBreak \score { \new PianoStaff << \set PianoStaff.connectArpeggios = ##t \context Staff = "one" << \voiceone >> \context Staff = "two" << \voicetwo >> >> \layout{ indent = 0.0 } } } \pdfforvideo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% MIDI %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% panmidi = { \set Staff.midiInstrument = #"pan flute" \set Staff.midiMinimumVolume = #0.2 \set Staff.midiMaximumVolume = #0.2 } pianomidi = { \set Staff.midiInstrument = #"acoustic grand" \set Staff.midiMinimumVolume = #0.2 \set Staff.midiMaximumVolume = #0.2 } \book{ \score { \unfoldRepeats \articulate << \new PianoStaff << \set PianoStaff.connectArpeggios = ##t \context Staff = "one" << {\panmidi \voiceone {r1*3 \tempo 1 = 1}} >> \context Staff = "two" << {\panmidi \voicetwo} >> >> >> \midi { \context { \Score midiMinimumVolume = #0.0 midiMaximumVolume = #1.0 } } } } \midiforvideo \book{ \score { \unfoldRepeats \articulate << \new PianoStaff << \set PianoStaff.connectArpeggios = ##t \context Staff = "one" << {\pianomidi \voiceone {r1*3 \tempo 1 = 1}} >> \context Staff = "two" << {\pianomidi \voicetwo} >> >> >> \midi { \context { \Score midiMinimumVolume = #0.0 midiMaximumVolume = #1.0 } } } } \midiforvideo