lilypond-user
[Top][All Lists]
Advanced

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

Re: Feature Request: Chromatic note names


From: Paul Morris
Subject: Re: Feature Request: Chromatic note names
Date: Thu, 30 May 2013 09:00:40 -0700 (PDT)

I did some experimenting with this snippet:
http://lsr.dsi.unimi.it/LSR/Item?id=638

And I think it might be a good way to convert chromatic note name input to
traditional note name input.  No midi conversion required.  Here's how it
works:

Add the following two language definitions to: scm/define-note-names.scm
The first is for converting to sharp keys, the second for flat keys.

    (chromatic-sharp . (
                (do . ,(ly:make-pitch -1 0 NATURAL))
                (di . ,(ly:make-pitch -1 0 SHARP))
                (re . ,(ly:make-pitch -1 1 NATURAL))
                (me . ,(ly:make-pitch -1 1 SHARP))
                (mi . ,(ly:make-pitch -1 2 NATURAL))
                (fa . ,(ly:make-pitch -1 3 NATURAL))
                (fi . ,(ly:make-pitch -1 3 SHARP))
                (so . ,(ly:make-pitch -1 4 NATURAL))
                (sol . ,(ly:make-pitch -1 4 NATURAL))
                (lu . ,(ly:make-pitch -1 4 SHARP))
                (la . ,(ly:make-pitch -1 5 NATURAL))
                (se . ,(ly:make-pitch -1 5 SHARP))
                (si . ,(ly:make-pitch -1 6 NATURAL))
                (ti . ,(ly:make-pitch -1 6 NATURAL))
                ))

    (chromatic-flat . (
                (do . ,(ly:make-pitch -1 0 NATURAL))
                (di . ,(ly:make-pitch -1 1 FLAT))
                (re . ,(ly:make-pitch -1 1 NATURAL))
                (me . ,(ly:make-pitch -1 2 FLAT))
                (mi . ,(ly:make-pitch -1 2 NATURAL))
                (fa . ,(ly:make-pitch -1 3 NATURAL))
                (fi . ,(ly:make-pitch -1 4 FLAT))
                (so . ,(ly:make-pitch -1 4 NATURAL))
                (sol . ,(ly:make-pitch -1 4 NATURAL))
                (lu . ,(ly:make-pitch -1 5 FLAT))
                (la . ,(ly:make-pitch -1 5 NATURAL))
                (se . ,(ly:make-pitch -1 6 FLAT))
                (si . ,(ly:make-pitch -1 6 NATURAL))
                (ti . ,(ly:make-pitch -1 6 NATURAL))
                ))


Then take some .ly input you have written using these chromatic note names
and paste it into the snippet below in place of \relative {...}.


%% BEGIN SNIPPET
\version "2.16"

% use the sharp one for sharp keys, the flat one for flat keys
\language chromatic-sharp 
% \language chromatic-flat

music = \relative  { do4 di2 re8 me8 mi4.( fa8 fi) so lu la se ti do  }

\language "english"
\displayLilyMusic { \music }

%% END SNIPPET


As written this snippet will output the following to the console when you
use chromatic-sharp:
    { c' csharp'2 d'8 dsharp' e'4.( f'8 fsharp') g' gsharp' a' asharp' b'
c'' }

And this when you use chromatic-flat
    { c' dflat'2 d'8 eflat' e'4.( f'8 gflat') g' aflat' a' bflat' b' c'' }

It just changes the note names, and keeps the rest of the input intact
(articulations, slurs, etc.).  You would then just cut and paste this output
from the console into a copy of your original .ly file. (Or there's a way to
redirect the output to a file rather than the console.)

The output is in absolute mode, so you wouldn't need to worry about relative
mode making tritones go in the wrong direction.  (Maybe there is a way to
convert .ly input from absolute to relative mode, if you really wanted it in
relative mode?)  

You would have to manually correct some accidentals (flat accidentals in a
sharp key, or sharp accidentals in a flat key), but I don't think there's
any way to avoid that.

Converting to keys with more than 5 sharps or flats would require additional
language definitions, one per key, in order to get the "white-key
enharmonics" to come out right.  (E --> Fb, etc.)  

Maybe this is a good gambiarra?
-Paul




--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Feature-Request-Chromatic-note-names-tp145984p146500.html
Sent from the User mailing list archive at Nabble.com.



reply via email to

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