Hallo,
anbei ein rudimentäres Beispiel, wie ich eine »Reine Stimmung« im »gleichschwebend temperierten Notensystem« darstellen kann.
Ich habe einfach eine Obertonreihe als Musik-Schnipsel definiert. Für die Notenschriftdarstellung runde ich die Pitch-Werte auf den nächstgelegenen Viertelton und schreibe die Rundungsdifferenz (als Fingersatz untergeschoben) zu den Noten hinzu.
\version "2.18.2"
RPT = % Rational Pitch Transpose
#(define-music-function
(parser location ratio semitones whole-step-precision m)
(rational? rational? integer? ly:music?)
(let
((delta (inexact->exact (round (* whole-step-precision
(- (* (/ ($log ratio) ($log 2.0)) 6.0) (/ semitones 2)))))))
(ly:music-transpose m (ly:make-pitch 0 0 (/ delta whole-step-precision)))))
Musik = {
\clef bass
c,1 _"1"
c1 _"2"
\clef treble
\RPT #3/2 #7 #200000000 g1 _"3"
c'1 _"4"
\RPT #5/4 #4 #200000000 e'1 _"5"
\RPT #3/2 #7 #200000000 g'1 _"6"
\RPT #7/4 #10 #200000000 bes'1 _"7"
c''1 _"8"
\RPT #9/8 #2 #200000000 d''1 _"9"
\RPT #5/4 #4 #200000000 e''1 _"10"
\RPT #11/8 #6 #200000000 fis''1 _"11"
\RPT #3/2 #7 #200000000 g''1 _"12"
\clef "treble^8"
\RPT #13/8 #8 #200000000 as''1 _"13"
\RPT #7/4 #10 #200000000 bes''1 _"14"
\RPT #15/16 #-1 #200000000 b''1 _"15"
c'''1 _"16"
\RPT #17/16 #1 #200000000 cis'''1 _"17"
\RPT #9/8 #2 #200000000 d'''1 _"18"
\RPT #19/16 #3 #200000000 dis'''1 _"19"
\RPT #5/4 #4 #200000000 e'''1 _"20"
\RPT #21/16 #5 #200000000 f'''1 _"21"
\RPT #11/8 #6 #200000000 fis'''1 _"22"
\RPT #23/16 #6 #200000000 ges'''1 _"23"
\RPT #3/2 #7 #200000000 g'''1 _"24"
\RPT #25/16 #8 #200000000 gis'''1 _"25"
\RPT #13/8 #8 #200000000 as'''1 _"26"
\RPT #27/16 #9 #200000000 a'''1 _"27"
\bar "|."
}
% Diese musicMap-Funktion nur mit \layout{} verwenden,
% nicht mit \midi{} (würde die Pitch-Bends in der MIDI-Datei verfälschen)!
#(define (bend-to-next-quartertone e)
(let ((eventtype (ly:music-property e 'name)))
;;; (for-each display (list "\n name(eventtype) = " eventtype " "))
(if (eq? eventtype 'NoteEvent)
(let* ((art (ly:music-property e 'articulations '()))
(p (ly:music-property e 'pitch))
(alt (ly:pitch-alteration p))
(okt (ly:pitch-octave p))
(pnn (ly:pitch-notename p))
;; (cents (* 200.0 (exact->inexact alt)))
(qtns (round (* 4 alt))) ;;; Naeherung in Vierteltoenen - eine sehr einfache Rundungsmethode
)
;;; (for-each display (list "\n pitch = " p " ( " okt " " pnn " " (format #f "~3,1@f" (* 200.0 (exact->inexact alt))) " ) ->" qtns " "))
(ly:music-set-property! e 'pitch (ly:make-pitch okt pnn (/ qtns 4)))
(let* ((remaining-cents (- (* 200 alt) (* 50 qtns)))
(delta-text (format #f "~3,1@f" (exact->inexact remaining-cents))) ;;; eine Nachkommastelle, immer mit Vorzeichen
)
(if (= remaining-cents 0) (set! delta-text "±0.0"))
;;; (for-each display (list "\n delta = " (ly:number->string (exact->inexact remaining-cents)) " -> " delta-text " "))
(ly:music-set-property! e 'articulations (cons
(make-music 'FingeringEvent
'text (markup #:whiteout (#:normal-text delta-text)))
art))
)))
e))
\score {
{ \musicMap #bend-to-next-quartertone \Musik }
\header {
piece = \markup \justify {
Obertonreihe, auf Vierteltöne gerundet, und die verbleibende Differenz (in Cent) als »Fingersatz-Text« hinzugefügt
}
}
}
Auch habe ich noch ein paar Text-Ausgaben (zum Debuggen) als Kommentare in der musicMap-Funktion stehen gelassen.
Arnold