You're right, I should have included an example. I'm sorry. I now have:
\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 = { \override StringNumber #'transparent = ##t \ottava #1 \mixedHarmonicByFret #12 e,8\6 \mixedHarmonicByFret #12 <g\3 b\2 e'\1>8. \mixedHarmonicByFret #7 <g\3 b\2 e'\1> \mixedHarmonicByFret #5 <g\3 b\2 e'\1> \mixedHarmonicByFret #7 <g\3 b\2 e'\1> \mixedHarmonicByFret #12 <g\3 b\2 e'\1>8 | } \score { << \new Staff { \clef "G_8" \key e\major \music } \new TabStaff { \tabFullNotation \music } >> } It looks quite good so far, only the dots are not shown in the Staff and some of the accidentals overlap with the notehead. (In this example only the lower G, but at the piece I'm working on it is also the D.) -- Peter Crighton | (mainly) Progressive Rock musician based in Mainz/Wiesbaden, Germany http://www.petercrighton.de 2012/2/2 Thomas Morley <thomasmorle...@googlemail.com>: > Hi, > > 2012/2/2 David Kastrup <d...@gnu.org>: >> Peter Crighton <petecrigh...@googlemail.com> 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 >> lilypond-user@gnu.org >> 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 > lilypond-user@gnu.org > https://lists.gnu.org/mailman/listinfo/lilypond-user _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user