lilypond-user
[Top][All Lists]
Advanced

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

Scheme function to affect a compound music expression?


From: Peter Crighton
Subject: Scheme function to affect a compound music expression?
Date: Thu, 23 Oct 2014 14:05:29 +0200

Hello all,

I’m taking my very first little steps into Scheme right now by trying to write a function that can make single note heads (and accidentals) in a chord smaller (to differentiate background vocals from lead vocal when writing them all in one voice).


What I have so far is:

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

or

bgr = #(define-music-function
         (parser location note)
         (ly:music?)
         (set! (ly:music-property note 'tweaks)
               (cons (cons (cons (quote NoteHead) (quote font-size))
                       -2)
                 (ly:music-property note 'tweaks)))
         (set! (ly:music-property note 'tweaks)
               (cons (cons (cons (quote Accidental) (quote font-size))
                       -2)
                 (ly:music-property note 'tweaks)))
         note)

which should be the same.


Here is an example that uses it:

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

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

But I would like to be able to use the function as follows, so it doesn’t only affect the next note, but a sequence of notes enclosed in { … }:

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

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

Can somebody point me in the right direction how to do this?

--
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]