Dear Sandeep,
Yes, there is an solution, hope You can use it:
#(define (naturalize-pitch p)
(let* ((o (ly:pitch-octave p))
(a (* 4 (ly:pitch-alteration p)))
; alteration, a, in quarter tone steps, for historical reasons
(n (ly:pitch-notename p)))
(cond
((and (> a 1) (or (eq? n 6) (eq? n 2)))
(set! a (- a 2))
(set! n (+ n 1)))
((and (< a -1) (or (eq? n 0) (eq? n 3)))
(set! a (+ a 2))
(set! n (- n 1))))
(cond
((> a 2) (set! a (- a 4)) (set! n (+ n 1)))
((< a -2) (set! a (+ a 4)) (set! n (- n 1))))
(if (< n 0) (begin (set! o (- o 1)) (set! n (+ n 7))))
(if (> n 6) (begin (set! o (+ o 1)) (set! n (- n 7))))
(ly:make-pitch o n (/ a 4))))
#(define (naturalize music)
(let* ((es (ly:music-property music 'elements))
(e (ly:music-property music 'element))
(p (ly:music-property music 'pitch)))
(if (pair? es)
(ly:music-set-property!
music 'elements
(map (lambda (x) (naturalize x)) es)))
(if (ly:music? e)
(ly:music-set-property!
music 'element
(naturalize e)))
(if (ly:pitch? p)
(begin
(set! p (naturalize-pitch p))
(ly:music-set-property! music 'pitch p)))
music))
naturalizeMusic =
#(define-music-function (parser location m)
(ly:music?)
(naturalize m))
#(define vereinfachs naturalizeMusic)
%Enharmonische Verwechslung
%Nur Kreuze zeigen
kreuze = #(define-music-function (parser location x) (ly:music?)
#{
\transpose ges fis $x
#})
%nur Bes zeigen
bees = #(define-music-function (parser location x) (ly:music?)
#{
\transpose fis ges $x
#})
meistkreuze = #(define-music-function (parser location x) (ly:music?)
#{
\vereinfachs \transpose ges fis $x
#})
meistbees = #(define-music-function (parser location x) (ly:music?)
#{
\vereinfachs \transpose fis ges $x
#})
You can use it like:
\new Staff { \transpose c, c { \kreuze ges1 \bees fis \meistkreuze {c d es e
fis g a b } }}
Note, that it doesn't not work in relative mode.
I usually use the possbilitie to expand abbreviations in Frescobaldi.
I type s then <strg> <space> and then I get "\kreuze"
> Hi list,
>
> Is there a scheme snippet that will reprint a sharp as the enharmonic
> flat if it appears after a flat, reprint a flat as the enharmonic
> sharp if it appears after a sharp, and leave a note alone if it
> appears after a natural? Better yet would be if it always left fis
> and bes alone.
>
> Thanks very much,
> Sandeep
>
>
_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user