Does this do the job? h = #(define-music-function (parser location note) (ly:music?) (set! (ly:music-property note 'tweaks) (acons 'style 'cross (ly:music-property note 'tweaks))) note)
\relative c' { <a-0 e'-2 a-3 c-1 e-0>8 <a \h e' \h a \h c e> <a e' a c e> <a \h e' \h a \h c e> <a e' a c e> <a \h e' \h a \h c e> <a e' a c e> <a \h e' \h a \h c e> } Kees ----- Original Message ----- From: Steve Yegge <steve.ye...@gmail.com> Date: Monday, March 23, 2009 9:13 pm Subject: mixing notehead styles in chords To: lilypond-user@gnu.org > Hello, > > In flamenco and bossa-nova guitar music it is quite > common to damp some (but not all) strings with the > left hand while strumming. The standard notation for > this is to have cross-noteheads on the damped strings > and normal noteheads on the strings that should ring. > > Lilypond makes it extremely tedious to deal with this > relatively common situation. It's easy to have the entire > chord drawn with x-noteheads, but much more difficult > to get only some of the notes to have x-noteheads. > > For instance, let's say we're notating the strumming of > eighth-note open A-minor chords, like so: > > \relative c' { > <a-0 e'-2 a-3 c-1 e-0>8 > > > > > > > > > } > > > So far the music only needs one voice, and it prints in > an easy-to-read (for guitarists) stacked notation, with one > stem per chord. > > But let's say we want every other chord to be partly > damped: strings 2, 3 and 4 have x-noteheads, and > strings 1 and 5 have normal noteheads. We don't want > any other visible changes to the print representation -- > in particular, this is not polyphonic music, so we don't > want up- and down- stems in the same measure, nor > notes from any given chord to be horizontally shifted. > We just want every other chord to have its middle three > noteheads be crosses. > > The only way to accomplish this, as far as I can tell, > requires many manual steps for each measure: > - split the music expression into two voices > - copy the chords into the second voice > - delete all the normal-notehead notes from one voice > - delete the cross-notehead notes from the other voice > - make the stems and beams in the top voice invisible > - turn off note-column collision warnings > - in some cases, hack the stem #'length-fraction so > that the beam from the lower voice clears the > higher. > Doing this for the measure above, we get > > << > \relative c' { > \override Stem #'transparent = ##t > \override Beam #'transparent = ##t > \override NoteColumn #'ignore- > collision = ##t > <e-2 a-3 c-1>8 > \override NoteHead #'style = #'cross > <e a c> > \revert NoteHead #'style > <e a c> > \override NoteHead #'style = #'cross > <e a c> > > \revert NoteHead #'style > <e a c> > \override NoteHead #'style = #'cross > <e a c> > \revert NoteHead #'style > <e a c> > \override NoteHead #'style = #'cross > <e a c> > \revert NoteHead #'style > } \\ > \relative c' { > \stemUp > <a-0 e''-0>8 > > } > >> > > This is somewhat labor-intensive, and annoying to read > (although it can be mitigated a bit with macros). But the > real problems have only just begun. Now that it's been split > into two voices, everything you add to the staff begins to > have layout issues. Take a look at the fingerings in the two > measures above. In the one-voice version, the fingerings > line up nicely, with three above the staff and two below. > In the two-voice version, most of the fingerings overlap > with other entities, rendering them unreadable. > > You'll run into the same kinds of issues with every kind of > annotation, from string numbers and right hand fingerings > through accent marks and TextSpanners. The hack to > split the chords into multiple voices wreaks havoc with > the layout engine as we add more information to the staff. > > We could fix this problem by adding another special-case > similar to \harmonic for cross-noteheads. But I have a > sneaking feeling it wouldn't be the last such special case. > > It seems like a better solution would be to provide syntax > support for overriding individual noteheads within a chord > to be arbitrary glyphs or stencils -- whatever you can do > with noteheads outside of chords, basically. > > But I'd take the hack, for now! I'm transcribing a piece > that has many of these partly-damped chords, and I'd love > to have a way to annotate them properly. > > Thanks, > > -steve > > p.s. Thank you for this awesome system, by the way. > _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user