Am Samstag, 5. Dezember 2009 01:42:16 schrieb Robin Bannister:
> Aaron Dalton wrote:
> > I want to be able to hide the accidental.
>
> There is Mark Polesky's suppress-accidental
> http://lists.gnu.org/archive/html/lilypond-devel/2009-07/msg00384.html
> but that is probably overkill in your case.
>
> You can do it by switching the style in a music function
> http://lilypond.org/doc/v2.12/Documentation/user/lilypond/Music-functions
Alternatively, you can take a look at the 'teaching accidental style, which
explicitly displays the accidentals implied by the key signature as warning
accidentals.
The cooll thing about this style is that if two equal pitches succeed each
other, the second one never gets an accidental, but if there is at least one
note in between, the second one does. E.g. if you have
\relative c' {
\key es \major
#(set-accidental-style 'teaching)
es es g e
es g es e |
}
Then the in the first measure the second es will not get an accidental (since
it immediately follows another es), while in the second measure the second es
will get an accidental (since it follows a different pitch)...
The definition of the teaching style is in scm/music-functions.scm...
Attached is a starting point where you "only" need to take the my-madrigal-
accidental-rule and adjust it to your own use case (yeah, I know, that sounds
so easy... To be honest, I haven't digested the code to exactly understand how
to adjust the rul.)...
Cheers,
Reinhold
--
--
Reinhold Kainhofer, reinh...@kainhofer.com, http://reinhold.kainhofer.com/
* Financial & Actuarial Math., Vienna Univ. of Technology, Austria
* http://www.fam.tuwien.ac.at/, DVR: 0005886
* LilyPond, Music typesetting, http://www.lilypond.org
% Your own madrigal accidental rule...
#(define-public (my-madrigal-accidental-rule context pitch barnum measurepos)
"Here comes the description. This style is an exact copy of
teaching-accidental-rule and needs to be adjusted.
Original description:
an accidental rule that typesets a cautionary accidental
if it is included in the key signature AND does not directly follow
a note on the same staff-line."
(let* ((keysig (ly:context-property context 'localKeySignature))
(entry (find-pitch-entry keysig pitch #t #t)))
(if (equal? #f entry)
(cons #f #f)
(let* ((global-entry (find-pitch-entry keysig pitch #f #f))
(key-acc (if (equal? global-entry #f)
0
(key-entry-alteration global-entry)))
(acc (ly:pitch-alteration pitch))
(entrymp (key-entry-measure-position entry))
(entrybn (key-entry-bar-number entry)))
(cons #f (not (or (equal? acc key-acc)
(and (equal? entrybn barnum) (equal? entrymp measurepos)
\relative c' {
\key es \major
% #(set-accidental-style 'teaching)
% is the same as the following.
#(ly:export (set-accidentals-properties #f
; automatic accidental rule:
`(Staff ,(make-accidental-rule 'same-octave 0))
; cautionary accidental rule: (might want to put this to auto-acc and set cautionaries to '() ??)
`(Staff ,(make-accidental-rule 'same-octave 1)
,my-madrigal-accidental-rule)
'Staff))
es es g e
es g es e |
}
___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user