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

Derive.C.India.Gamakam2

Description

Calls for Carnatic gamakam.

Synopsis

Documentation

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

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 = Monad.State.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.

parse

data Expr Source #

Constructors

EvaluatedExpr Expr.Symbol [DeriveT.Val]

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

QuotedExpr !DeriveT.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).

Instances

Instances details
Show Expr Source # 
Instance details

Defined in Derive.C.India.Gamakam2

Methods

showsPrec :: Int -> Expr -> ShowS #

show :: Expr -> String #

showList :: [Expr] -> ShowS #

Pretty.Pretty Expr Source # 
Instance details

Defined in Derive.C.India.Gamakam2

parse_sequence :: [DeriveT.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

start

data PitchFrom Source #

Instances

Instances details
Show PitchFrom Source # 
Instance details

Defined in Derive.C.India.Gamakam2

Eq PitchFrom Source # 
Instance details

Defined in Derive.C.India.Gamakam2

data Fade Source #

Constructors

Fade 
NoFade 

Instances

Instances details
Show Fade Source # 
Instance details

Defined in Derive.C.India.Gamakam2

Methods

showsPrec :: Int -> Fade -> ShowS #

show :: Fade -> String #

showList :: [Fade] -> ShowS #

Eq Fade Source # 
Instance details

Defined in Derive.C.India.Gamakam2

Methods

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

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

get_end :: RealTime.RealTime -> DeriveT.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.

middle

kampita

data KampitaArgs Source #

Constructors

Kampita0 !Signal.Y !Signal.Y

Both interval arguments are hardcoded.

Kampita1 !Signal.Y

The starting pitch is hardcoded.

Kampita2

Both arguments must be provided.

Instances

Instances details
Show KampitaArgs Source # 
Instance details

Defined in Derive.C.India.Gamakam2

implementation

trill_from_transitions :: ScoreT.Function -> ScoreT.Function -> [RealTime.RealTime] -> [(RealTime.RealTime, Signal.Y)] Source #

Make a trill signal from a list of transition times.

end

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

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

misc

util

prev_pitch :: RealTime.RealTime -> PitchArgs -> Deriver DeriveT.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 -> DeriveT.Pitch -> DeriveT.Pitch Source #

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