-
Notifications
You must be signed in to change notification settings - Fork 3
Shorthand pedal notation
Numula provides a shorthand notation for describing pedal changes over time.
As with Numula's other shorthand notations, you can use
iteration, substitution, and comments.
This shorthand is implemented by a function sh_pedal():
from numula.notate_nuance import *
sh_pedal(s:str) -> PFTThe string consists of various components:
1/1
The pedal is off for 1 measure.
(1/1)
The pedal is on for 1 measure; the segment is open at both ends.
(.5 1/1)
The pedal is half depressed for 1 measure.
(0.2 1/1 1.0)
The pedal varies linearly from 0.2 to 1.0 over 1 measure.
The order of values and durations doesn't matter. For example, the last example could be written
(1/1 0.2 1.0)
(0.2 1.0 1/1)
In all cases, square brackets indicate closed endpoints. For example,
[1/1)
denotes a segment of pedal down, closed at the start and open at the end.
For example,
from notate_nuance import *
pft = sh_pedal('1/4 (1/8) (1/4) 4/4')returns a PFT representing a pedal that's off for 1 beat, on for half a beat, momentarily lifted, on for 1 beat, then off for 4 beats.
You can apply this PFT as a virtual sustain pedal using
Score.vsustain_pft(
pft: PFT,
t0: float,
selector: Selector = None
)or as a MIDI pedal (soft, sostenuto, or sustain) using
Score.pedal_pft(
pft: PFT,
type: int = PEDAL_SUSTAIN,
t0: float
)