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 17:40:49 +0100

On Sat, Nov 3, 2012 at 1:09 AM, Olivier Biot <address@hidden> wrote:
> On Tue, Oct 30, 2012 at 10:50 PM, Eluze <address@hidden> wrote:
>> shutterfreak wrote
>>> Hi all,
>>>
>>> I'd like to have a function to translate a key signature into the
>>> textual representation of that key in 3 languages.
>>>
>>> For instance, I'd write this in my score:
>>
>>>
>>> and the rendering would look like this:
>>
>>>
>>> The logic I'm trying to implement, is (in pseudo-code):
>>> 1. key format =
>>> <key_name>
>>>  [
>>> <accidentals>
>>> ]
>>> 2. IF
>>> <key_name>
>>>  is lowercase THEN key is minor ELSE key is major.
>>> 3. If accidentals are added, they pertain to the key name
>>>
>>> How should I proceed?
>>
>> I guess you should use some scheme code to
>>
>> - create those translations/associations (a table?)
>> - concatenate the 3 translated elements
>> - include them in your LilyPond code
>>
>> if you feel this could be of general interest you should file an enhancement
>> request.
>>
>> hth
>> Eluze
>
> Hi Eluze,
>
> I am not yet fluent in Scheme, hence I need some indications in how to 
> proceed.
>
> It would be extremely helpful if I would know how to e.g. translate
> "c+" into "C sharp minor" and "D" into "D major".
>
> Best regards,
>
> Olivier

Dear all,

I definitely have problems with Scheme and LilyPond interpretation. I
now have the Scheme standard open as well.

I tried to simplify the initial job by first creating a function with
one string argument returning either a string or a markup. Does not
work.

I tried hundreds of alternatives, with musoc-function and withj
markup-command, with a define and define-scheme-funciton, to no avail.

Why is the following not working?

%%% BEGIN SNIPPET

\version "2.16.0"

#(define-markup-command (tonicEN props layout tonic) ( string? )
    (
        (cond
            ( (string=? tonic '"cis") ("C sharp") )
            ( (string=? tonic '"dis") ("D sharp") )
        )
    )
)

\header {
  composer = "myself"
  title = \tonicEN "cis"
}

\score {
  \relative c' {
    a bes cis deses e fisis ges
  }
  \layout {}
}

%%% END SNIPPET



reply via email to

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