Karya, built on Mon Jul 24 11:39:07 PDT 2017 (patch 33511aca01257b76b88de7c7a2763b7a965c084e)

Derive.Call.Sub

Contents

Description

This is the basic interface for slicing. This also includes inverting, which is a special case of slicing.

Synopsis

# inversion

Cause this transformer to apply only after inversion. under_invert documents this, also see NOTE [under-invert].

Normally when a call is inverted, the transformers run outside the inversion, while only the generator runs underneath. However, some transformers rely on per-note controls, such as pitch and dyn, and therefore need to go under the invert. So this saves the transformer, and applies it only after all the inversion has happened.

If there are no sub-tracks, then inversion won't happen, and the transform is run right here. However, if there are sub-tracks, but the generator doesn't want to run, then the transform will be lost.

TODO I could probably fix it by making Eval.eval_generator apply the transform, but it would have to clear it out too to avoid evaluating more than once. Not sure which way is right.

inverting :: Taggable d => (PassedArgs d -> NoteDeriver) -> PassedArgs d -> NoteDeriver Source #

Convert a call into an inverting call. This is designed to be convenient to insert after the signature arg in a call definition. The args passed to the call have been stripped of their sub tracks to avoid another inversion.

inverting_args :: Taggable d => PassedArgs d -> (PassedArgs d -> NoteDeriver) -> NoteDeriver Source #

inverting with its arguments flipped. This is useful for calls that want to do stuff with the args before inverting. Make sure to shadow the old PassedArgs with the ones passed to the call, for the reason documented in inverting.

## events

Sliced sub-events are represented as a start, duration, and opaque deriver. This is a compromise between a plain NoteDeriver, which is fully abstract but also fully opaque, and some kind of note data structure, which is fully concrete (and thus inflexible), but also transparent to modification.

data GenericEvent a Source #

Constructors

 Event Fieldsevent_start :: !ScoreTime event_duration :: !ScoreTime event_note :: !a

Instances

 # Methodsfmap :: (a -> b) -> GenericEvent a -> GenericEvent b #(<\$) :: a -> GenericEvent b -> GenericEvent a # Show a => Show (GenericEvent a) # MethodsshowsPrec :: Int -> GenericEvent a -> ShowS #show :: GenericEvent a -> String #showList :: [GenericEvent a] -> ShowS # Pretty a => Pretty (GenericEvent a) # MethodsformatList :: [GenericEvent a] -> Doc Source #

sub_events :: PassedArgs d -> Deriver [[Event]] Source #

Get the Events of subtracks, if any, returning one list of events per sub note track. This is the top-level utility for note calls that take other note calls as arguments.

Like sub_events, but exclude events at the start time, and include events at the end time. Presumably suitable for Event.Negative calls.

Modify the text of sub note tracks before deriving them. This can be used to implement an ad-hoc new language.

derive :: [Event] -> NoteDeriver Source #

Derive and merge Events.

Get the pitch of an Event. Useful for debugging.

Arguments

 :: (ScoreTime, ScoreTime) fit this range -> (ScoreTime, ScoreTime) into this range -> [Event] -> NoteDeriver

Re-fit the events from one range to another.

## RestEvent

A Nothing represents a rest.

Arguments

 :: Bool end bias -> Bool if True, include the trailing gap as a rest -> PassedArgs d -> Deriver [[RestEvent]]

This is like sub_events, but gaps between the events are returned as explicit rests.

fit_rests :: (ScoreTime, ScoreTime) -> (ScoreTime, ScoreTime) -> [RestEvent] -> NoteDeriver Source #

fit for RestEvents.

# reapply

Call a note parent with sub-events. While you can easily call other kinds of calls with Eval.reapply, note parents are more tricky because they expect a track structure in ctx_sub_tracks. This bypasses that and directly passes Events to the note parent, courtesy of ctx_sub_events.