>From b56abfe0b25fdab0cf47388bbc7abbf9b6b31cc4 Mon Sep 17 00:00:00 2001 From: Marc Hohl Date: Fri, 17 Feb 2012 09:59:58 +0100 Subject: [PATCH] Improving \harmonicBy... functions Thanks to address@hidden, these functions work now as expected for guitar music. We have dotted harmonics and mixed harmonic note heads. --- ly/music-functions-init.ly | 24 ++++++++++++++++++++++-- 1 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index 4082ea9..7fe9900 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -374,23 +374,33 @@ in the format of @code{all-grob-descriptions}.") descriptions))) harmonicByFret = #(define-music-function (parser location fret music) (number? ly:music?) - (_i "Convert @var{music} into harmonics; the resulting notes resemble + (_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 #{ + \set harmonicDots = ##t \override TabNoteHead #'stencil = #(tab-note-head::print-custom-fret-label fret) + \override NoteHead #'Y-extent = #(ly:make-unpure-pure-container + ly:grob::stencil-height + (lambda (grob start end) + (ly:grob::stencil-height grob))) + \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)) #{ + \unset harmonicDots \revert TabNoteHead #'stencil + \revert NoteHead #'Y-extent + \revert NoteHead #'stencil #})))) harmonicByRatio = #(define-music-function (parser location ratio music) (number? ly:music?) - (_i "Convert @var{music} into harmonics; the resulting notes resemble + (_i "Convert @var{music} into mixed harmonics; the resulting notes resemble harmonics played on a fretted instrument by touching the strings above the point given through @var{ratio}.") (let ((pitch (ratio->pitch ratio)) @@ -398,12 +408,22 @@ given through @var{ratio}.") (make-sequential-music (list #{ + \set harmonicDots = ##t \override TabNoteHead #'stencil = #(tab-note-head::print-custom-fret-label fret) + \override NoteHead #'Y-extent = #(ly:make-unpure-pure-container + ly:grob::stencil-height + (lambda (grob start end) + (ly:grob::stencil-height grob))) + \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)) #{ + \unset harmonicDots \revert TabNoteHead #'stencil + \revert NoteHead #'Y-extent + \revert NoteHead #'stencil #})))) instrumentSwitch = -- 1.7.4.1