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

Safe HaskellNone




Calls for Carnatic gamakam.



begin_module :: Module.Module Source #

Calls in these modules are meant to be used via the sequence call, so they are only in scope under the relevant phase.

middle_module :: Module.Module Source #

Calls in these modules are meant to be used via the sequence call, so they are only in scope under the relevant phase.

end_module :: Module.Module Source #

Calls in these modules are meant to be used via the sequence call, so they are only in scope under the relevant phase.

begin_aliases :: [(Expr.Symbol, Generator Pitch)] Source #

I don't want to take up short names for the whole track scope, but within a sequence call it seems reasonable. In addition, I know if it's a begin or end call, and use the same name for logically similar things.

alias_prefix :: Text -> Text -> [(Expr.Symbol, call)] -> [(Expr.Symbol, call)] Source #

fade_out_call :: Expr.Symbol Source #

Special behaviour documented in sequence_doc.

fade_in_call :: Expr.Symbol Source #

Unlike fade_out_call, this doesn't need special treatment.


sequence_calls :: Context Pitch -> (ScoreTime, ScoreTime) -> Expr -> [Expr] -> Maybe Expr -> Deriver Signals Source #

I assume that start and end calls have a fixed duration and don't stretch to fill the given space, though they will shrink if necessary. So I evaluate start and end to get their durations, and fit the middle calls into the remaining space, evenly divided.

Actually, there's a circular problem in that I don't know how long the middle section can be until I know how long the end call is, but the end call likely relies on ctx_prev_val, so it has to be evaluated after the middle. So I evaluate the end twice, once before the middle to find out its length, and again after evaluating the middle to get the pitch right.

I considered a specially calling mode where calls could return their desired duration rather than a signal, but it seems much simpler to just have them do that by returning the signal itself and measuring that.

A possibly useful extension would be to allow middle calls to be shorter than their allotted time, for instance a trill might want to complete a cycle and allow a flat call to take up remaining space. I could put the requested time in Derive.real 1 and the hard limit in Args.next, but that wouldn't allow time before the call to stretch, only time after. But I could indicate stretchiness with a special tag on the call.

eval_end :: ScoreTime -> ScoreTime -> ScoreTime -> Expr -> SequenceM Signals Source #

Special behaviour for the fade-out call, as documented in sequence_doc.

type SequenceM = StateT (Context Pitch) Deriver Source #

I need to thread Derive.ctx_prev_val from each call in the sequence.

sequence_middles :: ScoreTime -> ScoreTime -> [Expr] -> SequenceM Signals Source #

Give each middle call an even division of the time left. The call can use less time if it wishes, and the remaining time will be divided among the remaining middle calls. It shouldn't use more time, because then it could overlap with the end call, or go past the end of the note.


data Expr Source #


EvaluatedExpr Expr.Symbol [BaseTypes.Val]

This is a call which was embedded in the argument list of the sequence call, so its arguments have already been evaluated.

QuotedExpr !BaseTypes.Expr

A call and its arguments can be protected from evaluation by quoting it. This is also necessary to use a transformer, since ; has higher precedence than | (actually it's just a value, not an operator).


parse_sequence :: [BaseTypes.Val] -> (Expr, [Expr], Maybe Expr) Source #

Parse the sequence call's arguments and substitute aliases. If there is no begin, set-pitch will be added, and if there is no middle, - will be added. This is so that if there is just an end call, there will still be a signal from the beginning of the note.

The positions are inferred according to the number of sections:

; middle1;
begin1; middle2
begin1; middle2; middle3; ...; end_n


data Fade Source #




Eq Fade # 


(==) :: Fade -> Fade -> Bool #

(/=) :: Fade -> Fade -> Bool #

Show Fade # 


showsPrec :: Int -> Fade -> ShowS #

show :: Fade -> String #

showList :: [Fade] -> ShowS #

get_end :: RealTime.RealTime -> BaseTypes.Duration -> PassedArgs a -> Deriver RealTime.RealTime Source #

Get the end time, given a start and a duration. Don't go beyond the maximum, which is the event's duration, if given explicitly, or the next event if it's 0.



data KampitaArgs Source #


Kampita0 !Signal.Y !Signal.Y

Both interval arguments are hardcoded.

Kampita1 !Signal.Y

The starting pitch is hardcoded.


Both arguments must be provided.


trill_from_transitions :: Typecheck.Function -> Typecheck.Function -> [RealTime.RealTime] -> Signal.Control Source #

Make a trill signal from a list of transition times.


align_to_end :: RealTime.RealTime -> RealTime.RealTime -> BaseTypes.Duration -> Deriver RealTime.RealTime Source #

Subtract the duration from the given end time, but don't go past the start.



prev_pitch :: RealTime.RealTime -> PitchArgs -> Deriver BaseTypes.Pitch Source #

This defaults to the note's base pitch, in case this call is the first one. Also, the end call is called before the middle calls to find out how long it is.

optional_pitch :: Maybe PitchUtil.PitchOrTranspose -> BaseTypes.Pitch -> BaseTypes.Pitch Source #

A number of calls take an optional pitch, and default to either the current or previous pitch.