2013/9/20 David Kastrup <d...@gnu.org>: > > Gilberto Agostinho <gilbertohasn...@gmail.com> writes: > >> Well David, thanks for your answers and opinions. Even though I really >> respect your views (and you certainly know infinitely more about >> LilyPond and programming than I do), I still think I am right on this >> one. I personally see the lack of slashes on beamed grace notes + the >> lack of automatic beaming for grouped grace notes as major drawbacks >> with LilyPond. > > I've entered an issue in the tracker > <URL:http://code.google.com/p/lilypond/issues/detail?id=3566> and it's > probably mostly grind work to implement it in a way that can easily be > switched off when required. > > That does not mean that anybody will get excited enough about it to > actually implement it: merely that the discussion and a sketch at a > solution have been registered in a way making it easier to find at a > later point of time. > > -- > David Kastrup
Hi Gilberto, I coded some thoughts about automatically beaming grace notes. Comments in code. It's not an engraver, as supposed by David, (this should be done in C++ like the others), though, I hope it's of some use for you. \version "2.17.26" %% Works with "2.16.2", too. %% Though, there are some issues of vertical spacing with fingerings, etc %% in 'GraceMusic. %% 'add-stem-support might help, not tested, though. beamMe = #(define-music-function (parser location music)(ly:music?) ;; TODO: test it with real life examples. "A quite simple defined function to beam @var{music} by adding @code{[} and @code{]} to @code{articulations} of the first and last element of its code{elements}-list. " (let* ((elts (ly:music-property music 'elements)) (first (first elts)) (last (last elts))) (for-each (lambda (m) (let ((art (ly:music-property m 'articulations))) (cond ((eq? first m) (ly:music-set-property! m 'articulations (append art (list #{ [ #})))) ((eq? last m) (ly:music-set-property! m 'articulations (append art (list #{ ] #})))) (else #f)))) elts) music)) %% Modified c/p from music-functions.scm #(defmacro-public def-grace-function (start stop . docstring) "Helper macro for defining grace music. Containing an optional @var{beamed?}, which determines whether the @var{music} should be beamed or not, using the (very simple defined) music-function @code{beamMe}. The default for @var{beamed?} is set @code{#f}. Change it to @code{#t}? " `(define-music-function (parser location beamed? music) ((boolean? #f) ly:music?) ,@docstring (make-music 'GraceMusic 'origin location 'element (make-music 'SequentialMusic 'elements (list (ly:music-deep-copy ,start) (if beamed? #{ \beamMe $music #} music) (ly:music-deep-copy ,stop)))))) %% Unmodified c/p from music-functions-init.ly %% Needs to be here, otherwise the modified def-grace-function wouldn't apply acciaccatura = #(def-grace-function startAcciaccaturaMusic stopAcciaccaturaMusic (_i "Create an acciaccatura from the following music expression")) appoggiatura = #(def-grace-function startAppoggiaturaMusic stopAppoggiaturaMusic (_i "Create an appoggiatura from @var{music}")) grace = #(def-grace-function startGraceMusic stopGraceMusic (_i "Insert @var{music} as grace notes.")) %%%%%%%%%%%%%%%%%%%%%%%%%%% % EXAMPLE %%%%%%%%%%%%%%%%%%%%%%%%%%% testGraces = { c16 d e f e32 <d-1\3 f-2\4>--^"foo" } mainMusic = { c8 c } \relative c'' { \time 2/8 \mark "default acciaccatura" \acciaccatura \testGraces \mainMusic \break \mark "beamed acciaccatura, no slash, though" \acciaccatura ##t \testGraces \mainMusic \break \mark "default appoggiatura" \appoggiatura \testGraces \mainMusic \break \mark "beamed appoggiatura" \appoggiatura ##t \testGraces \mainMusic \break \mark "default grace" \grace \testGraces \mainMusic \break \mark "beamed grace" \grace ##t \testGraces \mainMusic } %% Some settings for \layout, \paper, \header \layout { \context { \Score \override RehearsalMark #'self-alignment-X = #LEFT \override RehearsalMark #'padding = #4 \override RehearsalMark #'break-align-symbols = #'(left-edge) \override BarNumber #'transparent = ##t \override TimeSignature #'stencil = ##f } } \paper { indent = 0 line-width = 100 markup-system-spacing #'padding = #8 } \header { title = "Grace with and without Beam" subtitle = \markup \normal-text { #(format "Used LilyPond-version: ~a" (lilypond-version)) } subsubtitle = \markup \medium \override #'(line-width . 60) \justify { The commands \typewriter "\\acciaccatura", \typewriter "\\appoggiatura" and \typewriter "\\grace" are working as before. If you want a beam from the first to the last note add \typewriter "##t" after them. \hspace #30 Example: \typewriter "\\acciaccatura ##t { ... }" } } My tries to add slashes are not convincing so far, I'll keep thinking about them. ;) HTH, Harm _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user