lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Will my scheme function work have unintended consequences? Adding stacca


From: Peter Engelbert
Subject: Will my scheme function work have unintended consequences? Adding staccatos to notes.
Date: Fri, 14 Sep 2018 13:08:49 -0700
User-agent: Mutt/1.10.1 (2018-07-13)

Hello all,

I've written the following functions to add staccatos to an arbitrary number of 
notes:

===addStaccatos.ly=
\version "2.19.82"

#(define (add-staccato note-event)
  (set! (ly:music-property note-event 'articulations)
   (cons (make-music 'ArticulationEvent 'articulation-type "staccato")
    (ly:music-property note-event 'articulations))))

addStaccatos =
#(define-music-function (music) (ly:music?)
   (map add-staccato (ly:music-property music 'elements)) music)
===================

Here is the MWE I've used to test it:

=====test.ly=======
\version "2.19.82"
\include "addStaccatos.ly"

{ c4 \addStaccatos { c4 c4 c4 | c4^> } }
===================

I am just checking, with more experienced eyes, whether or not this function 
will work in all cases.  It seems to work in my minimal example, but I really 
don't know very much about how scheme represents music, so I'm concerned that 
there might be some cases where this will not work.

Also, I tried a few earlier attempts at this before getting it to work, one of 
them used the MUSIC-MAP function.  What does MUSIC-MAP do, and how does it 
differ from the standard MAP? And most importantly, what is its proper syntax? 
I looked it up in the .scm file where it's defined, but it's a bit beyond me at 
the moment.

Many thanks for your help,
Peter





reply via email to

[Prev in Thread] Current Thread [Next in Thread]