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

Derive.Eval

Description

Evaluate tracklang expressions.

Synopsis

# eval / apply

Apply a toplevel expression.

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.

## generator

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.

## transformer

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.

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

A list version of apply_transformer.

The same as eval_transformers, but get them out of a Quoted.

# lookup call

Arguments

 :: 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.

Create the symbol to call a given block.

True if this is a relative block call.

Make a block name relative to a parent block.

# util

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

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.

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

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.

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.

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

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

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

Arguments

 :: 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.