Carl, thanks for taking the time to figure it out!  I really appreciate the
help. It's good to know there's a workaround.

I'm undertaking a project to produce files containing all the Bach Chorales
with solfege syllables (movable Do, La-based minor) under each part.  I'm
starting with the MusicXML files created by Margaret Greentree at
www.jsbchorales.net.  It turns out that MusesScore can be run in batch modes
to produce LilyPond files.  I was able to convert all 400 of them in about
10 minutes of run time.

The mechanism for producing the solfege syllables is fairly well resolved.
 I adapted an example from Valentin ( see
http://stackoverflow.com/questions/4378228/lilypond-extracting-pitch-names-from-music)
that uses a scheme function to work around another NoteNames problem:
default reversion to dutch pitch names.

To apply it to the chorale files, I just need to put the dutch to solfa
mapping and the scheme function at the top of each file and in the score
block, call the NoteNames engraver like so:

    \context NoteNames = NNS \with {
       \override NoteName #'stencil = #solfaNames
    } { transpose fa do \Snotes }

where the transposition is from the original key signature back to C major
to produce movable Do solfa.

Putting this together with your workaround produces the code and output
shown below.  This works quite well.  So the issue I'm wrestling with now is
whether it's feasible to automate the editing of 400+ files to separate the
clef and instrument names from the notation, detect the original key, and
rewrite the score block to produce the desired results.

Thanks again for your help and any suggestions for how proceed with the
automation are more than welcome.

Cheers,
Mike

\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 <c_soren...@byu.edu> wrote:

>
>
>
> On 12/21/10 5:14 PM, "Michael Ellis" <michael.f.el...@gmail.com> wrote:
>
> > On Tue, Dec 21, 2010 at 7:12 PM, Michael Ellis <
> michael.f.el...@gmail.com>
> > 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
>
>

<<attachment: solfa.png>>

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to