Karya, built on 2022-03-21T01:30:44 (patch 89d1651424c35e564138d93424a157ff87457245)
Safe HaskellSafe-Inferred



Repl cmds to deal with events.



stretch_to :: TrackTime -> Cmd.CmdL () Source #

Stretch events to fit in the given duration.

sel_dur :: Cmd.M m => m TrackTime Source #

Duration of the current selection, e.g. stretch_to =<< sel_dur.

find :: Text -> Cmd.CmdL [(Ui.Range, Text)] Source #

Find all events containing the given substring. Call with pp to get copy-pastable s codes.

replace :: Monad m => Text -> Text -> ModifyEvents.Track m Source #

Replace text on events. Call with ModifyEvents.all_blocks to replace it everywhere, or ModifyEvents.note_tracks for just note tracks.

replace_many :: Monad m => [(Text, Text)] -> ModifyEvents.Track m Source #

Multiple replacements. This is simultaneous replacement, so [(a, b), (b, a)] will swap a and b as expected.

upgrade_mridangam :: Cmd.M m => m () Source #

Upgrade thoppi on the right to thoppi on the left. Delete when I don't have any more scores like that.

replace_pattern :: Cmd.M m => ModifyEvents.Parser -> [ModifyEvents.Replacement] -> ModifyEvents.Track m Source #

Modify event text with ModifyEvents.substitute.

For example, to turn "si .5 .3" into ".3 | i .5":

ModifyEvents.control_tracks $
   LEvent.replace_pattern ("si"<>w<>w) [F 1, "| i", F 0]

w is a word, ws is >=0 words, ws1 is >=1 words, and a string matches literal text.

replace_regex :: Monad m => String -> ([Text] -> Text) -> ModifyEvents.Track m Source #

Modify event text with Regex.substituteGroups.

For example, to turn "si .5 .3" into ".3 | i .5":

ModifyEvents.control_tracks $ LEvent.replace_regex
   "si (\\W+) (\\W+)" (\[f0 f1] -> f1 <> " | i " <> f0)


data Mode Source #

Which end of the event to quantize.



quantize_sel :: Cmd.M m => Text -> m () Source #

quantize_timestep :: Ui.M m => Mode -> Text -> ModifyEvents.Track m Source #

Quantize to a TimeStep's duration. What this does is snap the edges of the event to the nearest timestep.

resolve_conflicts :: [TrackTime] -> [Event.Event] -> [Event.Event] Source #

Quantize can put two events in the same spot. Resolve the conflicts by bumping events back until they don't conflict. If I run out of timesteps, bump by 1.

quantize_event :: Mode -> [TrackTime] -> Event.Event -> ([TrackTime], Event.Event) Source #

Zero-duration events will remain zero duration, and not be affected by End quantization. Non-zero-duration events will never be quantized to zero duration.


insert :: Cmd.M m => [(ScoreTime, ScoreTime, Text)] -> m () Source #

Insert an event directly.