[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Shorthand for \repeat unfold for individual notes
From: |
Carl Sorensen |
Subject: |
Re: Shorthand for \repeat unfold for individual notes |
Date: |
Mon, 23 Jan 2023 16:46:55 -0700 |
On Mon, Jan 23, 2023 at 4:16 PM Aaron Hill <lilypond@hillvisions.com> wrote:
> There is already shorthand for tremolo repeats, so I wondered if there
> could be the same for cases when a single note or rest is repeated.
>
> %%
> % Start with music that has repeated notes:
> { \time 7/8 a8 8 8 b16 16 16 16 c4 }
>
> % Manually unfolded repeats work, but take up a lot of input space:
> { \time 7/8 \repeat unfold 3 a8 \repeat unfold 4 b16 c4 }
>
> % This produces the correct length of music without note repetition:
> { \time 7/8 a8*3 b16*4 c4 }
>
> % Possible shorthand for unfolded repeat:
> { \time 7/8 a8**3 b16**4 c4 }
> %%
>
I'm not in favor.
a8**3 is 5 key strokes.
a8 8 8 is 6 key strokes.
In exchange for saving one key stroke, I have a new operator to remember
(and get confused about) and to maintain changes to the lexer and parser.
I get the lack of utility of \repeat unfold (14 keystrokes) for short music
expressions (like a single note). But I don't think that ** is intuitive
enough to use it.
What about
%%%%%%
\version "2.24"
dup =
#(define-music-function
(count mus)
(number? ly:music?)
#{
\repeat unfold $count $mus
#})
{\time 7/8 \dup #3 a8 \dup #4 b16 c4}
%%%%%
If you don't like the name dup, you could use ru (short for repeat unfold)
If there were an alternative operator that would not mess up lookahead and
would not suffer with the confusion between * and ** (people already think
* does your proposed **), I could be convinced.
Thanks,
Carl