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: Simon Albrecht
Subject: Re: Scheme function to affect a compound music expression?
Date: Fri, 24 Oct 2014 00:02:39 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

Hello all,

I tried to write such a function, but failed at the point you’ll see in the attachment. I’d like to learn how this can be made to work ;-) … The problem is in extracting the list from SequentialMusic’s 'element property. And I suspect it has to do with the following question:
With display-music I can obtain:
#<Prob: Music C++: Music((duration . #<Duration 4 >) (pitch . #<Pitch e >) (origin . #<location c:/users/simon/appdata/local/temp/frescobaldi-_4tllv/tmpdndxnp/bgr.ly:25:10>))((display-methods #<procedure #f (note parser)>) (name . NoteEvent) (iterator-ctor . #<primitive-procedure ly:rhythmic-music-iterator::constructor>) (types general-music event note-event rhythmic-event melodic-event)) >

: { ((duration . #<Duration 4 >) (pitch . #<Pitch e >) (origin . #<location c:/users/simon/appdata/local/temp/frescobaldi-_4tllv/tmpdndxnp/bgr.ly:25:10>)) }
and with display-scheme-music:
(make-music

'NoteEvent

'duration

(ly:make-duration 2)

'pitch

(ly:make-pitch -1 2))
What kind of syntax is the first one? And how can I compute one from the other?


Grateful as always for help and with best regards,
Simon


Am 23.10.2014 um 14:05 schrieb Peter Crighton:
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


_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user

Attachment: bgr.ly
Description: Text Data


reply via email to

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