Piano “half sustain pedal” indications: Difference between revisions
m Lemzwerg moved page Piano "Half Sustain Pedal" Indications to Piano “half sustain pedal” indications without leaving a redirect: Only the first letter of a title should be uppercase |
m Formatting |
||
| Line 1: | Line 1: | ||
When playing the piano, there a quite a few songs that require you to only press the sustain pedal half way (or even a quarter of the way in some cases). | When playing the piano, there a quite a few songs that require you to only press the sustain pedal half way (or even a quarter of the way in some cases). | ||
There is currently not a way to show these indications on the generated music in an intuitive way. This snippet provides functions that allow you to easily do this. | |||
There is currently not a way to show these indications on the generated music in an intuitive way. This snippet provides functions that allow you to easily do this. | |||
The implementation is quite complicated, but basically there are two music functions that get defined, <code>sustainHalfOn</code> and <code>sustainHalfOff</code>. You can use these just like you would normally use <code>sustainOn</code> and <code>sustainOff</code>. You can use any of the sustain pedal styles, and everything will work as expected. You do need to add an explicit call to <code>sustainHalfOff</code> when you want the half pedal to end. Calling <code>sustainOn</code> does not automatically turn off <code>sustainHalfOn</code>. | The implementation is quite complicated, but basically there are two music functions that get defined, <code>sustainHalfOn</code> and <code>sustainHalfOff</code>. You can use these just like you would normally use <code>sustainOn</code> and <code>sustainOff</code>. You can use any of the sustain pedal styles, and everything will work as expected. You do need to add an explicit call to <code>sustainHalfOff</code> when you want the half pedal to end. Calling <code>sustainOn</code> does not automatically turn off <code>sustainHalfOn</code>. | ||
| Line 106: | Line 108: | ||
\new Staff { | \new Staff { | ||
\set Staff.pedalSustainStyle = #'mixed | \set Staff.pedalSustainStyle = #'mixed | ||
\sustainHalfOn | \sustainHalfOn | ||
b'16 c' d' e' | b'16 c' d' e' | ||
| Line 118: | Line 118: | ||
a' a' | a' a' | ||
\sustainOn | \sustainOn | ||
a' | a' a' | ||
\sustainOff\sustainOn | \sustainOff\sustainOn | ||
a' a' a' a' | a' a' a' a' | ||
\sustainOff | \sustainOff | ||
Latest revision as of 20:18, 19 March 2026
When playing the piano, there a quite a few songs that require you to only press the sustain pedal half way (or even a quarter of the way in some cases).
There is currently not a way to show these indications on the generated music in an intuitive way. This snippet provides functions that allow you to easily do this.
The implementation is quite complicated, but basically there are two music functions that get defined, sustainHalfOn and sustainHalfOff. You can use these just like you would normally use sustainOn and sustainOff. You can use any of the sustain pedal styles, and everything will work as expected. You do need to add an explicit call to sustainHalfOff when you want the half pedal to end. Calling sustainOn does not automatically turn off sustainHalfOn.
Under the covers, this works by representing sustain half on/half off as Una Corda pedal events. The logic temporarily changes the rendering of Una Corda pedals when you call sustainHalfOn, and changes it back when you call sustainHalfOff. We also temporarily change the value of Staff.unaCordaPedalStyle to match the value of Staff.sustainPedalStyle for the duration of the half sustain event so that the intended sustain pedal style will be used.