\version "2.19.80" %% The dot may go to next bar in Urtext %Thanks Thomas Morley %http://lists.gnu.org/archive/html/lilypond-user/2012-08/msg00172.html % c2. \tieToDotted c4~ | c8 c2. tieToDotted = #(define-music-function (music) (ly:music?) #{ \once \override Tie.transparent = ##t $music \once \autoBeamOff \once \override NoteHead.no-ledgers = ##t \once \override NoteHead.stencil = #(lambda (grob) (let* ((staff-pos (ly:grob-property grob 'staff-position)) (staff-space (ly:staff-symbol-staff-space grob))) (ly:stencil-translate-axis (ly:font-get-glyph (ly:grob-default-font grob) "dots.dot") (if (even? staff-pos) (/ staff-space 3) 0) Y))) \once \override NoteHead.Y-extent = #(ly:make-unpure-pure-container ly:grob::stencil-height (lambda (grob start end) (ly:grob::stencil-height grob))) \once \override NoteHead.X-extent = #'(0 . 1) \once \override Stem.stencil = ##f \once \override Flag.stencil = ##f #}) %and from %http://lists.gnu.org/archive/html/lilypond-user/2013-09/msg00584.html % use : % c4. d8 << \tag #'foo { \overBar bes4. } % \tag #'bar { bes4~ bes8 } >> % | % No barcheck! % a8 a2 | overBar = #(define-music-function (music) (ly:music?) " Replaces a dotted note with a single main note and (a tied) single additional note. The Tie will be transparent. The second note will appear as dot, without Stem, Flag, Beam, Articulations. Barchecks should not be used. Limitation: does not work for chords. " (let* ((duration (ly:music-property music 'duration)) (dot-count (if (ly:duration? duration) (ly:duration-dot-count duration) 0))) ;; Apply it only if the note is a single-dotted note (if (= dot-count 1) (let* ((m-1 (ly:music-deep-copy music)) (m-2 (ly:music-deep-copy music)) (dur-log (ly:duration-log duration)) (first-dur (ly:make-duration dur-log)) (second-dur (ly:make-duration (+ dur-log 1)))) ;; Defines a procedure to replace the given NoteHead with a dot. (define (note-head->dot note-head) (let* ((stencil (ly:grob-property note-head 'stencil)) (note-head-X-length (interval-length (ly:stencil-extent stencil X))) (dot (ly:font-get-glyph (ly:grob-default-font note-head) "dots.dot")) (dot-X-length (interval-length (ly:stencil-extent dot X))) (staff-pos (ly:grob-property note-head 'staff-position)) (stem (ly:grob-object note-head 'stem)) (flag (ly:grob-object stem 'flag)) (accidental-grob (ly:grob-object note-head 'accidental-grob)) ;; Get values for translating the dot-stencil to avoid putting ;; it on a staff-line. ;; Because ledger-lines will be removed, we return 0, if the ;; NoteHead is above or below the staff. (dir (if (and (even? staff-pos) (not (> staff-pos 5)) (not (< staff-pos -5))) -2 0)) ;; Calculate a value to center the dot with NoteHeads from ;; other voices (x-offset (/ (- note-head-X-length dot-X-length) 2)) (new-note-stencil (ly:stencil-translate-axis (ly:stencil-aligned-to dot Y dir) x-offset X))) ;; No Stem, Flag or Accidental! (if (not (null? stem)) (ly:grob-set-property! stem 'stencil point-stencil)) (if (not (null? flag)) (ly:grob-set-property! flag 'stencil point-stencil)) (if (not (null? accidental-grob)) (ly:grob-set-property! accidental-grob 'stencil point-stencil)) ;; Replace the NoteHead with a centered dot (ly:grob-set-property! note-head 'stencil new-note-stencil))) ;; Build the notes to insert, replacing the dotted one. (ly:music-set-property! m-1 'duration first-dur) (ly:music-set-property! m-2 'duration second-dur) ;; In order not to disturb midi we insert a Tie here, making it ;; tranparent later. (let ((articulations (ly:music-property m-1 'articulations))) (ly:music-set-property! m-1 'articulations (append (list (make-music 'TieEvent)) articulations))) ;; No Beam! ;; Also, we don't want other elements in 'articulations of the second ;; note, let it replaces them. (ly:music-set-property! m-2 'articulations (list (make-music 'BeamForbidEvent))) #{ \once \override Tie.transparent = ##t $m-1 \once \override NoteHead.no-ledgers = ##t \once \override NoteHead.before-line-breaking = #note-head->dot $m-2 #}) music))) music = \relative { a'1. \tieToDotted b2~ | b4 c2. c1 d1. << \tag #'Urtext { \overBar bes2. } % | % No barcheck! \tag #'moderne { bes2. } >> a4 a2 g1 a\breve | } \score { \new MensuralStaff \keepWithTag #'Urtext { \once \override Score.TimeSignature.stencil = #ly:text-interface::print \once \override Score.TimeSignature.text = \markup { \musicglyph #"timesig.mensural44" } \time 2/1 \music } \layout { \context { \MensuralVoice \override Stem.neutral-direction = #UP } \context { \MensuralStaff \override BarLine.transparent = ##f } } } \score { \keepWithTag #'moderne \new Staff { \music } \layout { \context { \Voice \remove "Note_heads_engraver" \consists "Completion_heads_engraver" \remove "Rest_engraver" \consists "Completion_rest_engraver" } } }