Hi,
2012/2/2 David Kastrup <[email protected]>:
> Peter Crighton <[email protected]> writes:
>
>> No, unfortunately it doesn't have the desired effect.
>> First, there was a "$" missing before "fret" in the "\override
>> TabNoteHead" line.
>
> Not if you are using a version of LilyPond from about 2.15.18 onward.
> It gets along with a lot less $ inside of #{ ... #} while allowing you
> to use $ outside of it as well.
>
> So basing this on Marc's comment
>
>> \harmonicBy... is defined in ly/music-functions-init.ly; based on this
>> definition, something like
>
> you should likely pick up the respective code from _your_ version of
> ly/music-functions-init.ly and try making analogous changes to it.
>
> --
> David Kastrup
>
>
> _______________________________________________
> lilypond-user mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/lilypond-user
to avoid confusions about $ and other complications depending on the
used version, you should always post your version-number and a short
example.
Based on Marc's work I come up with the code below.
\version "2.14.2"
mixedHarmonicByFret = #(define-music-function (parser location fret
music) (number? ly:music?)
(_i "Convert @var{music} into mixed harmonics; the resulting notes resemble
harmonics played on a fretted instrument by touching the strings above @var{fret
}.")
(let* ((fret (number->string fret))
(pitch (fret->pitch fret)))
(make-sequential-music
(list
#{
\override TabNoteHead #'stencil =
#(tab-note-head::print-custom-fret-label $fret)
\override NoteHead #'stencil = #(lambda (grob)
(ly:grob-set-property! grob 'style 'harmonic-mixed)
(ly:note-head::print grob))
#}
(make-harmonic
(calc-harmonic-pitch pitch music))
#{
\revert TabNoteHead #'stencil
\revert NoteHead #'stencil
#}))))
music = {
\mixedHarmonicByFret #5
d,16\4
\mixedHarmonicByFret #4
d,16\4
\mixedHarmonicByFret #3
d,8\4
\mixedHarmonicByFret #5
<g,\3 b,\2>2.
c'4 d' e' f' g'1
}
\score {
<<
\new Staff { \clef "G_8" \music }
\new TabStaff { \music }
>>
}
HTH,
Harm
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user