lilypond-user
[Top][All Lists]
Advanced

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

Re: trying to define microtonal note names and accidentals


From: Stefan Thomas
Subject: Re: trying to define microtonal note names and accidentals
Date: Wed, 21 Oct 2020 13:48:35 +0200

Dear Jean,
thanks for Your reply. Your code seems to work for me.
I have to do define some more pitch and and accidental names, off course.
The overrides of the x- and y-extent seem to be necessary to have more space for the accidentals.


Am Mi., 21. Okt. 2020 um 13:28 Uhr schrieb Jean Abou Samra <jean@abou-samra.fr>:

Hello,

Le 21/10/2020 à 12:43, Stefan Thomas a écrit :
Dear community,

I'm trying to define microtonal note names and accidentals with the HE-font.

Unfortunately, I get the following error message when I compile the below quoted file:
error: wrong type for argument 2.  Expecting
music, found "c"
Music = \relative  
                 c' {ch2 cl }
/home/stefan/partituren/vorlagen/snippet_stefansMikrotoene.ly:65:20: error: syntax error, unexpected '''
Music = \relative c
                  ' {ch2 cl }
/home/stefan/partituren/vorlagen/snippet_stefansMikrotoene.ly:65:23: error: not a note name: ch
Music = \relative c' {
                     ch2 cl }
/home/stefan/partituren/vorlagen/snippet_stefansMikrotoene.ly:65:27: error: not a note name: cl
Music = \relative c' {ch2  
                         cl }
Does someone know how I can get it  working?
Here is my file:

%%%%%%%%%%%%% SNIPPET
\version "2.20.0"
% Define tunings:
\paper{
#(define fonts (make-pango-font-tree "Century Schoolbook L"
                                      "HE"
                                      "Bitstream Vera Sans Mono"
                         1))
}

#(define-public SyntoHigherNatural 1/12)
#(define-public SyntoLowerNatural -1/12)

StefansPitchnames = #'(

You should have a quasiquote here.

     (ch . ,(ly:make-pitch -1 0 SyntoHigherNatural))
      (cl . ,(ly:make-pitch -1 0 SyntoLowerNatural))
)

pitchnames = \StefansPitchnames
#(ly:parser-set-note-names pitchnames)

Here is the main problem. You are redefining the whole note names alist,
so LilyPond doesn't know about the c pitch anymore, which causes the error
at \relative.

Thus, this should read:


StefansPitchnames = #`(
     (ch . ,(ly:make-pitch -1 0 SyntoHigherNatural))
      (cl . ,(ly:make-pitch -1 0 SyntoLowerNatural))
)

pitchnames = #(append StefansPitchnames (assoc-get 'nederlands language-pitch-names))
#(ly:parser-set-note-names pitchnames)


I can't comment on the font problem. At least this gives a start (the file
compiles and shows special accidentals). By the way, just out of curiosity,
why do you have overrides to X-extent, Y-extent and the skylines?

Best,
Jean

Full code:

%%%%%%%%%%%%%
\version "2.20.0"
% Define tunings:
\paper {
#(define fonts (make-pango-font-tree "Century Schoolbook L"
                                     "HE"
                                      "Bitstream Vera Sans Mono"
                         1))
}

#(define SyntoHigherNatural 1/12)
#(define SyntoLowerNatural -1/12)

StefansPitchnames = #`(
     (ch . ,(ly:make-pitch -1 0 SyntoHigherNatural))
      (cl . ,(ly:make-pitch -1 0 SyntoLowerNatural))
)

pitchnames = #(append StefansPitchnames (assoc-get 'nederlands language-pitch-names))
#(ly:parser-set-note-names pitchnames)

FONTNAME = "HE"
SyntoHigherNatural = "o"
SyntoLowerNatural = "m"

StefansStrings = #`(
        (1/12 . ,SyntoHigherNatural)
        (-1/12 . ,SyntoLowerNatural)
)


#(define (my-Y-extent grob)
  (ly:stencil-extent (ly:text-interface::print grob) Y))

\layout {
  \context {
    \Score

    \override Accidental.stencil = #ly:text-interface::print
    \override Accidental.font-name = #FONTNAME
    \override Accidental.text = #(lambda (grob)
                                   (cdr (assoc (ly:grob-property grob 'alteration)
                                          StefansStrings)))
    \override Accidental.font-size = #-1
    \override Accidental.X-extent = #(lambda (grob)
                                       (ly:stencil-extent
                                         (ly:text-interface::print grob) X))
    \override Accidental.Y-extent = #(ly:make-unpure-pure-container
                                       my-Y-extent
                                       (lambda (grob start end) (my-Y-extent grob)))

    \override Accidental.horizontal-skylines = #'()
    \override Accidental.vertical-skylines = #'()
  }
}

Music = \relative c' { ch2 cl }
\new Staff \Music


reply via email to

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