]> git.donarmstrong.com Git - lilypond.git/commitdiff
Midi: start test suite.
authorJan Nieuwenhuizen <janneke@gnu.org>
Sat, 12 Mar 2011 20:03:22 +0000 (21:03 +0100)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sat, 12 Mar 2011 20:07:09 +0000 (21:07 +0100)
12 files changed:
GNUmakefile.in
input/regression/GNUmakefile
input/regression/midi/GNUmakefile [new file with mode: 0644]
input/regression/midi/key-initial.ly [new file with mode: 0644]
input/regression/midi/key-option.ly [new file with mode: 0644]
input/regression/midi/rest.ly [new file with mode: 0644]
input/regression/midi/voice-2.ly [new file with mode: 0644]
input/regression/midi/voice-4.ly [new file with mode: 0644]
make/lilypond-vars.make
make/midi-rules.make [new file with mode: 0644]
make/midi-targets.make [new file with mode: 0644]
make/midi-vars.make [new file with mode: 0644]

index f8e1d15e7ca6a81516b41bbf3f0e5653c98fa3cd..3809d03ad3c861022dfa8fc1ec490147c380ca2d 100644 (file)
@@ -254,6 +254,7 @@ test:
        @echo '        grep sourcefilename `grep -L systems.texi out/lybook-testdb/*/*log|sed s/log/ly/g`'
        @echo
        $(MAKE) -C input/regression out=test local-test
+       $(MAKE) -C input/regression/midi out=test local-test
        $(MAKE) -C input/regression/musicxml out=test local-test
        $(MAKE) -C input/regression/abc2ly out=test local-test
        $(MAKE) -C input/regression/lilypond-book out=test local-test
@@ -265,6 +266,7 @@ test-baseline:
        $(MAKE)
        $(MAKE) test
        $(MAKE) out=test -C input/regression local-test-baseline
+       $(MAKE) out=test -C input/regression/midi local-test-baseline
        $(MAKE) out=test -C input/regression/musicxml local-test-baseline
        $(MAKE) out=test -C input/regression/abc2ly local-test-baseline
        $(MAKE) out=test -C input/regression/lilypond-book local-test-baseline
index e0c023d667ed73a504f3a2421b092862c205f6c6..cc769e7c2f5843c060c7ce3aef80e7a5f23a70d4 100644 (file)
@@ -6,4 +6,4 @@ LOCALSTEPMAKE_TEMPLATES=lilypond ly lysdoc
 include $(depth)/make/stepmake.make
 TITLE=LilyPond Regression Tests
 
-SUBDIRS=musicxml abc2ly lilypond-book
+SUBDIRS=midi musicxml abc2ly lilypond-book
diff --git a/input/regression/midi/GNUmakefile b/input/regression/midi/GNUmakefile
new file mode 100644 (file)
index 0000000..682bf82
--- /dev/null
@@ -0,0 +1,13 @@
+depth = ../../..
+
+STEPMAKE_TEMPLATES=documentation texinfo tex
+LOCALSTEPMAKE_TEMPLATES=lilypond ly lysdoc midi
+
+TEXI2HTML_FLAGS += --nomenu
+
+TMP = $(sort $(LY_FILES) $(TEXINFO_SOURCES) )
+COLLATED_FILES = ${TMP:%.ly=$(outdir)/%-midi.ly}
+
+include $(depth)/make/stepmake.make
+
+TITLE=MIDI test suite
diff --git a/input/regression/midi/key-initial.ly b/input/regression/midi/key-initial.ly
new file mode 100644 (file)
index 0000000..c663dec
--- /dev/null
@@ -0,0 +1,79 @@
+% Lily was here -- automatically converted by ../../../scripts/midi2ly.py from out/initial-key.midi
+\version "2.13.53"
+
+\layout {
+  \context {
+    \Voice
+    \remove "Note_heads_engraver"
+    \consists "Completion_heads_engraver"
+    \remove "Rest_engraver"
+    \consists "Completion_rest_engraver"
+  }
+}
+
+% included from ./out/initial-key.header
+\header {
+texidoc="keys work in MIDI, this is a-minor"
+options=""
+}
+% end
+
+trackAchannelA = {
+
+
+  \key a \minor
+    
+  % [SEQUENCE_TRACK_NAME] control track
+  
+  % [TEXT_EVENT] creator: 
+  
+  % [TEXT_EVENT] GNU LilyPond 2.13.54          
+  
+  \time 4/4 
+  
+  \tempo 4 = 60 
+  
+}
+
+trackA = <<
+  \context Voice = voiceA \trackAchannelA
+>>
+
+
+trackBchannelA = \relative c {
+  
+  \set Staff.instrumentName = "trackB:voiceA"
+  a'4 b c d 
+  | % 2
+  e f gis a 
+  | % 3
+  
+}
+
+trackB = <<
+  \context Voice = voiceA \trackBchannelA
+>>
+
+
+trackCchannelA = {
+  
+  \set Staff.instrumentName = "trackB:"
+  
+
+  \key a \minor
+  
+}
+
+trackC = <<
+  \context Voice = voiceA \trackCchannelA
+>>
+
+
+\score {
+  <<
+    \context Staff=trackB \trackA
+    \context Staff=trackB \trackB
+  >>
+  \layout {}
+  \midi {}
+}
diff --git a/input/regression/midi/key-option.ly b/input/regression/midi/key-option.ly
new file mode 100644 (file)
index 0000000..175a7a8
--- /dev/null
@@ -0,0 +1,75 @@
+% Lily was here -- automatically converted by ../../../scripts/midi2ly.py from out-www/option-key.midi
+\version "2.13.53"
+
+\layout {
+  \context {
+    \Voice
+    \remove "Note_heads_engraver"
+    \consists "Completion_heads_engraver"
+    \remove "Rest_engraver"
+    \consists "Completion_rest_engraver"
+  }
+}
+
+% included from ./out-www/option-key.header
+\header {
+texidoc="--key works in midi2ly this is F major"
+options="--key=-1"
+}
+% end
+
+trackAchannelA = {
+
+
+  % [SEQUENCE_TRACK_NAME] control track
+  
+  % [TEXT_EVENT] creator: 
+  
+  % [TEXT_EVENT] GNU LilyPond 2.13.54          
+  
+  \time 4/4 
+  
+  \tempo 4 = 60 
+  
+}
+
+trackA = <<
+  \context Voice = voiceA \trackAchannelA
+>>
+
+
+trackBchannelA = \relative c {
+  
+  \set Staff.instrumentName = "trackB:voiceA"
+  f'4 g a bes 
+  | % 2
+  c d e f 
+  | % 3
+  
+}
+
+trackB = <<
+  \context Voice = voiceA \trackBchannelA
+>>
+
+
+trackCchannelA = {
+  
+  \set Staff.instrumentName = "trackB:"
+  
+
+}
+
+trackC = <<
+  \context Voice = voiceA \trackCchannelA
+>>
+
+
+\score {
+  <<
+    \context Staff=trackB \trackA
+    \context Staff=trackB \trackB
+  >>
+  \layout {}
+  \midi {}
+}
diff --git a/input/regression/midi/rest.ly b/input/regression/midi/rest.ly
new file mode 100644 (file)
index 0000000..4013296
--- /dev/null
@@ -0,0 +1,63 @@
+% Lily was here -- automatically converted by ../../../scripts/midi2ly.py from out-www/rest.midi
+\version "2.13.53"
+
+\layout {
+  \context {
+    \Voice
+    \remove "Note_heads_engraver"
+    \consists "Completion_heads_engraver"
+    \remove "Rest_engraver"
+    \consists "Completion_rest_engraver"
+  }
+}
+
+% included from ./out-www/rest.header
+\header {
+texidoc="midi2ly identifies rests"
+options=""
+}
+% end
+
+trackAchannelA = {
+  
+  % [SEQUENCE_TRACK_NAME] control track
+  
+  % [TEXT_EVENT] creator: 
+  
+  % [TEXT_EVENT] GNU LilyPond 2.13.54          
+  
+  \time 4/4 
+  
+  \tempo 4 = 60 
+  
+}
+
+trackA = <<
+  \context Voice = voiceA \trackAchannelA
+>>
+
+
+trackBchannelA = \relative c {
+  r4 
+  \set Staff.instrumentName = "trackB:voiceA"
+  a r4 a 
+  | % 2
+  
+}
+
+trackB = <<
+
+  \clef bass
+  
+  \context Voice = voiceA \trackBchannelA
+>>
+
+
+\score {
+  <<
+    \context Staff=trackB \trackA
+    \context Staff=trackB \trackB
+  >>
+  \layout {}
+  \midi {}
+}
diff --git a/input/regression/midi/voice-2.ly b/input/regression/midi/voice-2.ly
new file mode 100644 (file)
index 0000000..e12345e
--- /dev/null
@@ -0,0 +1,70 @@
+% Lily was here -- automatically converted by ../../../scripts/midi2ly.py from out-www/voice-2.midi
+\version "2.13.53"
+
+\layout {
+  \context {
+    \Voice
+    \remove "Note_heads_engraver"
+    \consists "Completion_heads_engraver"
+    \remove "Rest_engraver"
+    \consists "Completion_rest_engraver"
+  }
+}
+
+% included from ./out-www/voice-2.header
+\header {
+texidoc="midi2ly maps two voices nicely on once staff as \voiceOne, \voiceTwo"
+options=""
+}
+% end
+
+trackAchannelA = {
+  
+  % [SEQUENCE_TRACK_NAME] control track
+  
+  % [TEXT_EVENT] creator: 
+  
+  % [TEXT_EVENT] GNU LilyPond 2.13.54          
+  
+  \time 4/4 
+  
+  \tempo 4 = 60 
+  
+}
+
+trackA = <<
+  \context Voice = voiceA \trackAchannelA
+>>
+
+
+trackBchannelA = \relative c {
+  \voiceOne
+  
+  \set Staff.instrumentName = ":1"
+  e''4 e e e 
+  | % 2
+  
+}
+
+trackBchannelB = \relative c {
+  \voiceTwo
+  f' f f f 
+  | % 2
+  
+}
+
+trackB = <<
+  \context Voice = voiceA \trackBchannelA
+  \context Voice = voiceB \trackBchannelB
+>>
+
+
+\score {
+  <<
+    \set Score.midiChannelMapping = #'voice
+    \context Staff=trackB \trackA
+    \context Staff=trackB \trackB
+  >>
+  \layout {}
+  \midi {}
+}
diff --git a/input/regression/midi/voice-4.ly b/input/regression/midi/voice-4.ly
new file mode 100644 (file)
index 0000000..23d87b7
--- /dev/null
@@ -0,0 +1,86 @@
+% Lily was here -- automatically converted by ../../../scripts/midi2ly.py from out-www/voice-4.midi
+\version "2.13.53"
+
+\layout {
+  \context {
+    \Voice
+    \remove "Note_heads_engraver"
+    \consists "Completion_heads_engraver"
+    \remove "Rest_engraver"
+    \consists "Completion_rest_engraver"
+  }
+}
+
+% included from ./out-www/voice-4.header
+\header {
+texidoc="midi2ly maps four voices nicely on once staff as \voiceOne, \voiceTwo, \voiceThree, \voiceFour"
+options=""
+}
+% end
+
+trackAchannelA = {
+  
+  % [SEQUENCE_TRACK_NAME] control track
+  
+  % [TEXT_EVENT] creator: 
+  
+  % [TEXT_EVENT] GNU LilyPond 2.13.54          
+  
+  \time 4/4 
+  
+  \tempo 4 = 60 
+  
+}
+
+trackA = <<
+  \context Voice = voiceA \trackAchannelA
+>>
+
+
+trackBchannelA = \relative c {
+  \voiceOne
+  
+  \set Staff.instrumentName = ":1"
+  <c''' a >2 b 
+  | % 2
+  
+}
+
+trackBchannelB = \relative c {
+  \voiceThree
+  c''4. d8 e4 f 
+  | % 2
+  
+}
+
+trackBchannelC = \relative c {
+  \voiceFour
+  d'1 
+  | % 2
+  
+}
+
+trackBchannelD = \relative c {
+  \voiceTwo
+  c'4 c2 c4 
+  | % 2
+  
+}
+
+trackB = <<
+  \context Voice = voiceA \trackBchannelA
+  \context Voice = voiceB \trackBchannelB
+  \context Voice = voiceC \trackBchannelC
+  \context Voice = voiceD \trackBchannelD
+>>
+
+
+\score {
+  <<
+    \set Score.midiChannelMapping = #'voice
+    \context Staff=trackB \trackA
+    \context Staff=trackB \trackB
+  >>
+  \layout {}
+  \midi {}
+}
index d1c7cd2fea46e8c9d86945286e91d339a645f0c1..cf1bc11203487102b4c3bb39d569aae1445a81fc 100644 (file)
@@ -22,6 +22,7 @@ export PYTHONPATH:=$(top-build-dir)/python/$(outconfbase):$(PYTHONPATH)
 the-script-dir=$(wildcard $(script-dir))
 
 ABC2LY = $(script-dir)/abc2ly.py
+MIDI2LY = $(script-dir)/midi2ly.py
 MUSICXML2LY = $(script-dir)/musicxml2ly.py
 CONVERT_LY = $(script-dir)/convert-ly.py
 LILYPOND_BOOK = $(script-dir)/lilypond-book.py
diff --git a/make/midi-rules.make b/make/midi-rules.make
new file mode 100644 (file)
index 0000000..219eb26
--- /dev/null
@@ -0,0 +1,18 @@
+.SUFFIXES: .midi
+
+$(outdir)/%.ly:  %.midi
+       $(PYTHON) $(MIDI2LY) -o $(outdir) $<
+
+$(outdir)/%.midi: %.ly $(LILYPOND_BINARY)
+       touch $(foreach f, $(HEADER_FIELDS), $(outdir)/$*.$f)
+       $(LILYPOND_BINARY) $(HEADER_FIELDS:%=-H %) -o $(outdir) $<
+
+$(outdir)/%-midi.ly: $(outdir)/%.midi $(MIDI2LY)
+       (echo '\header {'; for f in $(HEADER_FIELDS); do echo -n $$f'="'; cat $(outdir)/$*.$$f; echo '"'; done; echo '}') > $(outdir)/$*.header
+       $(PYTHON) $(MIDI2LY) $(shell cat $(outdir)/$*.options) --include-header=$(outdir)/$*.header -o $(outdir) $<
+
+$(outdir)/%.diff: %.ly $(outdir)/%-midi.ly
+       $(DIFF) -puN $(MIDI2LY_IGNORE_RES) $^ > $@ || cat $@
+
+$(outdir)/midi.diff: $(OUT_DIFF_FILES)
+       cat $(OUT_DIFF_FILES) > $@
diff --git a/make/midi-targets.make b/make/midi-targets.make
new file mode 100644 (file)
index 0000000..e462465
--- /dev/null
@@ -0,0 +1,7 @@
+default:
+
+##local-test: $(outdir)/midi.diff
+
+check: $(outdir)/midi.diff local-WWW-1 local-WWW-2
+
+test: check
diff --git a/make/midi-vars.make b/make/midi-vars.make
new file mode 100644 (file)
index 0000000..7b3a276
--- /dev/null
@@ -0,0 +1,10 @@
+MIDI_FILES = $(call src-wildcard,*.midi)
+HEADER_FILES = $(call src-wildcard,*.header)
+OUT_LY_FILES = $(sort ${MIDI_FILES:%.midi=$(outdir)/%.ly} ${LY_FILES:%.ly=$(outdir)/%-midi.ly} )
+OUT_FILES = $(OUT_LY_FILES)
+HEADER_FIELDS = texidoc options
+OUT_DIFF_FILES = ${LY_FILES:%.ly=$(outdir)/%.diff}
+MIDI2LY_IGNORE_RES = -I 'Lily was here' -I '^\\version ' -I 'TEXT_EVENT.*GNU LilyPond' -I '^% included from'
+DIFF = diff
+
+EXTRA_DIST_FILES += $(MIDI_FILES) $(HEADER_FILES)