lilypond-user
[Top][All Lists]
Advanced

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

Re: Function for rendering key textually in 3 languages


From: Olivier Biot
Subject: Re: Function for rendering key textually in 3 languages
Date: Sat, 3 Nov 2012 19:24:39 +0100

On Sat, Nov 3, 2012 at 6:11 PM, Olivier Biot <address@hidden> wrote:
> Hi David,
>
> Thanks a lot - I now start to see the mistakes I made (excess
> parentheses around the cond expression and excess parentheses around
> the return values in the cond sub expressions).
>
> I have however to use quotes around the note name for it to work.
>
> Here's code that actually works, maybe it can be useful for others:
>
[...]

I now got the method to use 2 parameters and produce the key signature in text:

%%% START of snippet 1
tonicEN = #(define-scheme-function (parser layout tonic arg) (string? string?)
             (string-append
              (cond
               ( (string=? tonic "a") "A" )
               ( (string=? tonic "b") "B" )
               ( (string=? tonic "c") "C" )
               ( (string=? tonic "d") "D" )
               ( (string=? tonic "e") "E" )
               ( (string=? tonic "f") "F" )
               ( (string=? tonic "g") "G" )

               ( (string=? tonic "aes") "A flat" )
               ( (string=? tonic "bes") "B flat" )
               ( (string=? tonic "ces") "C flat" )
               ( (string=? tonic "des") "D flat" )
               ( (string=? tonic "ees") "E flat" )
               ( (string=? tonic "fes") "F flat" )
               ( (string=? tonic "ges") "G flat" )

               ( (string=? tonic "ais") "A sharp" )
               ( (string=? tonic "bis") "B sharp" )
               ( (string=? tonic "cis") "C sharp" )
               ( (string=? tonic "dis") "D sharp" )
               ( (string=? tonic "eis") "E sharp" )
               ( (string=? tonic "fis") "F sharp" )
               ( (string=? tonic "gis") "G sharp" )
               )
              (cond
               ( (string=? arg "major") " major" )
               ( (string=? arg "minor") " minor" )
               )
              )
             )
%%% END of snippet 1

I have a similar tonicDE and tonicFR function now. I can call only one
of those and assign the value to a header parameter (e.g., title).

What I now need to figure out, is how to print the output in a markup,
like in the currently not working snippets below:

%%% START of snippet 2
\header {
  title = \markup {\italic \tonicEN "cis" "minor"}
}
%%% END of snippet 2

%%% START of snippet 3
 \markup {
    \fill-line {
      \center-column {
        \concat {
          \italic \tonicEN "cis" "minor"
          \upright \tonicDE "cis" "minor"
        }
      }
    }
 }
%%% END of snippet 3

Best regards,

Olivier



reply via email to

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