I have a piece that is in the following scale:

c d e fis g aes bes b

Is it possible to force the accidentals just for the bes and the b?

But here is the catch...
I am both transposing the part and respelling pitch-classes as show below. The 
scale above is actually the resulting printed set of notes. The music is 
already generated and I would not want to have to do this manually for each 

Thanks in advance,


transposePitchClasses =
#(define-music-function (scaleA scaleB music) (ly:music? ly:music? ly:music?)
  (let* ((scaleA (ly:music-property scaleA 'elements))
         (scaleB (ly:music-property scaleB 'elements))
         (scaleA (map (lambda (x) (ly:music-property x 'pitch)) scaleA))
         (scaleB (map (lambda (x) (ly:music-property x 'pitch)) scaleB))
         (classesA (map (lambda (p) (cons (ly:pitch-notename p) 
(ly:pitch-alteration p))) scaleA)))
    (lambda (m)
      (let ((p (ly:music-property m 'pitch)))
        (if (not (null? p))
            (let* ((nn (ly:pitch-notename p))
                   (oct (ly:pitch-octave p))
                   (alt (ly:pitch-alteration p))
                   (pos (list-index (lambda (x) (and (= (car x) nn) (= (cdr x) 
alt))) classesA)))
            (if pos
              (let* ((p2 (list-ref scaleA pos))
                     (oct2 (ly:pitch-octave p2))
                     (p3 (list-ref scaleB pos))
                     (new-pitch (ly:pitch-transpose p3 (ly:make-pitch (- oct 
oct2) 0))))
              (ly:music-set-property! m 'pitch new-pitch)))
\new Staff \with {
      instrumentName = #"synth I (2)"
      shortInstrumentName = #"synI"
      \remove "Time_signature_engraver"
      \transpose a c'
      \transposePitchClasses {a b cis dih e fih geh gis} {a b cis dis e f g gis}
      \include "includes/ammann_part_6.ly" %this is the music

Reply via email to