David Raleigh Arnold <[EMAIL PROTECTED]> writes:
> People have asked in the past for the ability to enter
> notes without having to put in the chromatic signs
> specified in the key signature.
This should be possible in plain LilyPond. Maybe something like:
---------------------------------------------------------------
\version "2.5.20"
autoAlteration = #(def-music-function (parser location key music) (ly:music?
ly:music?)
(let ((pitch-alist (ly:music-property (car
(ly:music-property key 'elements))
'pitch-alist)))
(music-map (lambda (m)
;; If the music is a NoteEvent, we change
its alteration,
;; unless its accidental is forced
(let ((this-pitch (ly:music-property m
'pitch)))
(if (eqv? 'NoteEvent (ly:music-property m
'name))
(cond (;; if ! is found, we remove it
and leave the alteration untouched
(and (not (null?
(ly:music-property m 'force-accidental)))
(ly:music-property m
'force-accidental)
(= 0 (ly:pitch-alteration
this-pitch)))
(set! (ly:music-property m
'force-accidental) #f))
(;; if the alteration is 0, then
we change it according to pitch-alist
(zero? (ly:pitch-alteration
this-pitch))
(set! (ly:music-property m
'pitch)
(ly:make-pitch
(ly:pitch-octave this-pitch)
(ly:pitch-notename this-pitch)
(cdr
(assoc (ly:pitch-notename this-pitch) pitch-alist))))))))
m)
music)
;;music))
(make-music 'SequentialMusic 'elements (list key music))))
\autoAlteration \key a \major {
a b c' d' e' f' g' a'
a b c' d' ees' f' g'! a'
}
---------------------------------------------------------------
where you can use ! to prevent the function to change the (natural)
alteration.
nicolas
_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user