Skip to content

Commit

Permalink
instruments: declare contexts for MIDI, too - but no sound yet...
Browse files Browse the repository at this point in the history
David Kastrup explained why it didn't work previously:
> \midi would be happy to work with any custom-defined context
> type, but you don't declare any for \midi.  You only declare them
> for \layout.
  • Loading branch information
jan-warchol committed Sep 7, 2013
1 parent d9ed2a0 commit 55a8065
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 41 deletions.
Expand Up @@ -29,7 +29,6 @@
\defaultchild "SopranoVoice"

\consists "Ambitus_engraver"
\remove "Staff_performer"
midiInstrument = "acoustic grand"

\clef G
Expand All @@ -45,7 +44,6 @@
\description "predefined template for soprano voice"

\alias "Voice"
\consists "Staff_performer"
}

\context {
Expand All @@ -59,7 +57,6 @@
\defaultchild "AltoVoice"

\consists "Ambitus_engraver"
\remove "Staff_performer"
midiInstrument = "acoustic grand"

\clef G
Expand All @@ -75,7 +72,6 @@
\description "predefined template for alto voice"

\alias "Voice"
\consists "Staff_performer"
}

\context {
Expand All @@ -89,7 +85,6 @@
\defaultchild "TenorVoice"

\consists "Ambitus_engraver"
\remove "Staff_performer"
midiInstrument = "acoustic grand"

\clef "G_8"
Expand All @@ -105,7 +100,6 @@
\description "predefined template for tenor voice"

\alias "Voice"
\consists "Staff_performer"
}

\context {
Expand All @@ -119,7 +113,6 @@
\defaultchild "BassVoice"

\consists "Ambitus_engraver"
\remove "Staff_performer"
midiInstrument = "acoustic grand"

\clef F
Expand All @@ -135,7 +128,36 @@
\description "predefined template for bass voice"

\alias "Voice"
\consists "Staff_performer"
}

}


\midi {
\context {
\ChoirStaff
\accepts "SopranoStaff"
}

\context {
\Staff
\name "SopranoStaff"
\description "predefined template for soprano staff"

\type "Engraver_group"
\alias "Staff"
\accepts "SopranoVoice"
\defaultchild "SopranoVoice"

midiInstrument = "acoustic grand"
}

\context {
\Voice
\name "SopranoVoice"
\description "predefined template for soprano voice"

\alias "Voice"
midiInstrument = "acoustic grand"
}
}
37 changes: 4 additions & 33 deletions templates/predefined-instruments/midi-bug.ly
@@ -1,41 +1,12 @@
\version "2.16.2"

\markup \justify {
Below i've defined custom contexts: SopranoStaff and SopranoVoice.
However, they don't work with midi - first i get a
\typewriter "warning: cannot find or create new `SopranoVoice'"
and ten "\lyricsto" fails, saying that it \typewriter "cannot find Voice `sop'".
I suppose that because of some Midi bug a Voice is created instead of
SopranoVoice, and then "\lyricsto" cannot find the SopranoVoice
it is supposed to find.

Without "\midi" block eveerything works fine.
Why there is no sound in midi output? It appears that
\typewriter { midiInstrument = "acoustic grand" }
from instrument-context-definitions isn't applied.
}

\layout {
\context {
\ChoirStaff
\accepts "SopranoStaff"
}

\context {
\Staff
\type "Engraver_group"
\name "SopranoStaff"
\alias "Staff"

\accepts "SopranoVoice"
\defaultchild "SopranoVoice"

instrumentName = "Soprano"
}

\context {
\Voice
\name "SopranoVoice"
\alias "Voice"
}
}
\include "instrument-context-definitions.ily"

\score {
<<
Expand Down

0 comments on commit 55a8065

Please sign in to comment.