\version "2.12.3"
dutchtosolfa =
#`(("ces" . "de")
("c" . "do")
("cis" . "di")
("des" . "ra")
("d" . "re")
("dis" . "ri")
("ees" . "me")
("e" . "mi")
("f" . "fa")
("fis" . "fi")
("ges" . "se")
("g" . "sol")
("gis" . "si")
("aes" . "le")
("a" . "la")
("ais" . "li")
("bes" . "te")
("b" . "ti")
)
solfaNames =
#(lambda (grob)
(let* ((default-name (ly:grob-property grob 'text))
(new-name (assoc-get default-name dutchtosolfa)))
(ly:grob-set-property! grob 'text (markup #:italic #:smaller new-name))
(ly:text-interface::print grob)))
Snotes = \relative c' {
\time 4/4
\partial 4
a'4 |
bes4 a g d' |
}
Bnotes = \relative c {
\time 4/4
\partial 4
d4 |
g4 a bes a8 g |
}
ASvoiceAA = {
\set Staff.instrumentName = #"Soprano"
\clef treble
\key f \major
\Snotes
}
ABvoiceDA = {
\set Staff.instrumentName = #"Bass"
\clef bass
\key f \major
\Bnotes
}
\score {
<<
\new Voice = ASVoiceAA { \ASvoiceAA }
\new NoteNames = NNS \with {
\override NoteName #'stencil = #solfaNames
} {\transpose f c \Snotes}
\new Voice = ABvoiceDA {\ABvoiceDA}
\new NoteNames = NNB \with {
\override NoteName #'stencil = #solfaNames
} {\transpose f c \Bnotes}
>>
}%% end of score-block
On Tue, Dec 21, 2010 at 10:17 PM, Carl Sorensen
<address@hidden> wrote:
On 12/21/10 5:14 PM, "Michael Ellis" <
address@hidden> wrote:
> On Tue, Dec 21, 2010 at 7:12 PM, Michael Ellis <
address@hidden>
> wrote:
>> While working with a much larger version of the score below (BWV 206 chorale
>> in 4 voices), I tried using the NoteNames engraver to put note names under
>> each voice. For some reason, invoking it twice causes the clef and
>> instrument name to change on the top staff. The notes (and the note names)
>> are correct, but the Soprano line gets a bass clef and the bass instrument
>> name. Is this a known problem?
Mike,
The problem is apparently that the \clef command implicitly creates some
kind of staff context if it's in a NoteNames context.
If you take the \clef commands out of the music passed to the NoteNames
context, then things seem to work right. (I haven't fully tested the
instrumentName to see if it can be part of the NoteNames context or not).
Here's some code that works:
\version "2.12.3"
Snotes = \relative c' {
\time 4/4
\partial 4
a'4 |
bes4 a g d' |
}
Bnotes = \relative c {
\time 4/4
\partial 4
d4 |
g4 a bes a8 g |
}
ASvoiceAA = {
\set Staff.instrumentName = #"Soprano"
\clef treble
\key f \major
\Snotes
}
ABvoiceDA = {
\set Staff.instrumentName = #"Bass"
\clef bass
\key f \major
\Bnotes
}
\score {
<<
\new Voice = ASVoiceAA { \ASvoiceAA }
\new NoteNames = NNS {\Snotes}
\new Voice = ABvoiceDA {\ABvoiceDA}
\new NoteNames = NNB {\Bnotes}
>>
}%% end of score-block
HTH,
Carl