2016-06-06 21:16 GMT+02:00 matpen3@gmail <[email protected]>:
> Hi,
>
> I was finding a solution for slashed beams (normal notes) and I I did run
> across this thread:
>
> http://thread.gmane.org/gmane.comp.gnu.lilypond.general/68436/focus=68438
>
> I tried to download the code that Thomas wrote but I’m trapped in an endless
> loop between .bin and .cpgz (I’m on OS X; also the Unarchiver doesn't
> succeed).
>
> Could someone provide it as a text?
>
> Thanks!
>
> Cheers
>
>
> matteo


Hi Matteo,

this is pretty old code. (And you've got it already.)

Have you tried:
http://lsr.di.unimi.it/LSR/Item?id=721
?

Attached you'll find my latest attempt to the topic, overriding beam not stem.
It tries to eliminate the need to manually find the correct values.
Though, please note, it's unfinished work in progress.
Currently I can't recommend to use it for serious work, but maybe you
and/or others may want to test.
Feedback appreciated.

Cheers,
  Harm
\version "2.19.36"
   
%% c/p from lily-library.scm because it's not public
#(define (sign x)
  (if (= x 0)
      0
      (if (< x 0) -1 1)))
      
foo =
\override Beam.stencil =
  #(lambda (grob)
    (let* ((stil (ly:beam::print grob))
           (beam-y-pos (ly:grob-property grob 'positions))
           (beam-x-pos (ly:grob-property grob 'X-positions))
           (stems (ly:grob-object grob 'stems))
           (first-stem (ly:grob-array-ref stems 0))
           (first-stem-length (ly:grob-property  first-stem 'length))
           (delta-beam-y-pos (- (cdr beam-y-pos) (car beam-y-pos)))
           (delta-beam-x-pos (- (cdr beam-x-pos) (car beam-x-pos)))
           (beam-height
             (lambda (n) (* (/ delta-beam-y-pos delta-beam-x-pos) n)))
           (beam-dir (ly:grob-property grob 'direction))
           (slant (sign (- (cdr beam-y-pos) (car beam-y-pos))))
           (thick 0.1)
           (duration (ly:grob-property (ly:grob-parent grob X) 'duration-log))
           (beam-count (- duration 2))
           (beam-thickness (ly:grob-property grob 'beam-thickness))
           (space-between-beams (* 0.46 (ly:grob-property grob 'gap 0.8))) 
           (orig-beam-length-at-stem 
             (+ (* beam-count beam-thickness)
           	(* (- beam-count 1) space-between-beams)))
           (padding-corr
             (min
               (max (+ 1 orig-beam-length-at-stem) 1.5)
               (* 0.5 (- first-stem-length orig-beam-length-at-stem))))
           (x-start -0.4)
           (y-start 0)
           (x-end 1.5)
           (y-end 
             (* beam-dir 
                (+ 
                   padding-corr
                   0.5  
                   (* beam-dir (beam-height 1.5)))))
           (slash 
             (make-line-stencil 
               thick 
               x-start  ;; start x
               y-start  ;; start y
               x-end    ;; stop x
               y-end    ;; stop y
               )))
    (ly:stencil-combine-at-edge
      stil
      Y
      beam-dir
      slash
      (-
         ;; set slash really at edge of beam:
         (if (or (and (>= slant 0) (> beam-dir 0))
                 (and (< slant 0) (< beam-dir 0)))
             (* delta-beam-y-pos (- beam-dir))
             0)
         ;; add sufficient padding
         padding-corr))))
    
startAcciaccaturaMusic =  {
    <>\startGraceSlur
    \temporary \override Flag.stroke-style = #"grace"
    \temporary \foo
}

stopAcciaccaturaMusic =  {
    \revert Beam.stencil
    \revert Flag.stroke-style
    <>\stopGraceSlur
}
 
 \new Staff {
   \relative c' {
     \acciaccatura { d16 e f g } d4
     \acciaccatura { d'16 c b a } d4
     \acciaccatura { g16 a b c } d4
     \acciaccatura { g16 a b c } d4
     \clef bass      
     \acciaccatura { d,,,16 c b a  } g4
     \acciaccatura { d16 c b a } g4
     \acciaccatura { d16 c b a } g4
     \acciaccatura { d16 c b a } g4
     \acciaccatura { d'16 d d d } g4
   }
 }

\new Staff {
  \relative c' {
    \stemDown
    \acciaccatura { \stemDown d16 e f g } d4
    \acciaccatura { \stemDown d'16 c b a } d4
    \acciaccatura { \stemDown g16 a b c } d4
    \acciaccatura { \stemDown g16 a b c } d4
    \clef bass
    \acciaccatura { \stemDown d,,,16 c b a  } g4
    \acciaccatura { \stemDown d16 c b a } g4
    \acciaccatura { \stemDown d16 c b a } g4
    \acciaccatura { \stemDown d16 c b a } g4
    \acciaccatura { \stemDown d'16 d d d } g4
  }
}


\new Staff {
  \relative c'' {
    \acciaccatura {
      dis32[ e, a' bes, cis, d' ]
    }
    es,4
  }
}


\new PianoStaff <<
  \new Staff = "1" {
    s1*0
    \grace {
      \foo
      \stemDown
      a'''16[
      \change Staff = "2"
      \stemUp
      bes,
      \change Staff = "1"
      \stemDown
      fis''16
      \change Staff = "2"
      \stemUp
      g]
    }
    \change Staff = "1"
    es'4
  }
  \new Staff = "2" {
    \clef bass
    \grace s4
    s4
  }
>>

_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to