RE: Re: Small note between staves as time signature

2023-05-12 Thread juergen . gruen


   
   .fr-emoticon.fr-emoticon-img {

   background-repeat: no-repeat !important;
   font-size: inherit;
   height: 1em;
   width: 1em;
   min-height: 20px;
   min-width: 20px;
   display: inline-block;
   margin: -0.1em 0.1em 0.1em;
   line-height: 1;
   vertical-align: middle;
   }
   .fr-emoticon {
   font-weight: normal;
   font-family: "Apple Color Emoji","Segoe UI Emoji","NotoColorEmoji","Segoe 
UI Symbol","Android Emoji","EmojiSymbols";
   display: inline;
   line-height: 0;
   }
   Hello Jakob,
thank you, but I would never have figured out the use of GridLine for this 
purpose on my own also ;-)
I added calculation of the x-Position, so the first notehead is centered over 
the dots of the bass clef automatically. The parameter x-off is optional 
now.You can call the music function in front of the staff definitions. In 
addition with the removal of the time-signature-engraver in the layout-block, 
everything is clearer and better readable, I think.
Juergen.
%%\version 2.24.0

\language deutsch

%% based on https://www.mail-archive.com/lilypond-user@gnu.org/msg119983.html
positionTimeSignature =
#(define-music-function (x-off arg) ((number? -0.75) markup?)
  Create a markup from @var{arg}. Center the markup vertically between 
two staves.
   Horizontally aligned to the end of the clefs; can be optionally adjusted with 
@var{x-off}.
  #{
\once \override Score.GridLine.stencil =
#(lambda (grob)
   (let* (
   ; create grid-line stencil for calculations
   (stil (ly:grid-line-interface::print grob))
   (stil-y-ext (ly:stencil-extent stil Y))
   (center ( / (+ (car stil-y-ext) (cdr stil-y-ext)) 2))


   ; calculate widest x-extent of clefs relative to system
   (refp (ly:grob-system grob))
   (all-elts (ly:grob-array->list (ly:grob-object refp 
all-elements)))
   (clefs (filter (lambda (elt)
(grob::has-interface elt clef-interface))
  all-elts))

   (max-x (apply max (map (lambda (clef)
(max (+ (ly:grob-relative-coordinate 
clef refp X)
   (car (ly:grob-property clef 
X-extent)))
  (+ (ly:grob-relative-coordinate clef 
refp X)
(cdr(ly:grob-property clef 
X-extent)
   clefs)))

   ; create time-signature markup
   (note
(interpret-markup
 (ly:grob-layout grob)
 (ly:grob-alist-chain grob
   (ly:output-def-lookup (ly:grob-layout grob) 
text-font-defaults))
 arg))

   ; calculate offsets for translation
   (note-y-ext (ly:stencil-extent note Y))
   (height (interval-length (ly:stencil-extent note Y)))
   (calc-y (- (- center (car note-y-ext)) ( / height 2)))
   (calc-x (+ (- max-x (ly:grob-relative-coordinate grob refp X)) 
x-off)))

 ;return translated stencil
 (ly:stencil-translate note (cons calc-x  calc-y
  #})


% definiton of custom time signature as markup
sig = \markup { \teeny \line { \note {2} #1 \note {4} #UP } }

\score {
 \new PianoStaff 
   % no need to put inside voice context
   \positionTimeSignature \sig
   \new Staff 
 \key d \major
 \new Voice {  \voiceOne d4 \bar | }
 \new Voice { \voiceTwo a4 }
   >>
   \new Staff 
 \clef bass \key d \major
 \new Voice { \voiceOne fis4 }
 \new Voice { \voiceTwo d4 }
   >>
 >>
}

\layout {
 \context {
   \Score
   \consists Grid_line_span_engraver
   \override GridLine.stencil = ##f

 }
 \context {
   \Staff
   \consists Grid_point_engraver
   %% adjust the value if needed
   gridInterval = #(ly:make-moment 1/64)
   % remove for all staves
   \remove Time_signature_engraver
 }
}


Re: Small note between staves as time signature

2023-05-11 Thread Lukas-Fabian Moser

Hi Jakob,

The Danish book of chorales to accompany the official hymnal uses a 
peculiar "time signature" (which isn't really a time signature) for 
some hymns.


It's a small note, in this case a 텞  but elsewhere its a compound 
signature like 텞♩, to indicate the metre.

Maybe also use an actual TimeSignature living in a Dynamics context?

\version "2.24.0"

#(add-simple-time-signature-style
  'note
  (lambda (frac)
    (let ((den (cdr frac)))
  #{ \markup \tiny \note #(ly:make-duration (ly:intlog2 den)) #UP #})))

\layout {
  \context {
    \Dynamics
    \consists Time_signature_engraver
    \override TimeSignature.break-align-symbol = #'key-signature
    \override TimeSignature.style = #'note
  }
  \context {
    \Staff
    \remove Time_signature_engraver
  }
}

\score {
  \new PianoStaff <<
    \new Staff {
  \key d \major
  \after 1*6 { \break \time 2/2 }
  \repeat unfold 100 << d'4 \\ a4 >>
    }
    \new Dynamics {
  s1*25
    }
    \new Staff \with { \clef bass } {
  \key d \major
  \repeat unfold 100 << fis4 \\ d4 >>
    }
  >>
}

Lukas




Re: Small note between staves as time signature

2023-05-11 Thread Jakob Pedersen

Hi Juergen,

Works perfectly! Thank you very much.

I can guarantee you I would never have figured that out on my own!

If anyone has any idea what this kind of notation is called, do let me 
know :)


Best wishes,
Jakob

On 11.05.2023 12.59, juergen.gr...@xyz.de wrote:

Hello,

what about this:


\version "2.24.0"

\language "deutsch"

%% based on 
https://www.mail-archive.com/lilypond-user@gnu.org/msg119983.html

center =
#(define-music-function (text x-off) (markup? number?)
   #{
     \once \override Score.GridLine.stencil =
     #(lambda (grob)
        (let* ((stil (ly:grid-line-interface::print grob))
               (stil-y-ext (ly:stencil-extent stil Y))
               (thick (ly:grob-property grob 'thickness 0.1))
               (center ( / (+ (car stil-y-ext) (cdr stil-y-ext)) 2))

               (note
                (interpret-markup
                 (ly:grob-layout grob)
                 (ly:grob-alist-chain grob
                   (ly:output-def-lookup (ly:grob-layout grob) 
'text-font-defaults))

                 text))

               (note-y-ext (ly:stencil-extent note Y))
               (height (interval-length (ly:stencil-extent note Y)))
               (y-off (- (- center (car note-y-ext)) ( / height 2

          (ly:stencil-translate note (cons x-off y-off
   #})


sig = \markup { \teeny \line { \note {2} #1 \note {4} #-1 } }

\score {
  \new PianoStaff <<
    \new Staff <<
      \key d \major
      \new Voice { \once \override Staff.TimeSignature. stencil = ##f 
\voiceOne d'4 \bar "|" }

      \new Voice { \voiceTwo \center \sig #-6.25 a4 }
    >>
    \new Staff <<
      \clef bass \key d \major
      \new Voice { \once \override Staff.TimeSignature. stencil = ##f 
\voiceOne fis4 }

      \new Voice { \voiceTwo d4 }
    >>
  >>
}

\layout {
  \context {
    \Score
    \consists "Grid_line_span_engraver"
    \override GridLine.stencil = ##f
  }
  \context {
    \Staff
    \consists "Grid_point_engraver"
    %% adjust the value if needed
    gridInterval = #(ly:make-moment 1/64)
  }
}
%

HTH, Juergen.




Re: Small note between staves as time signature

2023-05-11 Thread juergen . gruen


   
   .fr-emoticon.fr-emoticon-img {

   background-repeat: no-repeat !important;
   font-size: inherit;
   height: 1em;
   width: 1em;
   min-height: 20px;
   min-width: 20px;
   display: inline-block;
   margin: -0.1em 0.1em 0.1em;
   line-height: 1;
   vertical-align: middle;
   }
   .fr-emoticon {
   font-weight: normal;
   font-family: "Apple Color Emoji","Segoe UI Emoji","NotoColorEmoji","Segoe 
UI Symbol","Android Emoji","EmojiSymbols";
   display: inline;
   line-height: 0;
   }
   Hello,
what about this:
\version 2.24.0

\language deutsch

%% based on https://www.mail-archive.com/lilypond-user@gnu.org/msg119983.html
center =
#(define-music-function (text x-off) (markup? number?)
  #{
\once \override Score.GridLine.stencil =

#(lambda (grob)
   (let* ((stil (ly:grid-line-interface::print grob))
  (stil-y-ext (ly:stencil-extent stil Y))
  (thick (ly:grob-property grob thickness 0.1))
  (center ( / (+ (car stil-y-ext) (cdr stil-y-ext)) 2))

  (note
   (interpret-markup
(ly:grob-layout grob)
(ly:grob-alist-chain grob
  (ly:output-def-lookup (ly:grob-layout grob) 
text-font-defaults))
text))

  (note-y-ext (ly:stencil-extent note Y))
  (height (interval-length (ly:stencil-extent note Y)))
  (y-off (- (- center (car note-y-ext)) ( / height 2

 (ly:stencil-translate note (cons x-off y-off
  #})


sig = \markup { \teeny \line { \note {2} #1 \note {4} #-1 } }

\score {
 \new PianoStaff 
   \new Staff 
 \key d \major
 \new Voice { \once \override Staff.TimeSignature. stencil = ##f \voiceOne d4 
\bar | }
 \new Voice { \voiceTwo \center \sig #-6.25 a4 }
   >>
   \new Staff 
 \clef bass \key d \major
 \new Voice { \once \override Staff.TimeSignature. stencil = ##f \voiceOne 
fis4 }
 \new Voice { \voiceTwo d4 }
   >>
 >>
}

\layout {
 \context {
   \Score
   \consists Grid_line_span_engraver
   \override GridLine.stencil = ##f
 }
 \context {
   \Staff
   \consists Grid_point_engraver
   %% adjust the value if needed
   gridInterval = #(ly:make-moment 1/64)
 }
}%
HTH, Juergen.



Small note between staves as time signature

2023-05-10 Thread Jakob Pedersen

Hello all,

The Danish book of chorales to accompany the official hymnal uses a 
peculiar "time signature" (which isn't really a time signature) for some 
hymns.


It's a small note, in this case a 텞  but elsewhere its a compound 
signature like 텞♩, to indicate the metre.




I've replicated it by hiding the TimeSignature and adding a note as 
markup to the alto or tenor voice and sort-of wiggled it into position, 
but that's that a particularly elegant solution.


The main problem with my fix is vertical alignment. I'd like it to be in 
the middle of the between-staff space.


A minimal example:

\version "2.24.1"
\language "deutsch"

\score {
  \new PianoStaff <<
    \new Staff <<  \key d \major
  \new Voice { \once \override Staff.TimeSignature. stencil = ##f 
\voiceOne d'4 \bar "|" }
  \new Voice { \voiceTwo a4_\markup { \hspace #-6 \teeny \note {2} 
#1 } }

    >>
    \new Staff << \clef bass \key d \major
  \new Voice { \once \override Staff.TimeSignature. stencil = ##f 
\voiceOne fis4 }

  \new Voice { \voiceTwo d4 }
    >>
  >>
}

Any thoughts? Does anyone know what this type of notation is called?


Best wishes,

Jakob Pedersen