lilypond-user
[Top][All Lists]
Advanced

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

Re: Scheme function to affect a compound music expression?


From: Peter Crighton
Subject: Re: Scheme function to affect a compound music expression?
Date: Fri, 24 Oct 2014 15:16:24 +0200

2014-10-24 13:57 GMT+02:00 Peter Crighton <address@hidden>:
2014-10-24 11:05 GMT+02:00 Robin Bannister <address@hidden>:

The source file music-functions.scm defines
music-map
which you can use for this:


bgr = #(define-music-function (parser location music) (ly:music?)
   (music-map (lambda (note)
     #{
       \tweak NoteHead.font-size #-2
       \tweak Accidental.font-size #-2
       #note
     #})
     music ))


There is an advanced example in the regression tests:
http://www.lilypond.org/doc/v2.18/input/regression/collated-files.html#music-map.ly

Thanks a lot, Robin! I wouldn’t have thought it would be this easy …

Although I now came upon the following situation with rests:

\version "2.19.13"

bgr = #(define-music-function
        (parser location music)
        (ly:music?)
        (music-map (lambda (note)
                     #{
                       \tweak NoteHead.font-size #-2
                       \tweak Accidental.font-size #-2
                       #note
                     #})
          music))

\new Voice <<
  \relative c' {
    c4 d r f
  }

  \relative c' \bgr {
    e4 f r a
  }
>>

I get these warnings:

/home/peter/bgr.ly:21:16: warning: Two simultaneous rest events, junking this one
  \relative c' 
               \bgr {
/home/peter/bgr.ly:18:10: warning: Previous rest event here
    c4 d 
         r f

Although it doesn’t seem to affect the output, it is still not desired behaviour, and I don’t know why the \bgr function causes it.
Any ideas?
 

But maybe this could be better documented? I never would have thought of looking for it in the regression tests (in fact I didn’t even know about them).
Are there other places to learn about Scheme in LilyPond than the Scheme tutorial?

--
Peter Crighton | Musician & Music Engraver based in Mainz, Germany
http://www.petercrighton.de

reply via email to

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