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

Derive.Call

Description

Utilities for calls.

The convention for calls is that there is a function c_something which is type NoteCall or ControlCall or whatever. It then extracts what is needed from the PassedArgs and passes those values to a function something which is of type NoteDeriver or ControlDeriver or whatever. The idea is that PassedArgs is a large dependency and it should be reduced immediately to what is needed.

Synopsis

# signals

To accomodate both normal calls, which are in score time, and post processing calls, which are in real time, these functions take RealTimes.

# function and signal

Convert a ControlRef to a control signal. If there is a BaseTypes.ControlFunction it will be ignored.

Arguments

 :: Typecheck.TransposeType -> BaseTypes.ControlRef -> Deriver (Typecheck.Function, Control) (signal, appropriate transpose control)

Version of to_function specialized for transpose signals. Throws if the signal had a non-transpose type.

Version of to_function that will complain if the control isn't a time type.

# dynamic

Unlike pitch_at, the transposition has already been applied.

Pitch without the transposition applied. You have to use this if you create an event with a pitch based on this pitch, otherwise the transposition will be applied twice.

Arguments

 :: (Pitch.Note -> Maybe Pitch.Pitch) Parse pitch function, as returned by get_pitch_functions. It's passed separately to avoid the overhead of calling get_pitch_functions multiple times. -> RealTime.RealTime -> Deriver Pitch.Pitch

Get the symbolic version of the transposed pitch. Since it's transposed, if you turn it back to a BaseTypes.Pitch, you should use with_transposed_pitch.

Replace the dynamic with the given one.

# parsing pitches

Get symbolic pitch manipulating functions for the current scale. This is for calls that want to work with symbolic pitches.

# note

Evaluate a Pitch.Pitch. It returns a transposed pitch since a Pitch.Pitch is assumed to have been transposed (e.g. get_parsed_pitch uses a transposed pitch so range calculation works).

Evaluate a symbolic pitch. Like eval_pitch, I assume the Note was Transposed, or at least should be an absolute pitch.

Generate a single note, from 0 to 1.

Like note, but the note reuses the Context, which means it will inherit the caller's start and duration as well as sub-tracks and thus may apply inversion.

This is appropriate when adding a wrapper around the default note call, but not if you don't want to be overridden by sub-tracks. See placed_note if you want to inherit the time, but not the rest.

Override the pitch signal and generate a single note.

Add an attribute and generate a single note.

A zero-duration note.

# transformer notes

Derive with transformed Attributes.

# random

class Random a where Source #

Get an infinite list of random numbers. These are deterministic in that they depend only on the random seed, but the random seed is hashed with each stack entry. So if you fix the random seed at a certain point, you should get consistent results below it.

It's a class because both Doubles and Ints are useful and I'd like to use the same function name for both.

Minimal complete definition

Methods

Infinite list of random numbers. These are deterministic in that they depend on the current track, current call position, and the random seed.

randoms_in :: a -> a -> Deriver [a] Source #

Infinite list of random numbers in the given range.

Instances

 # Methods # Methods

random_in :: (Random a, Real a) => a -> a -> Deriver a Source #

If the chance is 1, return true all the time, if it's 0.5, return it half of the time.

shuffle :: [a] -> Deriver [a] Source #

pick :: NonEmpty a -> Double -> a Source #

Like pick_weighted when all the weights are equal.

# time

real_duration :: (Internal.Time t1, Internal.Time t2) => t1 -> t2 -> Deriver RealTime.RealTime Source #

Get the real duration of time val at the given point in time. RealTime is linear, so 1 second is always 1 second no matter where it is, but ScoreTime will map to different amounts of RealTime depending on where it is.

score_duration :: (Internal.Time t1, Internal.Time t2) => t1 -> t2 -> Deriver ScoreTime.ScoreTime Source #

Like real_duration, but get the duration in ScoreTime. If you are manipulating deriver abstractly instead of directly emitting events then you will place them via Internal.at and family, which are in ScoreTime.

Arguments

 :: Internal.Time t => PassedArgs d -> t -> Deriver (RealTime.RealTime, RealTime.RealTime) (start, start+dur)

A time range from the event start until a given duration.

Arguments

 :: Internal.Time t => PassedArgs d -> t -> Deriver (RealTime.RealTime, RealTime.RealTime) (end-dur, end)

Like duration_from_start, but subtract a duration from the end.

This is real_duration, but takes a TypedVal.

## timestep

Arguments

 :: ScoreTime.ScoreTime -> TimeStep.TimeStep -> [Int] pick the first steps that return Just -> Deriver ScoreTime.ScoreTime

Take the given number of steps. Negative means step back.

Get the timestep duration from the given point. This tries first to step forward, and then back. This is because typically you use this to configure duration for a call, and it's confusing when the call stops working at the end of the block.

# general purpose types

data UpDown Source #

This is for arguments which can be high or low.

Constructors

 Up Down

Instances

 # Methods # MethodstoEnum :: Int -> UpDown #enumFrom :: UpDown -> [UpDown] #enumFromThen :: UpDown -> UpDown -> [UpDown] #enumFromTo :: UpDown -> UpDown -> [UpDown] #enumFromThenTo :: UpDown -> UpDown -> UpDown -> [UpDown] # # Methods(==) :: UpDown -> UpDown -> Bool #(/=) :: UpDown -> UpDown -> Bool # # Methods(<) :: UpDown -> UpDown -> Bool #(<=) :: UpDown -> UpDown -> Bool #(>) :: UpDown -> UpDown -> Bool #(>=) :: UpDown -> UpDown -> Bool #max :: UpDown -> UpDown -> UpDown #min :: UpDown -> UpDown -> UpDown # # MethodsshowsPrec :: Int -> UpDown -> ShowS #showList :: [UpDown] -> ShowS # # MethodsformatList :: [UpDown] -> Doc Source # # Methods # Methods # Methods