# Multiple staccato dots on minim with tremolo repeat in Lilypond

I'm writing a piano reduction of Gustav Mahler's 4th Symphony (to help study the score and practice music notation, but mainly just for kicks 'n' grins) using GNU LilyPond. (Yes, I know, I'm totally a Mahler Fanboy. So sue me.) ;-)

I'm trying to articulate a minim/half note with tremolo repeat (of quavers/eighths) with staccato dots. I'd like to have a staccato dot for each (assumed) quaver, i.e. four dots under the minim.

What I get in LilyPond (screenshot of PDF output):

Code

\repeat tremolo 4 { <g d'>8-. }


What I want (snippet of screenshot of orchestral score downloaded from IMSLP):

## Question:

Is this possible with LilyPond?

I'm using version 2.18.2, but I'm amenable to upgrading to the newer stable version if needed.

• Just when I thought I'd at least seen most musical notation frivolities, there's .... this monstrosity! Nov 30 '21 at 14:48
• Jokes aside, I'm struggling with the correct interpretation: tremolo with a single dot would mean staccato over the full note duration, while with the repeated dots it means staccato for each tremolo movement? Nov 30 '21 at 14:51
• @Creynders Yup, that's the idea. It's not all that unusual, at least speaking from orchestral bowed strings (even if a sim. would be simpler...) Nov 30 '21 at 19:41

One possible solution could be based on this snippet for multiple tonguing.

\version "2.20.0"

tongue =
#(define-music-function (parser location dots) (integer?)
#{
\tweak stencil
#(lambda (grob)
(let ((stil (ly:script-interface::print grob)))
(let loop ((count (1- dots)) (new-stil stil))
(if (> count 0)
(loop (1- count)
(ly:stencil-combine-at-edge new-stil X RIGHT stil 0.2))
(ly:stencil-aligned-to new-stil X CENTER)))))
\staccato
#})

\repeat tremolo 4 { <g d'>8-\tongue #4 }


Basically, instead of . for staccato, insert \tongue #x, where x is the number of desired articulations. It produces:

• Worked like a charm. Even in version 2.18.2. Thank you. Nov 28 '21 at 18:43
• Hello Richard, I’ve added a slightly simplified version of your code, check it out if you want.
– Lazy
Nov 30 '21 at 19:08
• @Lazy Oh, perfect! I'm not a Scheme-r myself, so I appreciate the improvements! (I just copy from other people smarter than I am...)
– Richard
Nov 30 '21 at 19:46
• @Richard After some hint by Jean the method got even simpler!
– Lazy
Nov 30 '21 at 22:15

A very simple solution would be to just places some bold full-stops in a markup, and align if necessary:
(to maintain the staccato effect in the midi file, sill use the normal staccato dot but \omit it)

\repeat tremolo 4 { <g d'>8\omit-.-\markup{\hspace #-0.5 \bold"...."} }

• Hello, I’ve added some small changes to your way to my "answer" to get rid of the hard coded \hspace. Check it out if you are interested.
– Lazy
Nov 30 '21 at 19:56
• @Lazy your second improvement on "my way" is much better: the dots follow the note head, as they should. Great work! Nov 30 '21 at 20:13

This is Richard’s answer slightly simplified. I’m putting this here because how am I going to get this into a comment?

Note that the (ly:stencil-aligned-to ... X CENTER) part is not really nescessary.

\version "2.22.0"

(grob-transformer 'stencil
(lambda (grob orig)
(stack-stencils X RIGHT pad (make-list n orig)))))

tongue =
#(define-music-function (parser location dots) (integer?)
#{ \tweak stencil #(repeat-stencil dots 0.2) \staccato #})

\repeat tremolo 4 { <g d'>8-\tongue #4 }


Also these are maybe slightly more stable ways to do like Elements in Space did:

\repeat tremolo 4 { <g d'>8\omit-.-\tweak self-alignment-X #CENTER -\tweak parent-alignment-X #CENTER -\markup\bold "...." }

\repeat tremolo 4 { <g d'>8-\tweak font-encoding #'latin1 -\tweak stencil #(lambda (grob) (grob-interpret-markup grob (markup #:bold "....")))-. }


In the first one we replace the hard coded \hspace offset by simply telling Lilypond to center the markup upon itself and to position it a the center of the note. The second one replaces the stencil (that is the actual graphic output) of the staccato dot to the stecil we get from that markup. As Script is musically encoded (so Lilypond expects the font to refer to musical symbols) we also need to change the font-encoding to latin1.

• And expanding: Centering the stencil is not nescessary as Script uses self-alignment-X = #CENTER, which means that centering is done automatically anyway.
– Lazy
Nov 30 '21 at 19:18
• Would it be possible to get the number of dots to match the number of repeats automatically? So you'd just have to write something like: \repeat tongue 4 { <g d'>8 } Nov 30 '21 at 19:50
• One would need to extend the repeat function for this. But doing a custom function for this would be quite easy. I’d say even better would be a function \tongue duration music, which then adds tonguing for each note or chord in music with a duration that is longer than duration (or maybe better a multiple) and adds dots with a number as quotient of these durations.
– Lazy
Nov 30 '21 at 20:18
• @ElementsinSpace Something like this petzel.at/tongue-and-repeat.ly
– Lazy
Nov 30 '21 at 21:16
• @ElementsinSpace Or here with the dots arranged more nicely: petzel.at/tongue-and-repeat-square.ly
– Lazy
Nov 30 '21 at 22:01