Karya, built on 2023-08-29T07:47:28 (patch 7a412d5d6ba4968ca4155ef276a062ccdeb9109a)
Safe HaskellSafe-Inferred

Cmd.Repl.LEvent

Description

Repl cmds to deal with events.

Synopsis

Documentation

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)

quantize

data Mode Source #

Which end of the event to quantize.

Constructors

Start 
End 
Both 

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

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

Insert an event directly.