Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
LilyPond wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Repeat commands grace echo purger
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
One subtype of the '''''grace synchronization issue''''' is the '''''grace echo'''''. It occurs if one voice sends an (system wide collected) event (e.g. start of repeat, start or end of volta) before a grace note, while another voice does it after this grace note (usually because there is no grace note in the other voice). Then simply ''ignoring'' the second occurrence after the grace notes is a quick help.<br /> Off course, it cannot help if there is no event before the first grace note at all, e.g. if you use a parallel control voice without grace notes to define the repeat structure.<br /> With the '''''\repeat''''' and '''''\alternative''''' commands this method is a little tricky, because it must be done within an exact sequence of the other engravers. This example illustrates how it's done '''directly''' by context modifications and using a scheme engraver, and this source code also describes how it will be implemented by patching your LILYPOND installation. <lilypond version="2.24.0"> %by: ArnoldTheresius #(define-public (Local_repeatcommands_graceecho_purger ctx) (let ((last-main-moment -1) (accumulated-repeat-list '())) (make-engraver ((process-music trans) (let* ((now-mom (ly:context-current-moment ctx)) (now-main-mom (ly:moment-main now-mom)) (current-repeat-list (ly:context-property ctx 'repeatCommands))) (if (not (equal? last-main-moment now-main-mom)) (set! accumulated-repeat-list '())) (if (not (null? current-repeat-list)) (let ((new-repeat-list '())) (for-each (lambda (x) (let ((tokken x)) (if (pair? x) ;;; only volta expected! (if (and (boolean? (cadr x)) (eq? (cadr x) #f)) (set! tokken 'volta--end) (set! tokken 'volta--start))) (if (not (memq tokken accumulated-repeat-list)) (begin (set! new-repeat-list (cons x new-repeat-list)) (set! accumulated-repeat-list (cons tokken accumulated-repeat-list)))))) current-repeat-list) (ly:context-set-property! ctx 'repeatCommands (reverse! new-repeat-list)))) (set! last-main-moment now-main-mom)))))) Music = { \tag #'Grace \acciaccatura b8 c'1 \inStaffSegno \repeat volta 2 { \tag #'Grace \acciaccatura b8 c'1 } \alternative { { \tag #'Grace \acciaccatura b8 c'1 } { \tag #'Grace \acciaccatura b8 c'1 } } \tag #'Grace \acciaccatura b8 c'1 } \score { \new StaffGroup << \new Staff { \Music } \new Staff { \removeWithTag #'Grace \Music } >> \layout { \context { \Score \remove "Repeat_acknowledge_engraver" \remove "Volta_engraver" % this scheme engraver defined above must be placed % before the 'Repeat_acknowledge_engraver', and all % dependent engravers (i.e. the "Volta_engraver") % must follow. % As there is no »before engraver xxx« option in % the '\consists' command, I did remove both before % I added the new scheme engraver, then I added % the two engravers again. \consists #Local_repeatcommands_graceecho_purger \consists "Repeat_acknowledge_engraver" \consists "Volta_engraver" %%% I have already patched my LILYPOND as listed below! %%% This is the syntax how to disable this patch in a \score block % \remove #Repeatcommands_graceecho_purger } } } \score { \new Staff { e'1 \inStaffSegno e' \inStaffSegno \repeat volta 2 { e' } } } \markup \wordwrap { If you want to use it in every compilation, you may patch your LILYPOND installation: Follow the instruction you'll find here in the source code. } %{ PATCH INSTRUCTION: 1. locate the file .../usr/share/lilypond/current/scm/music-functions.scm and append these 27 lines: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Extension for grace echo purging (define-public (Repeatcommands_graceecho_purger ctx) (let ((last-main-moment -1) (accumulated-repeat-list '())) (make-engraver ((process-music trans) (let* ((now-mom (ly:context-current-moment ctx)) (now-main-mom (ly:moment-main now-mom)) (current-repeat-list (ly:context-property ctx 'repeatCommands))) (if (not (equal? last-main-moment now-main-mom)) (set! accumulated-repeat-list '())) (if (not (null? current-repeat-list)) (let ((new-repeat-list '())) (for-each (lambda (x) (let ((tokken x)) (if (pair? x) ;;; only volta expected! (if (and (boolean? (cadr x)) (eq? (cadr x) #f)) (set! tokken 'volta--end) (set! tokken 'volta--start))) (if (not (memq tokken accumulated-repeat-list)) (begin (set! new-repeat-list (cons x new-repeat-list)) (set! accumulated-repeat-list (cons tokken accumulated-repeat-list))))) ) current-repeat-list) (ly:context-set-property! ctx 'repeatCommands (reverse! new-repeat-list)))) (set! last-main-moment now-main-mom)))))) 2. locate the file .../usr/share/lilypond/current/ly/engraver-init.ly, open it with an text editor, find the line containing \consists "Repeat_acknowledge_engraver" and add just _b_e_f_o_r_e_ this the line \consists #Repeatcommands_graceecho_purger %} </lilypond> [[Category:Contexts and engravers]] [[Category:Repeats]] [[Category:Contexts and engravers]] [[Category:Workaround]]
Summary:
Please note that all contributions to LilyPond wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Meta:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Repeat commands grace echo purger
Add topic