Safe Haskell | Safe-Inferred |
---|
Calls for Carnatic gamakam.
Synopsis
- module_ :: Module.Module
- begin_module :: Module.Module
- middle_module :: Module.Module
- end_module :: Module.Module
- library :: Library.Library
- begin_calls :: [(Expr.Symbol, Generator Pitch)]
- begin_aliases :: [(Expr.Symbol, Generator Pitch)]
- middle_calls :: [(Expr.Symbol, Generator Pitch)]
- kampita_variations :: Text -> (Maybe Trill.Direction -> call) -> [(Expr.Symbol, call)]
- middle_aliases :: [(Expr.Symbol, Generator Pitch)]
- alias_prefix :: Text -> Text -> [(Expr.Symbol, call)] -> [(Expr.Symbol, call)]
- end_calls :: [(Expr.Symbol, Generator Pitch)]
- end_aliases :: [(Expr.Symbol, Generator Pitch)]
- fade_out_call :: Expr.Symbol
- fade_in_call :: Expr.Symbol
- c_sequence :: Generator Note
- c_sequence_transform :: Transformer Note
- sequence_doc :: Doc.Doc
- with_sequence :: PassedArgs Score.Event -> Deriver a -> Deriver a
- pitch_context :: Context Score.Event -> Context Pitch
- type Signals = (DeriveT.PSignal, [ControlMod])
- sequence_calls :: Context Pitch -> (ScoreTime, ScoreTime) -> Expr -> [Expr] -> Maybe Expr -> Deriver Signals
- eval_end :: ScoreTime -> ScoreTime -> ScoreTime -> Expr -> SequenceM Signals
- type SequenceM = Monad.State.StateT (Context Pitch) Deriver
- detached :: SequenceM a -> SequenceM a
- sequence_middles :: ScoreTime -> ScoreTime -> [Expr] -> SequenceM Signals
- signal_start :: ScoreTime -> DeriveT.PSignal -> Deriver ScoreTime
- signal_end :: ScoreTime -> DeriveT.PSignal -> Deriver ScoreTime
- eval :: Module.Module -> ScoreTime -> ScoreTime -> Expr -> SequenceM Signals
- place_event :: ScoreTime -> ScoreTime -> Context d -> Context d
- eval_expr :: CallableExpr d => Context d -> Expr -> Deriver (Stream.Stream d)
- with_empty_collect :: Deriver a -> Deriver (a, [ControlMod])
- data Expr
- parse_sequence :: [DeriveT.Val] -> (Expr, [Expr], Maybe Expr)
- c_flat_start :: Generator Pitch
- c_set_pitch :: Generator Pitch
- data PitchFrom
- data Fade
- c_from :: PitchFrom -> Fade -> Generator Pitch
- get_end :: RealTime.RealTime -> DeriveT.Duration -> PassedArgs a -> Deriver RealTime.RealTime
- c_jaru :: Bool -> Generator Pitch
- jaru :: ControlUtil.Curve -> RealTime.RealTime -> RealTime.RealTime -> RealTime.RealTime -> RealTime.RealTime -> [Signal.Y] -> Signal.Control
- c_flat :: Generator Pitch
- data KampitaArgs
- c_kampita :: Doc.Doc -> KampitaArgs -> Maybe Trill.Direction -> Generator Pitch
- c_nkampita :: Doc.Doc -> KampitaArgs -> Maybe Trill.Direction -> Generator Pitch
- resolve_pitches :: KampitaArgs -> (Typecheck.NnTransposeFunctionT, Typecheck.NnTransposeFunctionT) -> Deriver ((ScoreT.Function, ScoreT.Function), ScoreT.Control)
- kampita_pitch_args :: KampitaArgs -> Sig.Parser (Typecheck.NnTransposeFunctionT, Typecheck.NnTransposeFunctionT)
- kampita_env :: Sig.Parser (RealTime.RealTime, DeriveT.Duration, Double, Trill.Adjust)
- default_transition :: Typecheck.DefaultReal
- default_transition_ :: RealTime.RealTime
- kampita :: RealTime.RealTime -> PitchArgs -> ScoreT.Control -> Signal.Control -> Deriver DeriveT.PSignal
- kampita_transpose :: ControlUtil.Curve -> Maybe Bool -> Trill.Adjust -> (ScoreT.Function, ScoreT.Function) -> Typecheck.RealTimeFunctionT -> RealTime.RealTime -> DeriveT.Duration -> Double -> (ScoreTime, ScoreTime) -> Deriver Signal.Control
- smooth_trill :: ControlUtil.Curve -> RealTime.RealTime -> ScoreT.Function -> ScoreT.Function -> [RealTime.RealTime] -> Deriver Signal.Control
- trill_from_transitions :: ScoreT.Function -> ScoreT.Function -> [RealTime.RealTime] -> [(RealTime.RealTime, Signal.Y)]
- trill_transitions :: Maybe Bool -> Trill.Adjust -> Double -> ScoreTime -> Typecheck.RealTimeFunctionT -> (ScoreTime, ScoreTime) -> Deriver [RealTime.RealTime]
- end_wants_even_transitions :: RealTime.RealTime -> (ScoreT.Function, ScoreT.Function) -> Maybe Trill.Direction -> Maybe Bool
- c_flat_end :: Generator Pitch
- c_to :: Fade -> Generator Pitch
- c_fade :: Bool -> Generator Pitch
- align_to_end :: RealTime.RealTime -> RealTime.RealTime -> DeriveT.Duration -> Deriver RealTime.RealTime
- c_sahitya :: Taggable a => Transformer a
- prev_pitch :: RealTime.RealTime -> PitchArgs -> Deriver DeriveT.Pitch
- resolve_pitch :: PitchArgs -> DeriveT.Pitch -> Maybe PitchUtil.PitchOrTranspose -> DeriveT.Pitch
- optional_pitch :: Maybe PitchUtil.PitchOrTranspose -> DeriveT.Pitch -> DeriveT.Pitch
- generator1 :: CallName -> Tags.Tags -> Doc.Doc -> WithArgDoc (PassedArgs d -> Deriver d) -> Call (GeneratorFunc d)
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_calls :: [(Expr.Symbol, Generator Pitch)] Source #
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.
middle_calls :: [(Expr.Symbol, Generator Pitch)] Source #
kampita_variations :: Text -> (Maybe Trill.Direction -> call) -> [(Expr.Symbol, call)] Source #
middle_aliases :: [(Expr.Symbol, Generator Pitch)] Source #
alias_prefix :: Text -> Text -> [(Expr.Symbol, call)] -> [(Expr.Symbol, call)] Source #
end_aliases :: [(Expr.Symbol, Generator Pitch)] 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
with_sequence :: PassedArgs Score.Event -> Deriver a -> Deriver a Source #
type Signals = (DeriveT.PSignal, [ControlMod]) Source #
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.
signal_start :: ScoreTime -> DeriveT.PSignal -> Deriver ScoreTime Source #
signal_end :: ScoreTime -> DeriveT.PSignal -> Deriver ScoreTime Source #
eval_expr :: CallableExpr d => Context d -> Expr -> Deriver (Stream.Stream d) Source #
with_empty_collect :: Deriver a -> Deriver (a, [ControlMod]) Source #
parse
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 |
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
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.
jaru :: ControlUtil.Curve -> RealTime.RealTime -> RealTime.RealTime -> RealTime.RealTime -> RealTime.RealTime -> [Signal.Y] -> Signal.Control Source #
middle
kampita
data KampitaArgs Source #
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
Show KampitaArgs Source # | |
Defined in Derive.C.India.Gamakam2 showsPrec :: Int -> KampitaArgs -> ShowS # show :: KampitaArgs -> String # showList :: [KampitaArgs] -> ShowS # |
c_kampita :: Doc.Doc -> KampitaArgs -> Maybe Trill.Direction -> Generator Pitch Source #
c_nkampita :: Doc.Doc -> KampitaArgs -> Maybe Trill.Direction -> Generator Pitch Source #
implementation
resolve_pitches :: KampitaArgs -> (Typecheck.NnTransposeFunctionT, Typecheck.NnTransposeFunctionT) -> Deriver ((ScoreT.Function, ScoreT.Function), ScoreT.Control) Source #
kampita_pitch_args :: KampitaArgs -> Sig.Parser (Typecheck.NnTransposeFunctionT, Typecheck.NnTransposeFunctionT) Source #
kampita :: RealTime.RealTime -> PitchArgs -> ScoreT.Control -> Signal.Control -> Deriver DeriveT.PSignal Source #
kampita_transpose :: ControlUtil.Curve -> Maybe Bool -> Trill.Adjust -> (ScoreT.Function, ScoreT.Function) -> Typecheck.RealTimeFunctionT -> RealTime.RealTime -> DeriveT.Duration -> Double -> (ScoreTime, ScoreTime) -> Deriver Signal.Control Source #
You don't think there are too many arguments, do you?
smooth_trill :: ControlUtil.Curve -> RealTime.RealTime -> ScoreT.Function -> ScoreT.Function -> [RealTime.RealTime] -> Deriver Signal.Control Source #
trill_from_transitions :: ScoreT.Function -> ScoreT.Function -> [RealTime.RealTime] -> [(RealTime.RealTime, Signal.Y)] Source #
Make a trill signal from a list of transition times.
trill_transitions :: Maybe Bool -> Trill.Adjust -> Double -> ScoreTime -> Typecheck.RealTimeFunctionT -> (ScoreTime, ScoreTime) -> Deriver [RealTime.RealTime] Source #
end_wants_even_transitions :: RealTime.RealTime -> (ScoreT.Function, ScoreT.Function) -> Maybe Trill.Direction -> Maybe Bool Source #
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
c_sahitya :: Taggable a => Transformer a Source #
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.
resolve_pitch :: PitchArgs -> DeriveT.Pitch -> Maybe PitchUtil.PitchOrTranspose -> DeriveT.Pitch Source #
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.
generator1 :: CallName -> Tags.Tags -> Doc.Doc -> WithArgDoc (PassedArgs d -> Deriver d) -> Call (GeneratorFunc d) Source #