On Thu, Jun 23, 2016 at 6:14 PM, David Nalesnik <david.nales...@gmail.com> wrote: > Hi Tobias, > > On Thu, Jun 23, 2016 at 5:15 PM, Tobias Hagedorn > <tobias.haged...@gmx.net> wrote: >> Hello everybody! >> Does anybody know how to get always glissandi without writing \glissando >> after every Note? >> Thanks for answer! >> Tobias >> > > You need to define a music function for this. > > How about: > > \version "2.19.30" > > addGlissandi = > #(define-music-function (music) (ly:music?) > (music-map > (lambda (mus) > (if (music-is-of-type? mus 'event-chord) > (append! (ly:music-property mus 'elements) > (list (make-music 'GlissandoEvent)))) > (if (music-is-of-type? mus 'note-event) > (set! (ly:music-property mus 'articulations) > (cons (make-music 'GlissandoEvent) > (ly:music-property mus 'articulations)))) > > mus) > music) > music) > > > { > \addGlissandi { c'4 g' c'' g' } > c'1 > \addGlissandi { <c' e'>4 <g' c''> <c'' e''> <g' c''> } > <c' e'>1 > } > > %%%
Let's discount tied notes: %%%%%%%%%%%%%%% \version "2.19.30" #(define (tie-present? mus) (any (lambda (a) (music-is-of-type? a 'tie-event)) mus)) addGlissandi = #(define-music-function (music) (ly:music?) (music-map (lambda (mus) (if (and (music-is-of-type? mus 'event-chord) (not (tie-present? (ly:music-property mus 'elements)))) (append! (ly:music-property mus 'elements) (list (make-music 'GlissandoEvent)))) (if (and (music-is-of-type? mus 'note-event) (not (tie-present? (ly:music-property mus 'articulations)))) (set! (ly:music-property mus 'articulations) (cons (make-music 'GlissandoEvent) (ly:music-property mus 'articulations)))) mus) music) music) { \addGlissandi { g4 c'~ c' g' c'' g' } c'1 \addGlissandi { <c' e'>1~ <c' e'>4 <g' c''> <c'' e''> <g' c''> } <c' e'>1 } %%%%%%%%%%%%%%% (If you want glissandi suppressed on repeated notes, that's a whole new level of sophistication.) -David _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user