Le 26/07/2021 à 00:15, devin@ulibarri.website a écrit :
Hi All,

I need help from users who have some experience with microtonality (or overrides in general) in Lilypond to create a recipe for lilypond notation for the Kite Guitar (kiteguitar.com). The Kite Guitar uses 41 equal divisions of the octave in a clever way, which balances practicality with playability to get a very close approximation to 7-limit Just Intonation.

I have made some attempts, but I don't really know Lilypond so well that I can create a handy recipe such as this. I did some research and found http://x31eq.com/lilypond/ which is helpful, but I am unable to make the necessary tweaks with my limited knowledge. (I am happy to send over what I tried to do, but as my attempts have only failed I do not want to confuse anyone.)

The overarching specs are:
1. 41 Equal Divisions of the Octave

Tablature-specific:
2. Frets are spaced two EDO-steps apart (i.e. 2 of the 41)
3. Strings are tuned 13 EDO-steps apart (i.e. 13 of the 41)
^^Lilypond will either need to find the pitch, or allow the user to override the current calculation as what I am getting is for a standard guitar.

Notation-specific:
4. There are Sharps and Flats, but there are also upwards "^", double-upwards "^^", downwards "v", and "double-downwards "vv". (see https://en.xen.wiki/w/Ups_and_Downs_Notation )


Hello,

In LilyPond 2.23.4, better user interfaces were introduced
for microtonal glyphs, see
http://lilypond.org/doc/v2.23/Documentation/changes/

However, they rely on accidental glyphs present in the music
fonts LilyPond uses. Unless you are willing to dive into creating
a custom font, that's not very convenient.

So here is a demo showing how to redefine a few routines so that
you can use any kind of symbol for the accidentals. Please note that
I didn't bother with key cancellations, cautionary accidentals and a
few things; they could be added if needed.

A custom input language for pitches is defined. As I didn't understand
much to the web page you quote (I have zero knowledge about microtonality),
I just used the untypical alterations 1/3 and -2/3 for the sake of
the example.

\version "2.23.4"

AND = "∧"
OR = "∨"

#(define-markup-command (custom-accidental layout props alteration)
   (exact-rational?)
   #:properties ((alteration-glyph-name-alist))
   (let* ((defs (ly:output-def-lookup layout 'font-defaults))
          (alist (or alteration-glyph-name-alist
                     (assq-ref defs 'alteration-glyph-name-alist)))
          (mkup (or (assv-ref alist alteration)
                    (begin
                      (ly:warning "no accidental definition for alteration ~a"
                                  alteration)
                      "??"))))
     (interpret-markup layout props mkup)))

#(define (custom-accidental-stencil grob)
   (grob-interpret-markup grob
     (make-custom-accidental-markup (ly:grob-property grob 'alteration))))

#(define (custom-key-signature-stencil grob)
   (let* ((inter (* 1/2 (ly:staff-symbol-staff-space grob)))
          (c0s (ly:grob-property grob 'c0-position))
          (padding-pairs (ly:grob-property grob 'padding-pairs))
          (basic-padding (ly:grob-property grob 'padding 0))
          (alteration-alist (ly:grob-property grob 'alteration-alist)))
     (let loop ((alist-rest alteration-alist)
                (last-alteration #f)
                (stencil empty-stencil))
       (if (null? alist-rest)
           (ly:stencil-aligned-to stencil X LEFT)
           (let* ((entry (car alist-rest))
                  (alt (cdr entry))
                  (accidental-mkup (make-custom-accidental-markup alt))
                  (accidental-stil (grob-interpret-markup grob accidental-mkup))                   (pos-list (key-signature-interface::alteration-positions entry c0s grob))
                  (column
                    (apply ly:stencil-add
                           (map
                             (lambda (p)
                               (ly:stencil-translate-axis accidental-stil
                                                          (* p inter)
                                                          Y))
                             pos-list)))
                  (padding (or (assoc-ref padding-pairs (cons alt last-alteration))
                               basic-padding)))
             (loop (cdr alist-rest)
                   alt
                   (ly:stencil-combine-at-edge stencil X LEFT column padding)))))))


\layout {
  \context {
    \Voice
    \override Accidental.stencil = #custom-accidental-stencil
    \override Accidental.horizontal-skylines = #ly:grob::horizontal-skylines-from-stencil
  }
  \context {
    \Staff
    \override KeySignature.stencil = #custom-key-signature-stencil
    printKeyCancellation = ##f % disable key cancellations
  }
}

%% Custom pitch names for note entry
#(set!
   language-pitch-names
   (cons
     `(kite . (
               ;; Standard "nederlands" language.
               ,@(assq-ref language-pitch-names 'nederlands)
               ;; The arguments to ly:make-pitch are octave, step (0 = C, 6 = B),
               ;; and alteration.
               (onethird . ,(ly:make-pitch -1 5 1/3))
               (minustwothirds . ,(ly:make-pitch -1 0 -2/3))
               ;; Add further entries.
               ))
     language-pitch-names))

\language kite


\layout {
  \context {
    \Staff
    %% Define alteration signs.
    alterationGlyphs =
      #`(
          ;; Standard alterations.
          (0 . ,#{ \markup \musicglyph "accidentals.natural" #})
          (-1/2 . ,#{ \markup \musicglyph "accidentals.flat" #})
          (1/2 . ,#{ \markup \musicglyph "accidentals.sharp" #})
          (1 . ,#{ \markup \musicglyph "accidentals.doublesharp" #})
          (-1 . ,#{ \markup \musicglyph "accidentals.flatflat" #})
          (3/4 . ,#{ \markup \musicglyph "accidentals.sharp.slashslash.stemstemstem" #})           (1/4 . ,#{ \markup \musicglyph "accidentals.sharp.slashslash.stem" #})
          (-1/4 . ,#{ \markup \musicglyph "accidentals.mirroredflat" #})
          (-3/4 . ,#{ \markup \musicglyph "accidentals.mirroredflat.flat" #})
          ;; Add custom alterations here.  The list of predefined glyphs is
          ;; found at
          ;; https://lilypond.org/doc/v2.23/Documentation/notation/the-emmentaler-font#accidental-glyphs
          ;; Markup syntax is explained at
          ;; lilypond.org/doc/v2.23/Documentation/notation/formatting-text.fr.html
          (1/3 . ,#{ \markup \lower #0.7 \OR #})
          (-2/3 . ,#{ \markup \lower #0.6 { \AND \hspace #-1.5 \AND } #})
      )
    %% The meaning of padding-pairs is redefined.  The keys are no longer
    %% pairs of glyph names but pairs of alterations.  Otherwise it is
    %% as documented at
    %% http://lilypond.org/doc/v2.23/Documentation/notation/displaying-pitches#alternate-accidental-glyphs
    \override KeySignature.padding-pairs =
      #'(
         ((-1/2 . -1/2) . 0) ;; no padding from flat to flat in key signatures
         ((1/2 . 1/2) . 0.1) ;; slight padding from sharp to sharp
         ((1/2 . 1) . 1) ;; big padding from sharp to double sharp
         ;; Other entries can be added in the same way.
         ((-2/3 . -2/3) . -1.5)
        )
    %% Define the order of alterations in key signatures. Documented at
    %% http://lilypond.org/doc/v2.23/Documentation/internals/tunable-context-properties
    keyAlterationOrder =
      #`(
          (6 . -1/2) (2  . -1/2) (5 . -1/2 ) (1  . -1/2) (4  . -1/2) (0  . -1/2) (3  . -1/2)           (3 . 1/2) (0 . 1/2) (4 . 1/2) (1 . 1/2) (5 . 1/2) (2 . 1/2) (6 . 1/2)
          (6 . -1) (2 . -1) (5 . -1 ) (1 . -1) (4 . -1) (0 . -1) (3 . -1)
          (3  . 1) (0 . 1) (4 . 1) (1 . 1) (5 . 1) (2 . 1) (6 . 1)
          ;; Values added to the default:
          (3 . -2/3) (0 . -2/3) (4 . -2/3) (1 . -2/3) (5 . -2/3) (2 . -2/3) (6 . -2/3)
        )
  }
}

{
  \key gis \major
  ces onethird
  \key ces \major
  cisis minustwothirds
  \key minustwothirds \major
  minustwothirds''
}



5. There needs to be some way to set upwards/downwards in the key signature. ^^ it would be super-nice if this could be done globally, so that a composer can focus on the music-making

Chord-charts:
6. Support for chord charts such as https://en.xen.wiki/w/Kite_Guitar_Translations_by_Aaron_Wolf#Auld_Lang_Syne

Any help is appreciated. The growing community of Kite Guitar players would really appreciate this (many of whom are fellow software libre supporters/advocates). Also, I can send over some sample scores created with MuseScore once I receive permission to share them.

Yes, it would help to see some scores, particularly for
people like me who are knowledgeable neither about microtonality
nor guitar tablature.

Best regards,
Jean

Thanks in Advance!
Devin



Reply via email to