Hello again,

well, now I did try and make a function for german note names, which discerns major and minor also. Actually it works – the transposition is applied correctly and there are no unexpected messages – but at testing there seemed to be a memory problem: from some point onwards, the newTonicString was always "eses" regardless of the input. Perhaps the computer and I ought to go to sleep. (what a mad sentence that is…)
And thanks again for your input, Paul.

Best, Simon

Am 10.10.2014 um 23:55 schrieb Simon Albrecht:
Hello Paul,

thanks a lot! I thought along the same lines also, but (1) my less elegant coding and (2) the complications brought along by German notenames would’ve made it too tedious.

Am 10.10.2014 um 23:44 schrieb Paul Morris:
Just for fun, another version, more compact, probably more cryptic:

%%%%%%%%%%%%%%
\version "2.19.12"
If you were to make an LSR snippet, I’d suggest making a Dutch version pitch-to-string-dutch also (same for both coding variants):

pitch-to-string =
#(define-scheme-function (parser location p) (ly:pitch?)
    (string-append
     (list-ref '("C" "D" "E" "F" "G" "A" "B")
       (ly:pitch-notename p))
     (list-ref '("-Double-Flat" "-Flat" "" "-Sharp" "-Double-Sharp")
replace the latter list by '("eses" "es" "" "is" "isis")
       (+ 2 (* 2 (ly:pitch-alteration p))))))

newTonic = d

newTonicString = \pitch-to-string \newTonic

% for testing:
#(display (string-append "in-" newTonicString))

\bookOutputSuffix #(string-append "in-" newTonicString)

\score { \transpose c \newTonic { c' } }

%%%%%%%%%%%%%%

Best regards, Simon

_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

%%%%%%%%%%%%%%
\version "2.19.12"
\language "deutsch"

pitch-to-key-string-german =
#(define-scheme-function
  (parser location p mode)
  (ly:pitch? string?)
  (let*
   ((major? (equal? mode "major"))
    (nn (ly:pitch-notename p))
    (nn-string (if major?
                   (list-ref '("C" "D" "E" "F" "G" "A" "H") nn)
                   (list-ref '("c" "d" "e" "f" "g" "a" "h") nn)))
    (alt (ly:pitch-alteration p))
    (alt-num (+ 2 (* 2 (ly:pitch-alteration p))))
    (alt-string (list-ref '("eses" "es" "" "is" "isis") alt-num))
    ;pitch without octave
    (na (cons nn alt))
    ;helper function for exceptions in german note naming
    (exc (lambda (n a ma mi)
           ((equal? na (cons n a))
            (if major? ma mi)))))
   
   (cond
    (exc 2 -1 "Eses" "eses")
    (exc 2 -1/2 "Es" "es")
    (exc 5 -1 "Asas" "asas")
    (exc 5 -1/2 "As" "as")
    (exc 6 -1/2 "B" "b")
    (else (string-append nn-string alt-string)))))

newTonic = disis'

newTonicString = \pitch-to-key-string-german \newTonic "major"

% for testing:
#(display (string-append "in-" newTonicString))

\bookOutputSuffix #(string-append "in-" newTonicString)

\score { \transpose c \newTonic { c' } }

%%%%%%%%%%%%%%
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to