lilypond-user
[Top][All Lists]
Advanced

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

Re: Notes in Key Sig


From: Erik Sandberg
Subject: Re: Notes in Key Sig
Date: Sat, 23 Apr 2005 15:46:50 +0200
User-agent: KMail/1.7.2

On Saturday 23 April 2005 13.31, Nicolas Sceaux wrote:
> David Raleigh Arnold <address@hidden> 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.

Maybe this is something for LSR?

Erik




reply via email to

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