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: Wed, 15 May 2013 21:50:28 -0700 (PDT)

Hi Érico,  


Érico Schmitt wrote
> Problem comes when using the \relative mode. Lilypond's octaves in this
> mode 
> is based in the diatonic scale, so it will place the next note in the 
> closest position possible (a fourth up or down).
> 
> If my "fi" note is set as an f#, and i input { do fi } (6 semitones), it 
> will be interpreted as an augmented fourth, so it will placed upwards.
> Now, if "di" note is set as c# and i input { di so } (also 6 semitones),
> it 
> will be interpreted as diminished fifth. Actually it will be engraved as
> an 
> augmented fourth downwards.
> 
> This augmented forth/diminished fifth enharmony simply does not exist in 
> chromatic notation. It is all "6 semitones". So it makes a problem for the 
> engraver, because some of the "6 semitones" will randomly go up, some
> others 
> down.
> 
> I cant fix it because lilypond pitch classes seem to be based on numbers 
> 0123456, where 0 is any kind of C, up to 6 which is any kind of B.
> 
> Can someone help me?


Hmmm, this would be tricky.  You could try writing a scheme function that
would:

(1) override each note, 

(2) calculate the interval it forms with the previous note/pitch, (you would
have to access or temporarily store the previous note/pitch in a variable),

(3) then if the interval is an augmented 4th, change the enharmonic
equivalent (i.e. C# vs Db) of the note so that it would be a diminished 5th
(or vice-versa, as you prefer), otherwise leave the note unchanged.

This would make sure that 6 semitone intervals would always be diminished
5ths (or augmented 4ths), and have consistent behavior when using \relative
mode.

First you'd want to confirm that \relative mode makes its decision about a
note's octave *after* such an override of a note though.



> i would like to place a BIG number in the place of the clef, 
> representing the octave in scientific pitch notation, where middle C
> (middle 
> octave) is 4, as seen in the MUTO Project site.


This is much easier.  You just need some scheme code that replaces the
standard clef engraver with a custom clef that would display numbers
depending on the octave / clef it was replacing.  

I am using code that does custom clefs for TwinNote notation.  The custom
clefs are not big numbers, but the substitution principle would be the same:
http://twinnote.org/software/
http://twinnote.org/learn/clefs/

Look in the twinnote-scripts.ly file linked on that page for
"TwinNote_clef_engraver".  Or, here, I'll just paste the code here:

clef-minus-one = #(markup #:bold #:magnify 0.63 "-1")
clef-minus-two = #(markup #:bold #:magnify 0.63 "-2")

#(define TwinNote_clef_engraver
  (make-engraver
    (acknowledgers
      ((clef-interface engraver grob source-engraver)
        (let* (
          (glyph-name (ly:grob-property grob 'glyph-name))
          (mult (magstep (ly:grob-property grob 'font-size 0.0))))
          
          ;; for dev work
          ;; (newline)(display glyph-name)
          
          (set! (ly:grob-property grob 'stencil)
            (cond
              ((equal? glyph-name "clefs.G") 
                (ly:font-get-glyph (ly:grob-default-font grob)
"clefs.G_change"))
                
              ((or (equal? glyph-name "clefs.F_change") (equal? glyph-name
"clefs.F"))
                (ly:stencil-combine-at-edge 
                  (ly:stencil-translate (ly:font-get-glyph
(ly:grob-default-font grob) "clefs.G_change") (cons 0 -2))
                  1 -1 
                  (ly:stencil-translate (grob-interpret-markup grob
clef-minus-two) (cons 0.2 0))
                  0.08 ))
                  
              ((or (equal? glyph-name "clefs.C_change") (equal? glyph-name
"clefs.C")) 
                (ly:stencil-combine-at-edge 
                  (ly:stencil-translate (ly:font-get-glyph
(ly:grob-default-font grob) "clefs.G_change") (cons 0 -1))
                  1 -1 
                  (ly:stencil-translate (grob-interpret-markup grob
clef-minus-one) (cons 0.2 0))
                  0.08 ))
              
              (else (ly:grob-property grob 'stencil))))
          )))))


Then you would use 

  \consists \TwinNote_clef_engraver

in the \with block of your Staff.



> Another one is, how do I add dotted ledger lines?
> 
> I mean, when you add ledger lines into a new octave, the third line would
> be 
> the same as the middle one, therefore it is dotted.
> Also it would be nice that, when the dotted ledger line is required for a
> fi 
> note, it extends through the whole bar, as it aids visualisation. In case 
> you go way up to the next do, then you have both the dotted and a
> continuous 
> line way up there, like a "two octave" staff.


This can be done manually by starting and stopping a different custom staff
override for the measures that need the additional lines.  I use this
technique to extend the staff for a few measures in Maple Leaf Rag in
TwinNote (see measure 9):
http://twinnote.org/sheet-music/#joplin-maple

I think it would be difficult to write some scheme code to do this
automatically when needed.  I wouldn't say it's "impossible," since LilyPond
is so flexible, there might be a way.

Ok, that should get you started at least.  :-)

-Paul





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



reply via email to

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