Re: performance marks

2024-02-03 Thread Valentin Petzel
Am Donnerstag, 1. Februar 2024, 00:03:00 CET schrieb Curt McDowell:
> Stan,
> 
> Here is a brute force way by embedding PostScript – although it can be a
> bit tedious.
> 
> \version "2.22.1"
> 
> %% Custom dynamic marks using embedded PostScript
> 
> %% If a particular mark is needed repeatedly, you can define a dynamic:
> vmark = #(make-dynamic-script
>(markup #:postscript
> "0.17 setlinewidth -1.50 1.25 moveto 0 1.0 rlineto stroke"))
> 

Hello Curt,

rather than postscript you should probably use the high level path command. 
This will work with other outputs than just SVG.

So instead of

\markup\postscript #"0.17 setlinewidth -1.50 1.25 moveto 0 1.0 rlineto stroke"

do

\markup\path #0.17 #'((moveto -1.5 1.25) (rlineto 0 1))

Cheers,
Valentin



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


Re: Alternate bars in different time signatures

2024-02-03 Thread Valentin Petzel
Am Freitag, 2. Februar 2024, 16:38:22 CET schrieb Lukas-Fabian Moser:
> ... and without any new insight, but with a healthy dose of syntactic sugar:

And with a rather simple custom engraver Lilypond will do these kinds of 
things for us.

Cheers, Valentin\version "2.24"

#(set-object-property! 'gatherAlternatingTimeSignatures
   'translation-type?
   boolean?)

#(set-object-property! 'alternatingTimeSignatureTextFunction
   'translation-type?
   procedure?)

alternateTimeMarkup = 
#(define-scheme-function (times) (list?)
   (make-line-markup
(map
 (lambda (x)
   (make-compound-meter-markup
(list (ly:music-property x 'numerator)
  (ly:music-property x 'denominator
 times)))

#(define (alternating-time-translator context)
   (let ((alternate-time-position 0) (alternate-times '()) (last-measure 0) (cause '()))
 (make-engraver
  ((start-translation-timestep engraver)
   (if (not (null? alternate-times))
   (let ((current-measure (ly:context-property context 'currentBarNumber)))
 (if (not (= current-measure last-measure))
 (begin
  (set! alternate-time-position
(remainder (1+ alternate-time-position) (length alternate-times)))
  (let* ((ts (list-ref alternate-times alternate-time-position))
 (cb ((ly:music-property ts 'elements-callback) ts))
 (proc (ly:music-property (ly:music-property (car cb) 'element) 'procedure))
 (tsfrac (ly:context-property context 'timeSignatureFraction)))
(proc context)
; resetting the ts fraction avoids printing of ts
(if (ly:context-property context 'gatherAlternatingTimeSignatures #t)
(ly:context-set-property! context 'timeSignatureFraction tsfrac)))
  (set! last-measure current-measure))
  (listeners
   ((time-signature-event engraver event)
(set! alternate-times (ly:event-property event 'alternate-times))
(set! cause (if (not (null? alternate-times)) event '()))
(set! alternate-time-position 0)
(set! last-measure (ly:context-property context 'currentBarNumber
  (acknowledgers
   ((time-signature-interface engraver grob source-engraver)
(if (and (ly:context-property context 'gatherAlternatingTimeSignatures #t)
 (not (null? alternate-times)))
(begin
 (ly:grob-set-property! grob 'stencil ly:text-interface::print)
 (ly:grob-set-property! grob 'text
((ly:context-property
  context
  'alternatingTimeSignatureTextFunction
  alternateTimeMarkup) alternate-times
(if (and (null? (ly:grob-property grob 'cause)) (not (null? alternate-times)))
(ly:grob-set-property! grob 'cause cause)))

alternateTime =
#(define-music-function (times) (list?)
   (let* ((times (map (lambda (t) (if (ly:music? t) t (time '() t))) times))
  (firstts (ly:music-deep-copy (car times
 (ly:music-set-property! firstts 'alternate-times times)
 firstts))

\layout {
  \context {
\Score
\consists #alternating-time-translator
  }
}

\new Staff
{
  \alternateTime #'((6 . 8) (5 . 8))
  \repeat unfold 66 a'8
  \time 7/8
  \repeat unfold 14 a'8
}

\new Staff
{
  \alternateTime #'((6 . 8) (5 . 8) (2 . 8))
  \repeat unfold 65 a'8
  \time 7/8
  \repeat unfold 14 a'8
}

\new Staff
{
  \alternateTime #(list (time '(2 3 1) '(6 . 8)) (time '(2 3) '(5 . 8)))
  \repeat unfold 66 a'8
  \time 7/8
  \repeat unfold 14 a'8
}

\new Staff
{
  \set Score.gatherAlternatingTimeSignatures = ##f
  \alternateTime #'((6 . 8) (5 . 8))
  \repeat unfold 66 a'8
  \time 7/8
  \repeat unfold 14 a'8
}

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


Re: Duration shortcut not working for rests

2024-02-03 Thread William Ashton
Ah, that makes sense. I can see how the behavior would be useful there.

I think part of the surprise is that when writing \new Dynamics voices I
will only use spacer rests, and typically only specify the "s" the first
time, leaving the rest of the piece described with just durations.

\new Dynamics {
s1
  | 2\< 2\>
  | 1\!
}

But if I try to use spacer rests in a musical context with pitches, then
the compiler stops remembering the "s".

\version "2.25.6"

{
c'4 4 4 4
% These are still "c"s
  | s4 4 4 4
}

Would it be reasonable for this to be configurable, so that different parts
could remember or forget rests as needed?

On Sat, Feb 3, 2024 at 5:22 PM Jean Abou Samra  wrote:

> Am I misunderstanding something, or is this a bug? Since the "r4" at the
> start of the second measure is fully qualified, I was expecting the "4"s
> that follow it to be quarter rests as well, but I'm seeing "c"s in the
> rendered output.
>
> \version "2.25.6"
>
> {
> c'4 r r r
> % The middle 4s are "c"s instead of rests
>   | r4 4 4 b
> }
>
> It's on purpose (even though I tend to agree that it is a bit quirky). One
> reason is to simplify the writing of percussion lines, where the same drum
> name is often repeated over and over, mixed with rests.
>
> Best,
>
> Jean
>


Re: Duration shortcut not working for rests

2024-02-03 Thread Jean Abou Samra
> Am I misunderstanding something, or is this a bug? Since the "r4" at the 
> start of the second measure is fully qualified, I was expecting the "4"s that 
> follow it to be quarter rests as well, but I'm seeing "c"s in the rendered 
> output.
> 
> ```
> \version "2.25.6"  
>   
> {  
>     c'4 r r r  
>     % The middle 4s are "c"s instead of rests  
>   | r4 4 4 b  
> }
> ```

It's on purpose (even though I tend to agree that it is a bit quirky). One 
reason is to simplify the writing of percussion lines, where the same drum name 
is often repeated over and over, mixed with rests.

Best,

Jean


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


Fwd: Duration shortcut not working for rests

2024-02-03 Thread Jakob Pedersen




 Forwarded Message 
Subject:Re: Duration shortcut not working for rests
Date:   Sat, 3 Feb 2024 17:19:42 -0500
From:   William Ashton 
To: Jakob Pedersen 



Part of what may be confusing me is that when defining a \new Dynamics 
voice, I will use only spacer rests, and I typically only specify the 
first "s", leaving only the durations for the rest of the piece. For 
example...


\new Dynamics {
  s1
  | 1
  | 2\< 2\>
  | 1\!
}

Yet, if I try similar in a music expression with pitches, it refuses to 
remember the spacers.


\version "2.25.6"

{
    c'4 4 4 4
    % These 4s are "c"s instead of rests
  | r4 4 4 4
    % These are still "c"s
  | s4 4 4 4
}

The behavior changed. Why?

On Sat, Feb 3, 2024 at 5:11 PM William Ashton  wrote:

   Sure. I recognize that that would work. I guess the question more
   directly would be "do isolated durations only work for notes?" In
   this slightly adjusted example, I would expect the "4"s in the first
   measure to remember the "c'", and the "4"s in the second measure to
   remember the "r".

   
https://lilypond.org/doc/v2.24/Documentation/notation/writing-rhythms#durations

   \version "2.25.6"

   {
    c'4 4 4 4
    % These 4s are "c"s instead of rests
  | r4 4 4 4
   }

   On Sat, Feb 3, 2024 at 5:06 PM Jakob Pedersen 
   wrote:

   Hi William,

   If you want to write more rests, the syntax is

   r4 r r b

   Much like

   c'4 r e f

   are all quarter notes and a quarter rest.


   Lilypond remembers the duration, but needs to know what to print
   with that duration.


   Best wishes,

   Jakob

   On 03.02.2024 22.55, William Ashton wrote:

Hello all,

Am I misunderstanding something, or is this a bug? Since the
"r4" at the start of the second measure is fully qualified, I
was expecting the "4"s that follow it to be quarter rests as
well, but I'm seeing "c"s in the rendered output.

\version "2.25.6"

{
    c'4 r r r
    % The middle 4s are "c"s instead of rests
  | r4 4 4 b
}


Fwd: Duration shortcut not working for rests

2024-02-03 Thread Jakob Pedersen

Remember to add the list email to your messages :)

/J


 Forwarded Message 
Subject:Re: Duration shortcut not working for rests
Date:   Sat, 3 Feb 2024 17:11:08 -0500
From:   William Ashton 
To: Jakob Pedersen 



Sure. I recognize that that would work. I guess the question more 
directly would be "do isolated durations only work for notes?" In this 
slightly adjusted example, I would expect the "4"s in the first measure 
to remember the "c'", and the "4"s in the second measure to remember the 
"r".


https://lilypond.org/doc/v2.24/Documentation/notation/writing-rhythms#durations

\version "2.25.6"

{
    c'4 4 4 4
    % These 4s are "c"s instead of rests
  | r4 4 4 4
}

On Sat, Feb 3, 2024 at 5:06 PM Jakob Pedersen  wrote:

   Hi William,

   If you want to write more rests, the syntax is

   r4 r r b

   Much like

   c'4 r e f

   are all quarter notes and a quarter rest.


   Lilypond remembers the duration, but needs to know what to print
   with that duration.


   Best wishes,

   Jakob

   On 03.02.2024 22.55, William Ashton wrote:

Hello all,

Am I misunderstanding something, or is this a bug? Since the "r4"
at the start of the second measure is fully qualified, I was
expecting the "4"s that follow it to be quarter rests as well, but
I'm seeing "c"s in the rendered output.

\version "2.25.6"

{
    c'4 r r r
    % The middle 4s are "c"s instead of rests
  | r4 4 4 b
}


Re: Duration shortcut not working for rests

2024-02-03 Thread Jakob Pedersen

Hi William,

If you want to write more rests, the syntax is

r4 r r b

Much like

c'4 r e f

are all quarter notes and a quarter rest.


Lilypond remembers the duration, but needs to know what to print with 
that duration.



Best wishes,

Jakob

On 03.02.2024 22.55, William Ashton wrote:

Hello all,

Am I misunderstanding something, or is this a bug? Since the "r4" at 
the start of the second measure is fully qualified, I was expecting 
the "4"s that follow it to be quarter rests as well, but I'm seeing 
"c"s in the rendered output.


\version "2.25.6"

{
    c'4 r r r
    % The middle 4s are "c"s instead of rests
  | r4 4 4 b
}


Duration shortcut not working for rests

2024-02-03 Thread William Ashton
Hello all,

Am I misunderstanding something, or is this a bug? Since the "r4" at the
start of the second measure is fully qualified, I was expecting the "4"s
that follow it to be quarter rests as well, but I'm seeing "c"s in the
rendered output.

\version "2.25.6"

{
c'4 r r r
% The middle 4s are "c"s instead of rests
  | r4 4 4 b
}