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

Derive.Score

Description

This has Score.Event, which is the main output of the deriver.

The events here are generated from UI Events, and will eventually be transformed into Perform Events, which are specific to the performance backend.

Synopsis

Event

data Event Source #

Constructors

Event 

Fields

  • event_start :: !RealTime
     
  • event_duration :: !RealTime
     
  • event_text :: !Text

    This is the text of the call that created the event. It's basically just for debugging.

  • event_integrate :: !Text

    If the event is integrated back to a Ui.Event, use this text. This is so calls can explicitly set how they would like their events to be integrated. Otherwise, Integrate.Convert will try to infer something.

  • event_pitch :: !DeriveT.PSignal
     
  • event_stack :: !Stack.Stack

    Keep track of where this event originally came from. That way, if an error or warning is emitted concerning this event, its position on the UI can be highlighted.

  • event_highlight :: !Color.Highlight
     
  • event_instrument :: !ScoreT.Instrument
     
  • event_environ :: !DeriveT.Environ
     
  • event_flags :: !Flags.Flags

    Flags have their own field rather than being in event_environ, this emphasizes that they're meant to be used by calls and not from the score.

  • event_delayed_args :: !(Map Text Dynamic.Dynamic)

    This has arguments passed from a call that applies an attribute to one which is meant to later realize the attribute. This happens when a call needs to be configured at the track level, but also needs some information only available later, such as the real start time or pitch of the next note. They are indexed by attribute because there may be multiple delayed calls on a single note, and the realize postproc may want to ignore some, e.g. if they are overidden by another attribute.

    I couldn't think of a type safe way to do this, but Dynamic should be safe enough if you use a shared type declaration in both writer and reader.

  • event_logs :: ![Log.Msg]

    Keep track of interesting things that have happened to this event. Postproc transforms that alter it should prefix a note.

Instances

Instances details
Monoid NoteDeriver Source # 
Instance details

Defined in Derive.Deriver.Monad

Semigroup NoteDeriver Source # 
Instance details

Defined in Derive.Deriver.Monad

Show Builtins Source # 
Instance details

Defined in Derive.Deriver.Monad

Show InstrumentCalls Source # 
Instance details

Defined in Derive.Deriver.Monad

Show Library Source # 
Instance details

Defined in Derive.Library

Show Event Source # 
Instance details

Defined in Derive.Score

Methods

showsPrec :: Int -> Event -> ShowS #

show :: Event -> String #

showList :: [Event] -> ShowS #

DeepSeq.NFData Event Source # 
Instance details

Defined in Derive.Score

Methods

rnf :: Event -> () #

Cacheable Event Source # 
Instance details

Defined in Derive.Cache

Taggable Note Source # 
Instance details

Defined in Derive.Deriver.Monad

ShowVal NoteDeriver Source #

This is an invalid instance, because a deriver has no literal syntax. But this lets me put a deriver in a defaulted argument, and get documentation for it.

Instance details

Defined in Derive.Deriver.Monad

Typecheck NoteDeriver Source # 
Instance details

Defined in Derive.Sig

Pretty.Pretty Event Source # 
Instance details

Defined in Derive.Score

Monoid (Stream Event) Source # 
Instance details

Defined in Derive.Stream

Semigroup (Stream Event) Source # 
Instance details

Defined in Derive.Stream

Callable (Generator Note) Source # 
Instance details

Defined in Derive.Deriver.Monad

Callable (TrackCall Note) Source # 
Instance details

Defined in Derive.Deriver.Monad

Callable (Transformer Note) Source # 
Instance details

Defined in Derive.Deriver.Monad

ToLibrary (Generator Note) Source # 
Instance details

Defined in Derive.Library

ToLibrary (TrackCall Note) Source # 
Instance details

Defined in Derive.Library

ToLibrary (Transformer Note) Source # 
Instance details

Defined in Derive.Library

short_event :: Event -> Text Source #

Format an event in a way suitable for including inline in log messages. It's short, but hopefully enough information to identify the event in question.

This is the derive equivalent to log_event.

event_min :: Event -> RealTime Source #

Get minimum and maximum edges of the event. event_start isn't necessarily the minimum because of negative durations.

event_max :: Event -> RealTime Source #

Get minimum and maximum edges of the event. event_start isn't necessarily the minimum because of negative durations.

copy :: Event -> Event Source #

If you use an event to create another event, call this to clear out data that shouldn't go with the copy.

normalize :: Event -> Event Source #

Apply environ and controls to pitches.

Normally this is done by Convert, but if you want to see an event for debugging it can be nicer to see the normalized version.

Unlike Perform.Midi.Convert, this doesn't trim the controls, so it applies out-of-range transpositions.

flags

logs

environ

modify_val :: EnvKey.Key -> (Maybe DeriveT.Val -> DeriveT.Val) -> Event -> Event Source #

Modify the value at the given key.

attributes

delayed args

take_arg :: Typeable.Typeable a => Text -> Event -> Either Text (Event, Maybe a) Source #

Find an arg in event_delayed_args, and remove it from the event if it existed. Throw an error if it existed but had an unexpected type.

modify events

move :: (RealTime -> RealTime) -> Event -> Event Source #

Change the start time of an event and move its controls along with it.

set_instrument :: ScoreT.Instrument -> DeriveT.Environ -> Event -> Event Source #

Set the instrument on an event, and also update its environ from the instrument. You should really rederive with the new instrument, but this way can be more convenient, if somewhat sketchy.

control

control_at :: RealTime -> ScoreT.Control -> Event -> Maybe (ScoreT.Typed Signal.Y) Source #

Get a control value from the event, or Nothing if that control isn't present.

modify_dynamic :: (Signal.Y -> Signal.Y) -> Event -> Event Source #

Use this instead of modify_control_vals because it also sets EnvKey.dynamic_val. This is only valid for linear functions like (+) or (*).

set_dynamic :: Signal.Y -> Event -> Event Source #

Use this instead of set_control because it also sets EnvKey.dynamic_val.

modify_signal :: ScoreT.Control -> (Signal.Control -> Signal.Control) -> Event -> Event Source #

Like modify_control, but default to an empty control and retain any type the original had.

pitch

transposed_at :: RealTime -> Event -> Maybe DeriveT.Transposed Source #

Unlike pitch_at, the transposition has already been applied. This is because callers expect to get the actual pitch, not the pitch plus some homework to do on the pitch. If you use this pitch to emit another pitch you proabbly need the raw pitch, but so far everyone doing that is at the Derive level, not postproc, so they use Derive.pitch_at.