Karya, built on 2018-05-31T02:46:59 (patch 0a1a35479c514820d77330ae8a978975ba22a47a)

Safe HaskellNone



Slicing is chopping the block horizontally, so that the horizontal chunks can act like their own little blocks.

For the sake of convenient notation, this is done in several places.

  1. A note with subtracks will slice out the subevents within its range. This allows a note to take another note (or notes) as arguments, e.g. a tuplet. This is what slice_notes is for.
  2. A note with controls as subtracks can invert itself so it has control over the evaluation of the controls. Documented further in Derive.Call.Note.
  3. #1 above is a convenient way to apply a transformation to multiple notes: group the tracks under another, and put the transformations in the parent. However, notes that have no transformation (aka orphans) must be extracted from underneath the empty parent, otherwise they will not be evaluated at all. This is done by derive_note_track.

This is a nasty tricky bit of work, but is depended on by all the high level notation, e.g. calls that can manipulate the results of other calls, aka parent calls. I'd still love to figure out a better way to do it though!



data InsertEvent Source #

Ask slice to synthesize a note track and insert it at the leaves of the sliced tree.




  • event_duration :: !ScoreTime
  • event_orientation :: !Types.Orientation

    A Negative orientation means that the controls at the Event.end time are not trimmed off.

  • event_around :: !([Event.Event], [Event.Event])
  • event_track_id :: !(Maybe TrackId)

    The TrackId for the track created for this event. This is required so it can collect a TrackDynamic and when the Cmd level looks at at track with inverted note calls, it sees the environ established by the tracks that the calls are inverted beneath. E.g., if the pitch track sets a scale, the Cmd layer should see the note track as having that scale.

Show InsertEvent # 
Instance details

Defined in Derive.Slice

slice Source #


:: Bool

Omit events than begin at the start. slice_notes documents why this is necessary.

-> ScoreTime 
-> ScoreTime 
-> Maybe InsertEvent

If given, insert an event at the bottom with the given text and dur. The created track will have the given track_range, so it can create a Stack.Region entry.

-> TrackTree.EventsNode 
-> TrackTree.EventsNode 

Slice a track between start and end, and optionally put a note track with a single event of given string at the bottom. Sliced control tracks usually get events beyond the slice boundaries for context.

checked_slice_notes Source #


:: Bool

TODO change this to Event.Orientation?

-> ScoreTime 
-> ScoreTime 
-> TrackTree.EventsTree 
-> Either Text [[Note]] 

This is slice_notes, but throw an error if find_overlapping complains.

TODO I think I don't want to allow sub-events larger than their slice, but currently I do. Actually I think overlap checking needs an overhaul in general.

slice_orphans :: Bool -> ScoreTime -> ScoreTime -> [TrackTree.EventsNode] -> Either Text [TrackTree.EventsNode] Source #

This is a variant of slice used by note track evaluation to derive orphan events.