Safe Haskell | Safe-Inferred |
---|
Postprocs that change note start and duration.
Synopsis
- library :: Library.Library
- type Key key = Score.Event -> key
- make_cancel :: Ord key => Cancel -> Key key -> WithArgDoc (TransformerF Note)
- adjust_offset :: RealTime.RealTime -> Maybe.Maybe (RealTime.RealTime, RealTime.RealTime) -> Maybe.Maybe (RealTime.RealTime, RealTime.RealTime) -> RealTime.RealTime -> RealTime.RealTime -> RealTime.RealTime
- cancel_strong_weak :: (Score.Event -> [Score.Event] -> Score.Event) -> [Score.Event] -> Either Text [Score.Event]
- group_and_cancel :: Ord key => Cancel -> Key key -> RealTime.RealTime -> Events -> Either Text Events
- infer_duration_merged :: Score.Event -> [Score.Event] -> Score.Event
Documentation
type Key key = Score.Event -> key Source #
The key identifies another event which is in the same voice. This could
be Post.hand_key
, but it could also match polos to sangsih, since they
form a composite part.
make_cancel :: Ord key => Cancel -> Key key -> WithArgDoc (TransformerF Note) Source #
:: RealTime.RealTime | don't move notes any closer than this |
-> Maybe.Maybe (RealTime.RealTime, RealTime.RealTime) | |
-> Maybe.Maybe (RealTime.RealTime, RealTime.RealTime) | |
-> RealTime.RealTime | |
-> RealTime.RealTime | |
-> RealTime.RealTime |
Conceptually, all notes move together until they bump into each other. Or, they move without restriction, and then go to midway of the overlap. But the note's start is a hard lower or upper limit, so one note moving can never cause another note to move, it can just cause it to not move as much as it wanted.
TODO actually "half of the overlap" is not the same as "all move together".
For the latter, the overlap split depends on how far the note moved to get
there. So instead of overlap2 it's 'max 0 (overlap - n) 2', where n
is the imbalance between their move offsets.
TODO this is still broken if an offset causes an note to skip over another. But that should be stopped by the next event, right?
cancel_strong_weak :: (Score.Event -> [Score.Event] -> Score.Event) -> [Score.Event] -> Either Text [Score.Event] Source #
Merge notes with Flags.strong
and Flags.weak
. The rules are that
strong notes merge with weaker ones, in the order strong, normal, weak.
Previously I considered multiple weaks or strongs ambiguous, but it turns out I get multiple strongs with two hand strokes at the end of a block, and I might as well allow the rest too, for simplicity.
group_and_cancel :: Ord key => Cancel -> Key key -> RealTime.RealTime -> Events -> Either Text Events Source #
infer_duration_merged :: Score.Event -> [Score.Event] -> Score.Event Source #
Handle Flags.infer_duration
for notes merged together. This is the case
where a final note replaces a coincident initial note. The strong note gets
the duration of the longest weak notes, if there are any. If there are no
weaks, then there are no coincedent notes to merge, so return the event
unchanged so infer_duration_single
can handle it.