lilypond-user
[Top][All Lists]
Advanced

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

hiding curves and microtones


From: Stefan Thomas
Subject: hiding curves and microtones
Date: Tue, 12 Jan 2010 11:20:43 +0100

Dear community,
in the following snippet I have the problem, that the \hideCurvesFrom -command doesn't work well with a microtonal accidental.
Is there a solution possible for this problem?
Here is the snippet (sorry, it's very long because of the definitions of the additional commands).
%%%%%%%%% begin %%%%%%%%%%%%%%%%%%%
\version "2.12.2"
% Define tunings:
\paper{
#(define fonts (make-pango-font-tree "Century Schoolbook L"
                                      "HE"
                                      "Bitstream Vera Sans Mono"
                         1))
}
#(define-public SHARPSYMBOL 1/2)
#(define-public SHARPSYMBOL -1/2)
#(define-public Vierteltonkreuz 1/4)
#(define-public VierteltonBSYMBOL -1/4)
#(define-public SyntohochAufloesungszeichen 1/12)
#(define-public ZweiSyntohochAufloesungszeichen 1/6)
#(define-public ZweiSyntotiefKreuz 1/3)
#(define-public SyntotiefKreuz 5/12)
#(define-public SyntohochKreuz 7/12)
#(define-public ZweiSyntohochKreuz 2/3)
#(define-public SyntotiefAufloesungszeichen -1/12)
#(define-public ZweiSyntotiefAufloesungszeichen -1/6)
#(define-public ZweiSyntohochBe -1/3)
#(define-public SyntohochBe -5/12)
#(define-public SyntotiefBe -7/12)
#(define-public ZweiSyntotiefBe -2/3)



StefansPitchnames = #`(
        (ceses . ,(ly:make-pitch -1 0 DOUBLE-FLAT))
        (ces . ,(ly:make-pitch -1 0 FLAT))
        (c . ,(ly:make-pitch -1 0 NATURAL))
        (cis . ,(ly:make-pitch -1 0 SHARP))
        (cisis . ,(ly:make-pitch -1 0 DOUBLE-SHARP))
        (deses . ,(ly:make-pitch -1 1 DOUBLE-FLAT))
        (des . ,(ly:make-pitch -1 1 FLAT))
        (d . ,(ly:make-pitch -1 1 NATURAL))
        (dis . ,(ly:make-pitch -1 1 SHARP))
        (disis . ,(ly:make-pitch -1 1 DOUBLE-SHARP))
        (eeses . ,(ly:make-pitch -1 2 DOUBLE-FLAT))
        (ees . ,(ly:make-pitch -1 2 FLAT))
        (es . ,(ly:make-pitch -1 2 FLAT))
        (e . ,(ly:make-pitch -1 2 NATURAL))
        (eis . ,(ly:make-pitch -1 2 SHARP))
        (eisis . ,(ly:make-pitch -1 2 DOUBLE-SHARP))
        (feses . ,(ly:make-pitch -1 3 DOUBLE-FLAT))
        (fes . ,(ly:make-pitch -1 3 FLAT))
        (f . ,(ly:make-pitch -1 3 NATURAL))
        (fis . ,(ly:make-pitch -1 3 SHARP))
        (fisis . ,(ly:make-pitch -1 3 DOUBLE-SHARP))
        (geses . ,(ly:make-pitch -1 4 DOUBLE-FLAT))
        (ges . ,(ly:make-pitch -1 4 FLAT))
        (g . ,(ly:make-pitch -1 4 NATURAL))
        (gis . ,(ly:make-pitch -1 4 SHARP))
        (gisis . ,(ly:make-pitch -1 4 DOUBLE-SHARP))
        (aeses . ,(ly:make-pitch -1 5 DOUBLE-FLAT))
        (aes . ,(ly:make-pitch -1 5 FLAT))
        (as . ,(ly:make-pitch -1 5 FLAT))
        (a . ,(ly:make-pitch -1 5 NATURAL))
        (ais . ,(ly:make-pitch -1 5 SHARP))
        (aisis . ,(ly:make-pitch -1 5 DOUBLE-SHARP))
        (beses . ,(ly:make-pitch -1 6 DOUBLE-FLAT))
        (bes . ,(ly:make-pitch -1 6 FLAT))
        (b . ,(ly:make-pitch -1 6 NATURAL))
        (bis . ,(ly:make-pitch -1 6 SHARP))
        (bisis . ,(ly:make-pitch -1 6 DOUBLE-SHARP))

       
        (ceh . ,(ly:make-pitch -1 0 VierteltonBSYMBOL))
        (c . ,(ly:make-pitch -1 0 NATURAL))
        (cih . ,(ly:make-pitch -1 0 Vierteltonkreuz))
       
       
       
        (deh . ,(ly:make-pitch -1 1 VierteltonBSYMBOL))
        (d . ,(ly:make-pitch -1 1 NATURAL))
        (dih . ,(ly:make-pitch -1 1 Vierteltonkreuz))
       
       
        (eeh . ,(ly:make-pitch -1 2 VierteltonBSYMBOL))
        (e . ,(ly:make-pitch -1 2 NATURAL))
        (eih . ,(ly:make-pitch -1 2 Vierteltonkreuz))
       

       
        (feh . ,(ly:make-pitch -1 3 VierteltonBSYMBOL))
        (f . ,(ly:make-pitch -1 3 NATURAL))
        (fih . ,(ly:make-pitch -1 3 Vierteltonkreuz))

        (geh . ,(ly:make-pitch -1 4 VierteltonBSYMBOL))
        (g . ,(ly:make-pitch -1 4 NATURAL))
        (gih . ,(ly:make-pitch -1 4 Vierteltonkreuz))

        (aeh . ,(ly:make-pitch -1 5 VierteltonBSYMBOL))
        (a . ,(ly:make-pitch -1 5 NATURAL))
        (aih . ,(ly:make-pitch -1 5 Vierteltonkreuz))


        (beh . ,(ly:make-pitch -1 6 VierteltonBSYMBOL))
        (b . ,(ly:make-pitch -1 6 NATURAL))
        (bih . ,(ly:make-pitch -1 6 Vierteltonkreuz))
       
         (ch . ,(ly:make-pitch -1 0 SyntohochAufloesungszeichen))
         (chh . ,(ly:make-pitch -1 0 ZweiSyntohochAufloesungszeichen))
         (cisll . ,(ly:make-pitch -1 0 ZweiSyntotiefKreuz))
         (cisl . ,(ly:make-pitch -1 0 SyntotiefKreuz))
         (cish . ,(ly:make-pitch -1 0 SyntohochKreuz))
         (cishh . ,(ly:make-pitch -1 0 ZweiSyntohochKreuz))

         (dh . ,(ly:make-pitch -1 1 SyntohochAufloesungszeichen))
         (dhh . ,(ly:make-pitch -1 1 ZweiSyntohochAufloesungszeichen))
         (disll . ,(ly:make-pitch -1 1 ZweiSyntotiefKreuz))
         (disl . ,(ly:make-pitch -1 1 SyntotiefKreuz))
         (dish . ,(ly:make-pitch -1 1 SyntohochKreuz))
         (dishh . ,(ly:make-pitch -1 1 ZweiSyntohochKreuz))
        
         (eh . ,(ly:make-pitch -1 2 SyntohochAufloesungszeichen))
         (ehh . ,(ly:make-pitch -1 2 ZweiSyntohochAufloesungszeichen))
         (eisll . ,(ly:make-pitch -1 2 ZweiSyntotiefKreuz))
         (eisl . ,(ly:make-pitch -1 2 SyntotiefKreuz))
         (eish . ,(ly:make-pitch -1 2 SyntohochKreuz))
         (eishh . ,(ly:make-pitch -1 2 ZweiSyntohochKreuz))

         (fh . ,(ly:make-pitch -1 3 SyntohochAufloesungszeichen))
         (fhh . ,(ly:make-pitch -1 3 ZweiSyntohochAufloesungszeichen))
         (fisll . ,(ly:make-pitch -1 3 ZweiSyntotiefKreuz))
         (fisl . ,(ly:make-pitch -1 3 SyntotiefKreuz))
         (fish . ,(ly:make-pitch -1 3 SyntohochKreuz))
         (fishh . ,(ly:make-pitch -1 3 ZweiSyntohochKreuz))
        
         (gh . ,(ly:make-pitch -1 4 SyntohochAufloesungszeichen))
         (ghh . ,(ly:make-pitch -1 4 ZweiSyntohochAufloesungszeichen))
         (gisll . ,(ly:make-pitch -1 4 ZweiSyntotiefKreuz))
         (gisl . ,(ly:make-pitch -1 4 SyntotiefKreuz))
         (gish . ,(ly:make-pitch -1 4 SyntohochKreuz))
         (gishh . ,(ly:make-pitch -1 4 ZweiSyntohochKreuz))
        
         (ah . ,(ly:make-pitch -1 5 SyntohochAufloesungszeichen))
         (ahh . ,(ly:make-pitch -1 5 ZweiSyntohochAufloesungszeichen))
         (aisll . ,(ly:make-pitch -1 5 ZweiSyntotiefKreuz))
         (aisl . ,(ly:make-pitch -1 5 SyntotiefKreuz))
         (aish . ,(ly:make-pitch -1 5 SyntohochKreuz))
         (aishh . ,(ly:make-pitch -1 5 ZweiSyntohochKreuz))
        
         (bh . ,(ly:make-pitch -1 6 SyntohochAufloesungszeichen))
         (bhh . ,(ly:make-pitch -1 6 ZweiSyntohochAufloesungszeichen))
         (bisll . ,(ly:make-pitch -1 6 ZweiSyntotiefKreuz))
         (bisl . ,(ly:make-pitch -1 6 SyntotiefKreuz))
         (bish . ,(ly:make-pitch -1 6 SyntohochKreuz))
         (bishh . ,(ly:make-pitch -1 6 ZweiSyntohochKreuz))
        
         (cl . ,(ly:make-pitch -1 0 SyntotiefAufloesungszeichen))
         (cll . ,(ly:make-pitch -1 0 ZweiSyntotiefAufloesungszeichen))
         (ceshh . ,(ly:make-pitch -1 0 ZweiSyntohochBe))
         (cesh . ,(ly:make-pitch -1 0 SyntohochBe))
         (cesl . ,(ly:make-pitch -1 0 SyntotiefBe))
         (cesll . ,(ly:make-pitch -1 0 ZweiSyntotiefBe))
        
         (dl . ,(ly:make-pitch -1 1 SyntotiefAufloesungszeichen))
         (dll . ,(ly:make-pitch -1 1 ZweiSyntotiefAufloesungszeichen))
         (deshh . ,(ly:make-pitch -1 1 ZweiSyntohochBe))
         (desh . ,(ly:make-pitch -1 1 SyntohochBe))
         (desl . ,(ly:make-pitch -1 1 SyntotiefBe))
         (desll . ,(ly:make-pitch -1 1 ZweiSyntotiefBe))
        
         (el . ,(ly:make-pitch -1 2 SyntotiefAufloesungszeichen))
         (ell . ,(ly:make-pitch -1 2 ZweiSyntotiefAufloesungszeichen))
         (eeshh . ,(ly:make-pitch -1 2 ZweiSyntohochBe))
         (eesh . ,(ly:make-pitch -1 2 SyntohochBe))
         (eesl . ,(ly:make-pitch -1 2 SyntotiefBe))
         (eesll . ,(ly:make-pitch -1 2 ZweiSyntotiefBe))
         (eshh . ,(ly:make-pitch -1 2 ZweiSyntohochBe))
         (esh . ,(ly:make-pitch -1 2 SyntohochBe))
         (esl . ,(ly:make-pitch -1 2 SyntotiefBe))
         (esll . ,(ly:make-pitch -1 2 ZweiSyntotiefBe))
        
         (fl . ,(ly:make-pitch -1 3 SyntotiefAufloesungszeichen))
         (fll . ,(ly:make-pitch -1 3 ZweiSyntotiefAufloesungszeichen))
         (feshh . ,(ly:make-pitch -1 3 ZweiSyntohochBe))
         (fesh . ,(ly:make-pitch -1 3 SyntohochBe))
         (fesl . ,(ly:make-pitch -1 3 SyntotiefBe))
         (fesll . ,(ly:make-pitch -1 3 ZweiSyntotiefBe))
        
         (gl . ,(ly:make-pitch -1 4 SyntotiefAufloesungszeichen))
         (gll . ,(ly:make-pitch -1 4 ZweiSyntotiefAufloesungszeichen))
         (geshh . ,(ly:make-pitch -1 4 ZweiSyntohochBe))
         (gesh . ,(ly:make-pitch -1 4 SyntohochBe))
         (gesl . ,(ly:make-pitch -1 4 SyntotiefBe))
         (gesll . ,(ly:make-pitch -1 4 ZweiSyntotiefBe))
        
         (al . ,(ly:make-pitch -1 5 SyntotiefAufloesungszeichen))
         (all . ,(ly:make-pitch -1 5 ZweiSyntotiefAufloesungszeichen))
         (aeshh . ,(ly:make-pitch -1 5 ZweiSyntohochBe))
         (aesh . ,(ly:make-pitch -1 5 SyntohochBe))
         (aesl . ,(ly:make-pitch -1 5 SyntotiefBe))
         (aesll . ,(ly:make-pitch -1 5 ZweiSyntotiefBe))
         (ashh . ,(ly:make-pitch -1 5 ZweiSyntohochBe))
         (ash . ,(ly:make-pitch -1 5 SyntohochBe))
         (asl . ,(ly:make-pitch -1 5 SyntotiefBe))
         (asll . ,(ly:make-pitch -1 5 ZweiSyntotiefBe))
        
         (bl . ,(ly:make-pitch -1 6 SyntotiefAufloesungszeichen))
         (bll . ,(ly:make-pitch -1 6 ZweiSyntotiefAufloesungszeichen))
         (beshh . ,(ly:make-pitch -1 6 ZweiSyntohochBe))
         (besh . ,(ly:make-pitch -1 6 SyntohochBe))
         (besl . ,(ly:make-pitch -1 6 SyntotiefBe))
         (besll . ,(ly:make-pitch -1 6 ZweiSyntotiefBe))
        
        
        
)



FONTNAME = "HE"


NATURALSYMBOL = "Ñ"
VierteltonBSYMBOL = "ç"
Vierteltonkreuz = "è"
FLATSYMBOL = "e"
SHARPSYMBOL = "Ø"
DFLATSYMBOL = "Ã"
DSHARPSYMBOL = "ß"
SyntohochAufloesungszeichen = "o"
ZweiSyntohochAufloesungszeichen = "p"
ZweiSyntotiefKreuz ="t"   
SyntotiefKreuz ="u"
SyntohochKreuz ="Ù"
ZweiSyntohochKreuz ="Ú"
SyntotiefAufloesungszeichen = "m"
ZweiSyntotiefAufloesungszeichen = "l"
ZweiSyntotiefBe = "È"
SyntotiefBe = "É"
ZweiSyntohochBe = "Ì"
SyntohochBe ="Ë"



StefansStrings = #`(
       (-1/4 . ,VierteltonBSYMBOL)
       (1/4 .   ,Vierteltonkreuz)
       (0 .     ,NATURALSYMBOL)
       (1/2 .   ,SHARPSYMBOL)
       (-1/2 .  ,FLATSYMBOL)
       (-1 .    ,DFLATSYMBOL)
       ( 1 .    ,DSHARPSYMBOL)
        (1/12 . ,SyntohochAufloesungszeichen)
         (1/6 . ,ZweiSyntohochAufloesungszeichen)
         (1/3 . ,ZweiSyntotiefKreuz)
         (5/12 . ,SyntotiefKreuz)
         (7/12 . ,SyntohochKreuz)
           (2/3 . ,ZweiSyntohochKreuz)
        (-1/12 . ,SyntotiefAufloesungszeichen)
         (-1/6 . ,ZweiSyntotiefAufloesungszeichen)
         (-1/3 . ,ZweiSyntohochBe)
         (-5/12 . ,SyntohochBe)
         (-7/12 . ,SyntotiefBe)
           (-2/3 . ,ZweiSyntotiefBe)
      
       
)

%


      
       


\layout {
  \context {
    \Score
    \override KeySignature #'stencil = #ly:text-interface::print
    \override KeySignature #'font-name = #FONTNAME
       \override Accidental #'stencil = #(lambda (grob) (box-stencil (ly:text-interface::print grob) 0 0))
    \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 #'X-extent = #(lambda (grob)
  (let ((iv (ly:stencil-extent (ly:text-interface::print grob) X)))
       (cons (- (interval-start iv)0.1 ) (- (interval-end iv) 0.7))))
    %den Wert 0.1 kann man vielleicht erhöhen, dann kriegen die Töne mehr Raum!
      \override Accidental #'font-size = #-1
     \override Accidental #'Y-extent = #(lambda (grob)
   (ly:stencil-extent (ly:text-interface::print grob) Y)  )
  }
  \context { \Voice    \override Accidental #'stencil =
   #(lambda (grob)
      (let ((tie (ly:grob-object grob 'tie)))
        (if (ly:grob? tie)
            (begin (ly:grob-suicide! grob) '())
            (ly:text-interface::print grob)))) }
}

pitchnames = \StefansPitchnames

#(ly:parser-set-note-names parser pitchnames)


%TaktPlatz = {\once \override Score.BarLine #'space-alist = #'((first-note extra-space . 1.5)) }
machplatz = #(define-music-function (parser location x) (number?)
  #{
\once \override Score.NoteColumn #'X-offset = #$x 
#})

 l = #(define-music-function (parser location x) (ly:music?)
             #{ %hier irgendeinen Lilypondcode eingeben, z.B.:
                    \transpose c cl $x
             #})
 
 ll = #(define-music-function (parser location x) (ly:music?)
             #{ %hier irgendeinen Lilypondcode eingeben, z.B.:
                    \transpose c cll $x
             #})
 
 h = #(define-music-function (parser location x) (ly:music?)
             #{ %hier irgendeinen Lilypondcode eingeben, z.B.:
                    \transpose c ch $x
             #})
 
 hh = #(define-music-function (parser location x) (ly:music?)
             #{ %hier irgendeinen Lilypondcode eingeben, z.B.:
                    \transpose c chh $x
             #})
 qh = #(define-music-function (parser location x) (ly:music?)
             #{ %hier irgendeinen Lilypondcode eingeben, z.B.:
                    \transpose c cih $x
             #})
 
  ql = #(define-music-function (parser location x) (ly:music?)
             #{ %hier irgendeinen Lilypondcode eingeben, z.B.:
                    \transpose c ceh $x
             #})
 
 
 #(define (parse-grob-sym grob-sym)
   (let* ((grob-str  (symbol->string grob-sym))
          (dot-index (string-index grob-str #\.))
          (context   (if dot-index
                         (string-take grob-str dot-index)
                         "Voice"))
          (grob      (if dot-index
                         (substring grob-str (+ dot-index 1))
                         grob-str)))
     (cons context grob)))

hideCurvesFrom =
#(define-music-function
   (parser location grob-sym x-padding y-padding)
   (symbol? pair? pair?)
   (let* ((context  (car (parse-grob-sym grob-sym)))
          (top-grob (cdr (parse-grob-sym grob-sym))))
#{
  \override Tie #'layer = #-2
  \override Slur #'layer = #-2
  \override PhrasingSlur #'layer = #-2

  \override $context . $top-grob #'avoid-slur = #'ignore
  \override $context . $top-grob #'layer = #-1
  \override $context . $top-grob #'stencil =
    #(lambda (grob)
       (define (get-stil-proc alist)
         ;; removes the first 'stencil entry from the grob-property
         ;; alist, implicitly created by this callback:
         ;;   (stencil . #<procedure #f (grob)>)
         ;; and then retrieves the original 'stencil procedure.
         (let ((stil-proc (ly:assoc-get 'stencil alist)))
           (if (procedure-name stil-proc)
               stil-proc
               (begin (set! alist (assoc-remove! alist 'stencil))
                      (get-stil-proc alist)))))
       (let* ((basic-props (ly:grob-basic-properties grob))
              (stil-proc (get-stil-proc basic-props))
              (this-stil (stil-proc grob))
              (stil-x-ext (ly:stencil-extent this-stil 0))
              (stil-y-ext (ly:stencil-extent this-stil 1))
              (box-x-ext (cons (- (car stil-x-ext) (car $x-padding))
                               (+ (cdr stil-x-ext) (cdr $x-padding))))
              (box-y-ext (cons (- (car stil-y-ext) (car $y-padding))
                               (+ (cdr stil-y-ext) (cdr $y-padding))))
              (box-w (- (cdr box-x-ext) (car box-x-ext)))
              (box-h (- (cdr box-y-ext) (car box-y-ext))))
      (ly:stencil-add
       (ly:make-stencil
        (list 'embedded-ps
         (ly:format
          (string-append "gsave\n"
                         "currentpoint translate\n"
                         "1 setgray\n"
                         "~4f ~4f ~4f ~4f rectfill\n"
                         "grestore\n")
          (car box-x-ext)
          (car box-y-ext)
          box-w
          box-h))
        stil-x-ext
        stil-y-ext)
       this-stil)))
#}))

revertHideCurvesFrom =
#(define-music-function
   (parser location grob-sym)
   (symbol?)
   (let* ((context  (car (parse-grob-sym grob-sym)))
          (top-grob (cdr (parse-grob-sym grob-sym))))
#{
  \revert Tie #'layer
  \revert Slur #'layer
  \revert PhrasingSlur #'layer
  \revert $context . $top-grob #'avoid-slur
  \revert $context . $top-grob #'layer
  \revert $context . $top-grob #'stencil
#}))

 
 
 
 
 
music = {
  \hideCurvesFrom #'Staff.Accidental  #'(0.3 . 0.003) #'(0 . 0)
  r4  \set tupletSpannerDuration = #(ly:make-moment 1 4)
\times 2/3 { r8  \h   es (  \l   fis \h   as \h    bes  c' ~ c' \h    es' ) deh'  } }

\new Staff { \transpose c, c  \music }
%%%%%%%%%end %%%%%%%%%%













reply via email to

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