lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using other NoteHeads with \harmonicByFret?


From: Thomas Morley
Subject: Re: Using other NoteHeads with \harmonicByFret?
Date: Thu, 16 Feb 2012 22:53:18 +0100

Hi Marc,

2012/2/14 Marc Hohl <address@hidden>:
> Hi Harm,
>
> Do you want to bundle up your definitions in a patch
> so they get included future versions of lilypond?
>
> Thanks for your work on this!
>
> Regards,
>
> Marc

I don't know what I'm expected to do here and currently I've less time
as usual to learn it. (Might be better next month).
I'd be deeply grateful if you could do this.

Below the newest version replacing
          \override NoteHead #'minimum-Y-extent = #'(-0.1 . 0.1)
with
           \override NoteHead #'Y-extent =
        #(ly:make-unpure-pure-container
           ly:grob::stencil-height
           (lambda (grob start end) (ly:grob::stencil-height grob)))

%%%%%%%%%%%%%%%%
\version "2.15.29"

\paper {
        ragged-right = ##t
}

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 #'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))
         #{
           \revert TabNoteHead #'stencil
           \revert NoteHead #'Y-extent
           \revert NoteHead #'stencil
         #}))))

music = {
 \override StringNumber #'transparent = ##t
 \set harmonicDots = ##t
 \ottava #1
 \mixedHarmonicByFret #12 <e,\6>8
 \mixedHarmonicByFret #12 <e 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 |
 \ottava #0
  c'4 d' e' f' \mixedHarmonicByFret #12 <g\3>1
}

\score {
 <<
   \new Staff { \clef "G_8" \key e\major \music }
   \new TabStaff { \tabFullNotation \music }
 >>
}
%%%%%%%%%%%%%%%%

Cheers,
  Harm



reply via email to

[Prev in Thread] Current Thread [Next in Thread]