lilypond-devel
[Top][All Lists]
Advanced

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

Re: some sort of suppress-accidental?


From: Jonathan Kulp
Subject: Re: some sort of suppress-accidental?
Date: Mon, 15 Jun 2009 23:54:31 -0500
User-agent: Thunderbird 2.0.0.21 (X11/20090409)

Mark Polesky wrote:
entering { \displayMusic c'! } yields:

(make-music
  'EventChord
  'elements
  (list (make-music
          'NoteEvent
          'force-accidental
          #t
          'duration
          (ly:make-duration 2 0 1 1)
          'pitch
          (ly:make-pitch 0 0 0))))

I wish there were a similar way to suppress the printing of the
accidental from within the NoteEvent expression.

Something like 'suppress-accidental that would fit right where
'force-accidental goes in the scheme expression. Is that
possible? Would it be difficult to implement?

- Mark


Hi Mark,

I'm very hesitant to make suggestions at all, since I don't know scheme, but this interests me and I've been snooping around the code trying to figure out where these things are defined. It looks like you could define another character to specify "suppress-accidental" in the "define-music-display-methods.scm" file, in this block:

;;;
;;; Notes, rests, skips...
;;;

(define (simple-note->lily-string event parser)
(format #f "~a~a~a~a~{~a~}" ; pitchname octave !? octave-check articulations
          (note-name->lily-string (ly:music-property event 'pitch) parser)
          (octave->lily-string (ly:music-property event 'pitch))
          (let ((forced (ly:music-property event 'force-accidental))
                (cautionary (ly:music-property event 'cautionary)))
            (cond ((and (not (null? forced))
                        forced
                        (not (null? cautionary))
                        cautionary)
                   "?")
                  ((and (not (null? forced)) forced) "!")
                  (else "")))
          (let ((octave-check (ly:music-property event 'absolute-octave)))
            (if (not (null? octave-check))
                (format #f "=~a" (cond ((>= octave-check 0)
                                        (make-string (1+ octave-check) #\'))
                                       ((< octave-check -1)
                                        (make-string (1- (* -1 octave-check)) 
#\,))
                                       (else "")))
                ""))
          (map-in-order (lambda (event)
                          (music->lily-string event parser))
                        (ly:music-property event 'articulations))))


I can see where it checks for "?" for cautionary and "!" for forced. Assuming, for example, that the character "&" is not used for something else (I can't think of anything it's used for in lilypond source files), maybe you could add

((and (not (null? suppressed)) suppressed) "&")

But then I don't know where you would define the behavior for suppressed.

Jon
--
Jonathan Kulp
http://www.jonathankulp.com




reply via email to

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