5

In Lilypond, I'm engraving a chunk of piano music which uses the Ped. symbol, but does not use the corresponding * to end the pedalling.

Here's a chunk of code which gets the right visual result:

\version "2.18.2"
upper = \relative c'' {
  \clef treble
  a4 b c d
}
lower = \relative c {
  \clef bass
  a2 c
}
pedal = {
 s4\sustainOn s s s\sustainOff 
}
\score {
  \new PianoStaff <<
    \new Staff = "upper" \upper
    \new Staff = "lower" \lower
    \new Dynamics = "pedal" \with {
      pedalSustainStrings = #'("Ped." "*Ped." "")
    } \pedal
  >>
  \layout { }
}

Ped but no *

Note the #'("Ped." "*Ped." "") bit.

But that also produces a warning:

warning: SustainPedal has empty extent and non-empty stencil.

I've got 7 pages of music with pedaling every 2-3 measures. I'm not going to make it to the end with that many warnings popping out every time. Is there some better/more correct way of suppressing that symbol?

2
  • Why can't you just ignore the warnings? They are just warnings, after all: they indicate that something could be wrong, but here it is clearly your intent. If you fear that you will be flooded with the warnings, run Lilypond with the command switch -l ERROR .
    – Ramillies
    Jun 6, 2020 at 7:59
  • A handful wouldn't be a problem, but dozens will make it harder to scroll around in the Frescobaldi log window, which would make my life a bit harder while working on this piece. Plus Lilypond is close enough to programming that my aversion to compiler warnings kicks in. :) Jun 6, 2020 at 16:05

3 Answers 3

5

If you want the to release the sustain pedal, but to not display a symbol for it:
Instead of typing \sustainOff, use \hide\sustainOff.

NB: you won't need that \with ... statement

EDIT
Using \omit is probably better than \hide.

This is because \omit doesn't print anything at all, whereas \hide effectively prints an invisible symbol and consequently makes spacing alterations that would be necessary as if the symbol were visible.

1

I poked at it some more, and did some wild guessing in conjunction with my Scheme knowledge, and I tried:

pedalSustainStrings = #'("Ped." "*Ped." #f)

That is, a #f for "false" instead of the zero-length string "". That seems to still produce the visual result that I want, without any warnings being emitted. I've got no idea if this is expected behavior from Lilypond though.

1

This is not an answer to the OP, but a reply to a comment that's too big to post there.

If you are in a situation when you need to suppress several warnings that you know aren't important but that obfuscate other warnings and errors, you can use this function.

% ly:expect-warning only works to suppress once.  This function allows
% you to specify the number of times a warning appears.
#(define ly:expect-warning-times (lambda args
   (for-each (lambda _ (apply ly:expect-warning (cdr args)))
         (iota (car args)))))

#(ly:expect-warning-times 33 "omitting tuplet bracket")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.