circle around stem
Hi, trying to define an overwrite to draw a circle around a stem I came up with the code below. Unfortunately it doesn't automagically work for all use cases as can be seen in the attached image: The code doesn't take the number of flags into account. I know that the stem length can be altered with a tweak, but I'd prefer this to be corrected without manual intervention. Is there a way within the damp-stem function to force a minimum stem-length depending on the number of flags if notes aren't beamed? -- Orm 8<--- #(define (damp-stem grob) (if (ly:stencil? (ly:stem::print grob)) (let* ((stencil (ly:stem::print grob)) (X-ext (ly:stencil-extent stencil X)) (Y-ext (ly:stencil-extent stencil Y)) (dir (ly:grob-property grob 'direction)) (width (interval-length X-ext)) (len (interval-length Y-ext)) (y-offs (if (= dir 1) 1.29 (- len 1.29 (ly:stencil-translate (grob-interpret-markup grob (markup (#:path width (list (list 'moveto -0 0) (list 'lineto -0 len))) (#:hspace -1.13) (#:circle (#:path 0.15 (list (list 'moveto 0 y-offs)) (cons 0 (interval-start Y-ext #f)) damp = { \once \override Stem.stencil = #damp-stem } {\autoBeamOff \override Stem.stencil = #damp-stem c'4 c'8 c'16 c'32 c'64 s32 c''4 c''8 c''16 c''32 c''64 } 8<---
Re: circle around stem
Hi, FYI: I mostly solved it by setting Stem.details.lengths (see below). Setting this property within the stencil function doesn't seem to work (it's the line: "(ly:grob-set-nested-property! grob '(details lengths) '(3.5 3.5 4.25 5 6 7 8))" in #'damp-stem). I assume this happens because the stencil function is called after the length already has been determined, or because I misunderstand the syntax and I'd be interested if someone can shed a light on that (and maybe even provide a solution), but this already is very usable the way it is. -- Orm 8<--- #(define (damp-stem grob) (if (ly:stencil? (ly:stem::print grob)) (let* ((stencil (ly:stem::print grob)) (X-ext (ly:stencil-extent stencil X)) (Y-ext (ly:stencil-extent stencil Y)) (dir (ly:grob-property grob 'direction)) (width (interval-length X-ext)) (len (interval-length Y-ext)) (y-offs (if (= dir 1) 1.29 (- len 1.29 (ly:grob-set-nested-property! grob '(details lengths) '(3.5 3.5 4.25 5 6 7 8)) (ly:stencil-translate (grob-interpret-markup grob (markup (#:path width (list (list 'moveto -0 0) (list 'lineto -0 len))) (#:hspace -1.19) (#:raise y-offs (#:draw-circle 0.45 width #f (cons 0 (interval-start Y-ext #f)) damp = { \once \override Stem.details.lengths = #'(3.5 3.5 4.25 5 6 7 8) \once \override Stem.stencil = #damp-stem } {\autoBeamOff \override Stem.details.lengths = #'(3.5 3.5 4.25 5 6 7 8) \override Stem.stencil = #damp-stem c'4 c'8 c'16 c'32 c'64 c'128 s32 c''4 c''8 c''16 c''32 c''64 c''128 \revert Stem.details.lengths \revert Stem.stencil \damp c'32 \damp c''32 c''32 } 8<--- Am Freitag, den 08. Juli 2022 um 16:22:22 Uhr (+0200) schrieb Orm Finnendahl: > Hi, > > trying to define an overwrite to draw a circle around a stem I came > up with the code below. Unfortunately it doesn't automagically work > for all use cases as can be seen in the attached image: The code > doesn't take the number of flags into account. I know that the stem > length can be altered with a tweak, but I'd prefer this to be > corrected without manual intervention. Is there a way within the > damp-stem function to force a minimum stem-length depending on the > number of flags if notes aren't beamed? > > -- > Orm > > 8<--- > #(define (damp-stem grob) >(if (ly:stencil? (ly:stem::print grob)) > (let* ((stencil (ly:stem::print grob)) >(X-ext (ly:stencil-extent stencil X)) >(Y-ext (ly:stencil-extent stencil Y)) >(dir (ly:grob-property grob 'direction)) >(width (interval-length X-ext)) >(len (interval-length Y-ext)) >(y-offs (if (= dir 1) 1.29 (- len 1.29 > (ly:stencil-translate > (grob-interpret-markup grob >(markup > (#:path width > (list (list 'moveto -0 0) > (list 'lineto -0 len))) > (#:hspace -1.13) > (#:circle > (#:path 0.15 > (list >(list 'moveto 0 y-offs)) > (cons 0 (interval-start Y-ext > #f)) > > damp = { \once \override Stem.stencil = #damp-stem } > > {\autoBeamOff > \override Stem.stencil = #damp-stem c'4 c'8 c'16 c'32 c'64 s32 c''4 c''8 > c''16 c''32 c''64 } > 8<---
French tablature (with note heads)?
Hello, I believe I asked a very similar question some years ago, since when Lilypond has had numerous new releases and improvements. But I still don't know how to typeset French tablature for the viol. This requires six lines, letters printed between the lines, and the notes above the staff printed with heads. Examples are at https://bit.ly/3OZVwXt and at https://bit.ly/3yoHkjP There are other software systems that can manage this, but rather than jump between systems I'd rather stay entirely within Lilypond. Can Lilypond produce tablature of the style shown in the two images above? many thanks, Alasdair -- Alasdair McAndrew (he/him) mob: 0432 854 858 https://numbersandshapes.net
Re: French tablature (with note heads)?
Hi, Yes, it is possible. The issue was discussed some times ago on the French users list. I join a sample of the result. Hope this helps, Jean Le samedi 09 juillet 2022 à 11:42 +1000, Alasdair McAndrew a écrit : > Hello, > > I believe I asked a very similar question some years ago, since when > Lilypond has had numerous new releases and improvements. But I still > don't know how to typeset French tablature for the viol. This > requires six lines, letters printed between the lines, and the notes > above the staff printed with heads. Examples are at > > https://bit.ly/3OZVwXt > > and at > > https://bit.ly/3yoHkjP > > There are other software systems that can manage this, but rather > than jump between systems I'd rather stay entirely within Lilypond. > > Can Lilypond produce tablature of the style shown in the two images > above? > > many thanks, > Alasdair > \version "2.20.0" \header { title = "A Pollish Vilanell" composer = \markup{\smallCaps{Tobias Hume}} } common = { \time 2/2 \repeat volta 2 {\partial 4 s4 s1*13} \repeat volta 2 {s1*18} } first = \relative c { \voiceOne \clef bass a4 d e f g a2. a4 c8 d e f e4 d8 c b4 a e gis a2. a4 c b a g a2. a4 g g g f e1 d4. e8 f4 g a2 d,4 f d2 cis d'1 e,4 e e f e2. e'4 d a c b a1 d,4 d, d''2 c4 b a2 g4. f8 e4 a g4. f8 e4 a c f, e d cis1 d4 d, f' g a f bes a g f d cis d'1 d,4 d, d'' a f8 g a bes a4 g8 f e4 d a cis d'1 } second = \relative c { \voiceTwo s4 s1 a2. s4 s1 e'4 f s2 a,2. s4 s1 f'2. f4 c c c d a1 s1 s a2 s d,1 a'4 cis cis d a2. s4 s2 e'4 s a,1 s1 a'4 e f2 c4. s8 c4 f c4. s8 c4 f e d a bes a1 s s c4 d a s d,1 s s s d } third = \relative c { \override Stem.stencil = ##f \voiceThree \shiftOff s4 s1 2. s4 s1 s 2. s4 s1 s s cis s s \shiftOn e2 s \shiftOff 1 cis4 s2. cis2. s4 s1 s s s s s2 cis4 s s1 s s s2 \shiftOn e4 \shiftOff s 1 s1 s s } rythm = { c4 s1 c2. 4 8 s4. c4 8 s c4 s2. c2. 4 s1 c2. 4 s1 c1 4. 8 4 s c2 4 s c2 s c1 c4 s s s c2. 4 s s s s c1 4 s c2 4 s c2 4. 8 4 s c4. 8 4 s s1 c1 4 s2. s1 s c1 c4 s2. c8 s4. c4 8 s c4 s2. c1 } \score { << \new Staff << \common \new Voice \first \new Voice \second \new Voice \third >> \new RhythmicStaff \with { \remove "Staff_symbol_engraver" \omit Clef \omit TimeSignature \override VerticalAxisGroup #'staff-staff-spacing = #'((basic-distance . 4) (minimum-distance . 3) (padding . .5)) \override NoteHead.style = #'petrucci }{ \rythm } \new TabStaff \with { tablatureFormat = #fret-letter-tablature-format \override TabNoteHead.whiteout = ##f \override TabNoteHead.before-line-breaking = #(lambda (grob) (if (not (< (ly:grob-property grob 'Y-offset) -4)) (ly:grob-set-property! grob 'Y-offset (+ (ly:grob-property grob 'Y-offset) 0.6 \omit Clef \override TimeSignature.X-offset = #-2 \override TimeSignature.font-size = #3 \revert TimeSignature.stencil \override TabNoteHead.font-name = "LeRoy" } {\stemUp <<\common \first \second \third>> } >> \layout { indent = 0 \context { \TabStaff stringTunings = \stringTuning fretLabels = #'("a" "b" "c" "d" "e" "f" "g" "h" "i" "k") } } }