X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Documentation%2Fsnippets%2Fadding-extra-fingering-with-scheme.ly;h=c93557a36ba615020521e3b5fb51a509dea698cb;hb=750b714488c5af6eae22d07163bba8b554734ac6;hp=00d00492c73ad214b374e541ead2d8dbcd5462d7;hpb=8247813bc580a90f7838846dc38aad5d49ac9d9d;p=lilypond.git diff --git a/Documentation/snippets/adding-extra-fingering-with-scheme.ly b/Documentation/snippets/adding-extra-fingering-with-scheme.ly index 00d00492c7..c93557a36b 100644 --- a/Documentation/snippets/adding-extra-fingering-with-scheme.ly +++ b/Documentation/snippets/adding-extra-fingering-with-scheme.ly @@ -1,53 +1,46 @@ %% DO NOT EDIT this file manually; it is automatically -%% generated from LSR http://lsr.dsi.unimi.it +%% generated from LSR http://lsr.di.unimi.it %% Make any changes in LSR itself, or in Documentation/snippets/new/ , %% and then run scripts/auxiliar/makelsr.py %% %% This file is in the public domain. -\version "2.14.2" +\version "2.19.22" \header { lsrtags = "scheme-language" texidoc = " -You can add various stuff to notes using @code{make-music}. In this -example, an extra fingering is attached to a note. - - -In general, first do a @code{display} of the music you want to create, -then write a function that will structure the music for you. - +You can add additional elements to notes using @code{map-some-music}. +In this example, an extra script is attached to a note. +In general, first do a @code{\\displayMusic} of the music you want to +create, then write a function that will work on the appropriate parts +of the music for you. " doctitle = "Adding extra fingering with scheme" } % begin verbatim - -#(define (make-text-script x) - (make-music 'TextScriptEvent - 'direction DOWN - 'text (make-simple-markup x))) - -#(define (add-text-script m x) - (if (equal? (ly:music-property m 'name) 'EventChord) - (set! (ly:music-property m 'elements) - (cons (make-text-script x) - (ly:music-property m 'elements))) - (let ((es (ly:music-property m 'elements)) - (e (ly:music-property m 'element))) - (map (lambda (y) (add-text-script y x)) es) - (if (ly:music? e) - (add-text-script e x)))) - m) - addScript = -#(define-music-function (parser location script music ) - ( string? ly:music? ) - (add-text-script music script)) +#(define-music-function (script music) + (ly:event? ly:music?) + (map-some-music + (lambda (mus) + (define (append-script-at! prop) + (set! (ly:music-property mus prop) + (append (ly:music-property mus prop) + (list (ly:music-deep-copy script)))) + mus) + (case (ly:music-property mus 'name) + ((EventChord) + (append-script-at! 'elements)) + ((NoteEvent) + (append-script-at! 'articulations)) + (else #f))) + music)) \score { { - \addScript "6" { c'4-3 } + \addScript _6 { c'4-3 } } }