[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Notes in Key Sig
From: |
Nicolas Sceaux |
Subject: |
Re: Notes in Key Sig |
Date: |
Sat, 23 Apr 2005 13:31:13 +0200 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
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.
nicolas
- Notes in Key Sig, David Raleigh Arnold, 2005/04/21
- Re: Notes in Key Sig, Erik Sandberg, 2005/04/22
- Re: Notes in Key Sig,
Nicolas Sceaux <=
- Re: Notes in Key Sig, Bernard Hurley, 2005/04/23
- Re: Notes in Key Sig, Nicolas Sceaux, 2005/04/23
- Message not available
- Re: Solfeggio (was:)Notes in Key Sig, Bernard Hurley, 2005/04/23
- Re: Solfeggio, Nicolas Sceaux, 2005/04/24
- Re: Solfeggio, darius, 2005/04/24
- Re: Solfeggio, Nicolas Sceaux, 2005/04/24
- RE: Solfeggio, Fairchild, 2005/04/24
- RE: Solfeggio, darius, 2005/04/24
- Re: Solfeggio, Paul Scott, 2005/04/24
- Re: Solfeggio, Bernard Hurley, 2005/04/24