[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Setting the value of a music property
From: |
Joseph Wakeling |
Subject: |
Setting the value of a music property |
Date: |
Sun, 25 Jul 2010 14:22:04 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100528 Lightning/1.0b1 Thunderbird/3.0.5 |
Dear everyone,
A possibly dumb question -- I'm having some difficulty working out how
to set the value of a given music property.
Here's a little piece of Lilypond Scheme adapted from the
naturalizeMusic.ly snippet:
naturalizeMusic =
#(define-music-function (parser location m)
(ly:music?)
(naturalize m (ly:music-property music 'naturalize-style)))
Now, naturalize-style I've defined in scm/define-music-properties.scm:
--------------------------------------------------------------------------
diff --git a/scm/define-music-properties.scm
b/scm/define-music-properties.scm
index 2af8f92..6709154 100644
--- a/scm/define-music-properties.scm
+++ b/scm/define-music-properties.scm
@@ -106,6 +106,7 @@ whether to allow, forbid or force a line break.")
(metronome-count ,number? "How many beats in a minute?")
(name ,symbol? "Name of this music object.")
+ (naturalize-style ,list? "The rules for what pitch-alterations are
permissible.")
(no-continuation ,boolean? "If set, disallow continuation lines.")
(numerator ,integer? "Numerator of a time signature.")
--------------------------------------------------------------------------
... but when I try some Lilypond code along the following lines,
> music = \relative c' { c4 d e g }
>
> \score {
> \new Staff {
> \set Staff.extraNatural = ##f
> \withMusicProperty #'naturalize-style #(list (cons >= 1) (cons <= -1)
> (cons >= SHARP) (cons <= FLAT))
> \naturalizeMusic \transpose c ais { \music }
> }
> \layout { }
> }
... I get an error:
> Parsing...code/lily/out/share/lilypond/current/scm/naturalize.scm:10:33: In
> procedure list-ref in expression (list-ref pitch-limits 0):
> code/lily/out/share/lilypond/current/scm/naturalize.scm:10:33: Argument 2 out
> of range: 0
... which suggests that 'naturalize-style is being taken as empty by the
ly:music-property function. Giving it a default value equal to an
actual list,
> naturalizeMusic =
> #(define-music-function (parser location m)
> (ly:music?)
> (naturalize m (ly:music-property music 'naturalize-style (list (cons >= 1)
> (cons <= -1) (cons >= SHARP) (cons <= FLAT)))))
... means it parses without error, so it looks like the
ly:music-property function is currently just using the default value
given, and does not appreciate the 'naturalize-style property as already
having a set value.
So, the question comes down to, what am I doing wrong in trying to set
the 'naturalize-style property of the music? Putting brackets {} round
the music to which the \withMusicProperty statement should apply doesn't
help.
I tried more directly using the ly:music-set-property! function, but
could not work it out. :-(
Can anyone advise?
Thanks & best wishes,
-- Joe
P.S. naturalize.scm is not really relevant to this question (I think),
but just in case, I've attached it.
naturalize.scm
Description: Text document
- Setting the value of a music property,
Joseph Wakeling <=