\version "2.17.29" %%%%% A better slash snippet %%% #(define (degrees->radians deg) (* PI (/ deg 180.0))) % The argument `ang' is the amount of slant, expressed in degrees. % % Stem-fraction is the distance between the point the slash crosses the stem % and the beam-end of the stem. It is expressed as a number between 0 and 1. % % The argument `protrusion' is the extra _vertical_ distance the slash % extends. slash = #(define-music-function (parser location ang stem-fraction protrusion) (number? number? number?) (remove-grace-property 'Voice 'Stem 'direction) #{ \once \override Stem #'stencil = #(lambda (grob) (let* ((x-parent (ly:grob-parent grob X)) (is-rest? (ly:grob? (ly:grob-object x-parent 'rest)))) (if is-rest? empty-stencil (let* ((refp (ly:grob-system grob)) (stem-y-ext (ly:grob-extent grob grob Y)) (stem-length (- (cdr stem-y-ext) (car stem-y-ext))) (line-dy (* stem-length stem-fraction)) (line-dy-with-protrusions (+ line-dy (* 2 protrusion))) (ang (degrees->radians ang)) (line-dx (/ line-dy-with-protrusions (tan ang))) (protrusion-dx (/ protrusion (tan ang))) (dir (ly:grob-property grob 'direction)) (corr (if (= dir 1) (car stem-y-ext) (cdr stem-y-ext))) (stil (ly:stem::print grob))) (ly:stencil-add stil (grob-interpret-markup grob (markup ;#:with-color red #:translate (cons (- protrusion-dx) (+ corr (* dir (- stem-length (+ line-dy protrusion))))) #:draw-line (cons line-dx (* dir line-dy-with-protrusions))))))))) #}) slashI = { \slash 60 0.4 0.5 } slashII = { \slash 45 0.4 0.5 } \layout { ragged-right = ##t } \new Staff { \relative c'' { \acciaccatura {\slashI g8[ a b c] } d4 \acciaccatura {\slashI g8[ a b c] } d4 \acciaccatura {\slashI g8[ a b c] } d4 \acciaccatura {\slashI g8[ a b c ] } d4 } \relative c' { \clef bass %\break \acciaccatura {\slashII d8[ c b a ] } g4 \acciaccatura {\slashII d8[ c b a ] } g4 \acciaccatura {\slashII d8[ c b a ] } g4 \acciaccatura {\slashII d8[ c b a ] } g4 } } \new Staff { \relative c'' { \acciaccatura { \slash 45 0.4 0.5 dis32[ e, a' bes, cis, d' ] } es,4 \acciaccatura { \slash 60 0.4 0.7 dis'32[ e, a' bes, cis, d' ] } es,4 } }