Hello Lib,

As I’m working on implementing something like this (or more generally 
something like this https://vpetzel.gitlab.io/-/lilypond/-/jobs/1933942908/
artifacts/test-results/input/regression/out-test/grid-lines-multiple.png) this 
functionality is still not part of Lilypond.

https://gitlab.com/lilypond/lilypond/-/merge_requests/1099

This will be optimized and eventually be merged into the then next Lilypond 
release, which is 2.23.6 for now.

With the current Lilypond version the only way to get this done is by putting 
a GridLine on each Note and then using manual overrides to have them printed 
in some color.

Cheers,
Valentin

Am Sonntag, 2. Jänner 2022, 10:31:25 CET schrieb Lib Lists:
> Hi Valentin,
> thank you so much! The example you attached looks perfect.
> However, it doesn't seem to work under Lilypond 2.22.1 (I noticed your
> \version is 2.23.6). Here's the error I get. Should I update Lilypond?
> 
> Interpreting music...
> warning: cannot find property type-check for `idGridIntervals'
> (translation-type?).  perhaps a typing error?
> warning: skipping assignment
> warning: cannot find property type-check for `idGridIntervals'
> (translation-type?).  perhaps a typing error?
> warning: skipping assignment
> 
> Thank you so much once again for your help,
> Lib
> 
> On Sat, 1 Jan 2022 at 23:11, Valentin Petzel <valen...@petzel.at> wrote:
> > Hello Lib,
> > 
> > https://gitlab.com/lilypond/lilypond/-/merge_requests/1099
> > 
> > I’ve got a first version up, which easily can do stuff as in the appended
> > file. The shift on the first one requires a manual override so far.
> > 
> > Cheers,
> > Valentin
> > 
> > Am Samstag, 1. Jänner 2022, 21:17:52 CET schrieb Lib Lists:
> > > Hi Valentin,
> > > wow, thanks, if you have the time that would be great!
> > > 
> > > To clarify what I mean, here attached is an example made with
> > > Inkscape. I suspect that a dashed line would work better than a
> > > coloured one, but anything that would differentiate the two grid lines
> > > would work.
> > > 
> > > Cheers,
> > > Lib
> > > 
> > > On Sat, 1 Jan 2022 at 18:15, Valentin Petzel <valen...@petzel.at> wrote:
> > > > Hello Lib, I think I can implement something for that, give me a day
> > > > or
> > > > two.
> > > > 
> > > > Cheers,
> > > > Valentin
> > > > 
> > > > Am Samstag, 1. Jänner 2022, 15:56:18 CET schrieb Lib Lists:
> > > > > Hello everybody, and happy new year!
> > > > > 
> > > > > In the example below I would like to add another set of grid lines
> > > > > to
> > > > > show the triplet subdivisions in the lower staff. Moreover, I'd like
> > > > > to colour the two grid lines differently. I couldn't find any
> > > > > example
> > > > > and I'm not sure whether this is actually possible.
> > > > > 
> > > > > Alternatively, what would be the best strategy to add lines to
> > > > > connect
> > > > > notes in different staves?
> > > > > 
> > > > > Thank you in advance for any help!
> > > > > 
> > > > > Lib
> > > > > 
> > > > > - - -
> > > > > 
> > > > > \version "2.22.1"
> > > > > \score {
> > > > > 
> > > > >   <<
> > > > >   
> > > > >     \new Staff {
> > > > >     
> > > > >       \time 2/8
> > > > >       \relative c'' {
> > > > >       
> > > > >         \override TupletBracket.bracket-visibility = ##t
> > > > >         \tuplet 3/2 {\tuplet 5/4 {a32[ a a a a]} \tuplet 5/4 {a32[ a
> > > > >         a
> > > > > 
> > > > > a a]}\tuplet 5/4 {a32[ a a a a]}}
> > > > > 
> > > > >       }
> > > > >     
> > > > >     }
> > > > >     \new Staff {
> > > > >     
> > > > >       \relative c {
> > > > >       
> > > > >         \clef bass
> > > > >         \override TupletBracket.bracket-visibility = ##t
> > > > >         \tuplet 5/4 {\tuplet 3/2 {e32[ e e]} \tuplet 3/2 {e32[ e
> > > > > 
> > > > > e]}\tuplet 3/2 {e32[ e e]}\tuplet 3/2 {e32[ e e]}\tuplet 3/2 {e32[ e
> > > > > e]}}
> > > > > 
> > > > >       }
> > > > >     
> > > > >     }
> > > > >   
> > > > >   \layout {
> > > > >   
> > > > >     \context {
> > > > >     
> > > > >       \Staff
> > > > >       \consists "Grid_point_engraver"
> > > > >       gridInterval = #(ly:make-moment 1/12)
> > > > >     
> > > > >     }
> > > > >     \context {
> > > > >     
> > > > >       \Score
> > > > >       \consists "Grid_line_span_engraver"
> > > > >     
> > > > >     }
> > > > >   
> > > > >   }
> > > > > 
> > > > > }
\version "2.22.1"
\score {
  <<
    \new Staff {
      \time 2/8
      \relative c'' {
        \override TupletBracket.bracket-visibility = ##t
        \tuplet 3/2 {\tuplet 5/4 {a32[ a a a a]} \tuplet 5/4 {a32[ a a
a a]}\tuplet 5/4 {a32[ a a a a]}}
      }
    }
    \new Staff {
      \relative c {
        \clef bass
        \override TupletBracket.bracket-visibility = ##t
        \tuplet 5/4 {\tuplet 3/2 {e32[ e e]} \tuplet 3/2 {e32[ e
e]}\tuplet 3/2 {e32[ e e]}\tuplet 3/2 {e32[ e e]}\tuplet 3/2 {e32[ e
e]}}
      }
    }
    \new Devnull {
      <<
        \repeat unfold 5 {  % make GridLines visible and red for k/5 position
          \once\revert Score.GridLine.stencil
          \once\override Score.GridLine.color = #red
          s4*1/5
        }
        \repeat unfold 3 {  % make GridLines visible and blue for k/3 position
          \once\revert Score.GridLine.stencil
          \once\override Score.GridLine.color = #blue
          s4*1/3
        }
        \repeat unfold 1 {  % make special combined stencil for common positions
          \once\override Score.GridLine.stencil =
          #(lambda (grob)
             (let* ((stc (ly:grid-line-interface::print grob))
                    (cst (ly:stencil-in-color stc 255 0 0)))
               (ly:stencil-combine-at-edge stc X LEFT cst 0)))
        }
      >>
    }
  >>
  \layout {
    \context {
      \Staff
      \consists "Grid_point_engraver"
      gridInterval = #(ly:make-moment 1/60)  % GridLine on each note
    }
    \context {
      \Score
      \consists "Grid_line_span_engraver"
      \temporary\override GridLine.stencil = ##f  % GridLines not printed by default
    }
  }
}

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to