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

Safe HaskellNone




Evaluate tracklang expressions.


eval / apply

eval_toplevel :: Callable d => Context d -> BaseTypes.Expr -> Deriver (Stream.Stream d) Source #

Apply a toplevel expression.

eval_quoted_normalized :: Callable d => Context d -> BaseTypes.Quoted -> Deriver (Stream.Stream d) Source #

This is like eval_quoted, except that the ctx_event is set to (0, 1) normalized time. This is important if you want to place the resulting deriver. Otherwise, you can use eval_quoted and the event's position will fall through to the callee.

TODO this awkwardness is because events evaluate in track time, not in normalized time. Details in Derive.EvalTrack.


apply_generator :: Callable d => Context d -> Generator d -> [BaseTypes.Val] -> Deriver (Stream.Stream d) Source #

Like eval_generator, but for when the args are already parsed and evaluated. This is useful when one generator wants to dispatch to another.


eval_transform_expr :: Callable d => Text -> Text -> Deriver (Stream.Stream d) -> Deriver (Stream.Stream d) Source #

Parse and apply a transformer expression.

apply_transformer :: Callable d => Context d -> Transformer d -> [BaseTypes.Val] -> Deriver (Stream.Stream d) -> Deriver (Stream.Stream d) Source #

The transformer version of apply_generator. Like eval_transformers, but apply only one, and apply to already evaluated BaseTypes.Vals. This is useful when you want to re-apply an already parsed set of vals.

val calls

lookup call

call_to_block_id Source #


:: Id.Namespace 
-> Maybe Id.BlockId

If the symbol starts with -, this block is prepended to it.

-> Expr.Symbol 
-> Maybe Id.BlockId 

Given a Symbol, try to come up with the BlockId of the block it could be a call for.

block_id_to_call :: Bool -> Id.BlockId -> Id.BlockId -> Text Source #

Create the symbol to call a given block.

is_relative :: Expr.Symbol -> Bool Source #

True if this is a relative block call.

make_relative :: Id.BlockId -> Text -> Text Source #

Make a block name relative to a parent block.


eval_one :: Callable d => Bool -> BaseTypes.Expr -> Deriver (Stream.Stream d) Source #

Evaluate a single note as a generator. Fake up an event with no prev or next lists.

eval_event :: Callable d => Event.Event -> Deriver (Either Text (Stream.Stream d)) Source #

Like derive_event but evaluate the event outside of its track context. This is useful if you want to evaluate things out of order, i.e. evaluate the next pitch.

reapply_generator :: Callable d => PassedArgs d -> Expr.Symbol -> Deriver (Stream.Stream d) Source #

Evaluate a generator, reusing the passed args but replacing the Symbol. Generators can use this to delegate to other generators.

reapply_generator_normalized :: Callable d => PassedArgs d -> Expr.Symbol -> Deriver (Stream.Stream d) Source #

Like reapply_generator, but the note is given normalized time, 0--1, instead of inheriting the start and duration from the args. This is essential if you want to shift or stretch the note.

reapply :: Callable d => Context d -> BaseTypes.Expr -> Deriver (Stream.Stream d) Source #

Apply an expr with an explicit Context. You can use this to reuse the current call's Context, but be careful because it will also inherit the ctx_sub_tracks, which means if inversion hasn't happened yet, which may be what you or may be surprising. For instance, it will likely override any pitch you try to set.

reapply_string :: Callable d => Context d -> Text -> Deriver (Stream.Stream d) Source #

Like reapply, but parse the string first.

eval_pitch :: ScoreTime -> BaseTypes.PitchCall -> Deriver (BaseTypes.RawPitch a) Source #

A version of eval specialized to evaluate pitch calls. It's unknown if this pitch has been transposed or not.

eval_note :: Scale -> Pitch.Note -> Deriver (BaseTypes.RawPitch a) Source #

Get a Pitch from in a given scale. Like eval_pitch, it's unknown if this pitch has been transposed or not.

apply_pitch :: ScoreTime -> ValCall -> Deriver (BaseTypes.RawPitch a) Source #

This is like eval_pitch when you already know the call, presumably because you asked scale_note_to_call.

eval_expr Source #


:: Callable d 
=> Bool

See catch. This should be True for evals that generate notes for eventual output.

-> Context d 
-> BaseTypes.Expr 
-> Deriver (Stream.Stream d) 

Evaluate a single expression, catching an exception if it throws.