Karya, built on 2020-11-26T21:03:17 (patch 23b5be2d53a9e8e7d6136cda5aae2849abe5cded)
Safe HaskellNone

Solkattu.Dsl.Notation

Description

Generic combinators for solkattu patterns. Because these are expected to be called as part of the DSL, impure exceptions are allowed, via Solkattu.throw.

This is meant to have just Sequence manipulation, without instrument-specific functions.

Synopsis

Documentation

type SequenceT sollu = [NoteT sollu] Source #

This is the same as SequenceT.

rests

class Rest a where Source #

Methods

__ :: a Source #

Instances

Instances details
Rest (Solkattu.Note sollu) # 
Instance details

Defined in Solkattu.Dsl.Notation

Methods

__ :: Solkattu.Note sollu Source #

Rest (Realize.SNote sollu) # 
Instance details

Defined in Solkattu.Dsl.Notation

Methods

__ :: Realize.SNote sollu Source #

Rest (SequenceT sollu) # 
Instance details

Defined in Solkattu.Dsl.Notation

Methods

__ :: SequenceT sollu Source #

__2 :: SequenceT sollu Source #

These are meant to suffix a sollu. Since the sollu is considered part of the duration, the number is one higher than the number of rests. E.g. din.__3 is a 3 count, and equivalent to din... __M is the version that doesn't do this.

__3 :: SequenceT sollu Source #

These are meant to suffix a sollu. Since the sollu is considered part of the duration, the number is one higher than the number of rests. E.g. din.__3 is a 3 count, and equivalent to din... __M is the version that doesn't do this.

__4 :: SequenceT sollu Source #

These are meant to suffix a sollu. Since the sollu is considered part of the duration, the number is one higher than the number of rests. E.g. din.__3 is a 3 count, and equivalent to din... __M is the version that doesn't do this.

__5 :: SequenceT sollu Source #

These are meant to suffix a sollu. Since the sollu is considered part of the duration, the number is one higher than the number of rests. E.g. din.__3 is a 3 count, and equivalent to din... __M is the version that doesn't do this.

__6 :: SequenceT sollu Source #

These are meant to suffix a sollu. Since the sollu is considered part of the duration, the number is one higher than the number of rests. E.g. din.__3 is a 3 count, and equivalent to din... __M is the version that doesn't do this.

__7 :: SequenceT sollu Source #

These are meant to suffix a sollu. Since the sollu is considered part of the duration, the number is one higher than the number of rests. E.g. din.__3 is a 3 count, and equivalent to din... __M is the version that doesn't do this.

__8 :: SequenceT sollu Source #

These are meant to suffix a sollu. Since the sollu is considered part of the duration, the number is one higher than the number of rests. E.g. din.__3 is a 3 count, and equivalent to din... __M is the version that doesn't do this.

__9 :: SequenceT sollu Source #

These are meant to suffix a sollu. Since the sollu is considered part of the duration, the number is one higher than the number of rests. E.g. din.__3 is a 3 count, and equivalent to din... __M is the version that doesn't do this.

by FMatra

dropM :: (CallStack.Stack, Pretty sollu) => S.FMatra -> SequenceT sollu -> SequenceT sollu Source #

dropM_ :: (CallStack.Stack, Pretty sollu) => S.FMatra -> SequenceT sollu -> SequenceT sollu Source #

takeM :: (CallStack.Stack, Pretty sollu) => S.FMatra -> SequenceT sollu -> SequenceT sollu Source #

splitM :: (CallStack.Stack, Pretty sollu) => S.FMatra -> SequenceT sollu -> (SequenceT sollu, SequenceT sollu) Source #

Like splitM_, but mark the sequences as groups. This way they remember the sollus which were dropped, and realize using the complete sequence, not the fragment.

TODO the class constraints are unnecessary, but if I want to verify eagerly I'll need them back.

splitM_ :: (CallStack.Stack, Pretty sollu) => S.FMatra -> SequenceT sollu -> (SequenceT sollu, SequenceT sollu) Source #

Split the sequence at the given FMatra. Unlike splitM, this directly splits the sequence, it doesn't create a group.

splitM_either :: Pretty sollu => S.FMatra -> SequenceT sollu -> Either Text (SequenceT sollu, SequenceT sollu) Source #

rdropM :: (CallStack.Stack, Pretty sollu) => S.FMatra -> SequenceT sollu -> SequenceT sollu Source #

rtakeM :: (CallStack.Stack, Pretty sollu) => S.FMatra -> SequenceT sollu -> SequenceT sollu Source #

by Duration

dropD :: (CallStack.Stack, Pretty sollu) => S.Duration -> SequenceT sollu -> SequenceT sollu Source #

Duration-using variants of the matra functions. These are only valid at the top level, in S.defaultTempo. TODO require Tempo arg?

rdropD :: (CallStack.Stack, Pretty sollu) => S.Duration -> SequenceT sollu -> SequenceT sollu Source #

Duration-using variants of the matra functions. These are only valid at the top level, in S.defaultTempo. TODO require Tempo arg?

takeD :: (CallStack.Stack, Pretty sollu) => S.Duration -> SequenceT sollu -> SequenceT sollu Source #

Duration-using variants of the matra functions. These are only valid at the top level, in S.defaultTempo. TODO require Tempo arg?

rtakeD :: (CallStack.Stack, Pretty sollu) => S.Duration -> SequenceT sollu -> SequenceT sollu Source #

Duration-using variants of the matra functions. These are only valid at the top level, in S.defaultTempo. TODO require Tempo arg?

structures

sandi :: (CallStack.Stack, Pretty sollu) => SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #

Drop sollus equal in length to some others. This is intenedd for repeated sequences that get elided away, e.g. tri p7 . sandi p7 (p7.p6.p5).

I considered an annotation that automatically drops stuff from before which matches stuff afterwards, but it seemed more complicated and less reliable than just dropping explicitly.

tri :: SequenceT sollu -> SequenceT sollu Source #

Repeat thrice, with no karvai.

tri_ :: SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #

Repeat thrice, with the given separator. The _nomid variant doesn't add the mid tag, which is useful for nested calls.

tri_nomid :: SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #

Repeat thrice, with the given separator. The _nomid variant doesn't add the mid tag, which is useful for nested calls.

tri123 :: SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #

trin :: SequenceT sollu -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #

Three different patterns with the same separator.

tri2 :: SequenceT sollu -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #

Tirmanams with a variant final repeat.

tsep :: SequenceT sollu -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #

tri_ with variable separators.

sequences

repeat :: Monoid a => Int -> a -> a Source #

replicate + mconcat.

r2 :: Monoid a => a -> a Source #

r3 :: Monoid a => a -> a Source #

r4 :: Monoid a => a -> a Source #

r5 :: Monoid a => a -> a Source #

r6 :: Monoid a => a -> a Source #

r7 :: Monoid a => a -> a Source #

r8 :: Monoid a => a -> a Source #

join :: SequenceT sollu -> [SequenceT sollu] -> SequenceT sollu Source #

inter :: SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #

Intersperse between each stroke.

spread :: S.Matra -> SequenceT sollu -> SequenceT sollu Source #

cmap :: Monoid b => (a -> b) -> [a] -> b Source #

for :: [a] -> (a -> b) -> [b] Source #

cfor :: Monoid b => [a] -> (a -> b) -> b Source #

prefixes :: (Semigroup a, Monoid a) => [a] -> a -> a Source #

Multiple prefixes on a single suffix.

suffixes :: (Semigroup a, Monoid a) => a -> [a] -> a Source #

circum :: (Semigroup a, Monoid a) => a -> [a] -> a -> a Source #

suffix :: (Semigroup a, Monoid a) => [a] -> a -> a Source #

prefix :: (Semigroup a, Monoid a) => a -> [a] -> a Source #

accumulate :: Monoid a => [a] -> [a] Source #

Succesively accumulate suffixes.

combinators

reduce3 :: Pretty sollu => S.FMatra -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #

Reduce three times, with a separator.

reduceBy :: Pretty sollu => [S.FMatra] -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #

reduceTo :: (CallStack.Stack, Pretty sollu) => S.FMatra -> S.FMatra -> SequenceT sollu -> SequenceT sollu Source #

reduceToL, except mconcat the result.

reduceToL :: (CallStack.Stack, Pretty sollu) => S.FMatra -> S.FMatra -> SequenceT sollu -> [SequenceT sollu] Source #

Reduce by a duration until a final duration.

reduceToR :: (CallStack.Stack, Pretty sollu) => S.FMatra -> S.FMatra -> SequenceT sollu -> [SequenceT sollu] Source #

Like reduceToL, but drop from the end instead of the front.

expand :: (CallStack.Stack, Pretty sollu) => Int -> S.FMatra -> SequenceT sollu -> [SequenceT sollu] Source #

Start fully reduced, and expand n times by the given duration.

replaceStart :: (CallStack.Stack, Pretty sollu) => SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #

Unlike most other functions that drop from a sequence, this one doesn't make a group. Since these are used to construct a new sequence, it seems more confusing than helpful.

As with (and (==), this is higher precedence than (.), so paretheses are needed: (a.b) replaceStart xyz.

replaceEnd :: (CallStack.Stack, Pretty sollu) => SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #

Unlike most other functions that drop from a sequence, this one doesn't make a group. Since these are used to construct a new sequence, it seems more confusing than helpful.

As with (and (==), this is higher precedence than (.), so paretheses are needed: (a.b) replaceStart xyz.

(<==) :: Pretty sollu => SequenceT sollu -> S.Duration -> SequenceT sollu infixl 8 Source #

Operators to embed a sequence at the beginning or end of sarvalaghu.

The precedence is such that sequences must be parenthesized: (a.b) <== 8. If it's lower than (.), then a.b <== 4 . c.d <== 4 is still wrong. Since sometimes I want (.) to be tighter and sometimes looser, I go for always looser and require parentheses, just like function calls. But by being at 8, at least I can be below (^) and (§).

(==>) :: Pretty sollu => S.Duration -> SequenceT sollu -> SequenceT sollu infixl 8 Source #

measurement

matrasOfI :: CallStack.Stack => SequenceT sollu -> S.Matra Source #

Like matrasOf, but throw an error if it's not integral.

matraDuration :: S.Duration Source #

I think defaultTempo is ok because these functions are used on fragments.

generic notation

speed :: S.Speed -> [S.Note g sollu] -> [S.Note g sollu] Source #

Set relative speed.

su :: [S.Note g sollu] -> [S.Note g sollu] Source #

Mnemonic: speed up, slow down.

sd :: [S.Note g sollu] -> [S.Note g sollu] Source #

Mnemonic: speed up, slow down.

su2 :: [S.Note g sollu] -> [S.Note g sollu] Source #

sd2 :: [S.Note g sollu] -> [S.Note g sollu] Source #

nadai :: S.Matra -> [S.Note g sollu] -> [S.Note g sollu] Source #

stride :: S.Stride -> [S.Note g sollu] -> [S.Note g sollu] Source #

groups

group :: SequenceT sollu -> SequenceT sollu Source #

Mark a theme group.

pattern :: SequenceT sollu -> SequenceT sollu Source #

Mark a pattern group. These are like patterns, except with a specific realization.

named :: Text -> SequenceT sollu -> SequenceT sollu Source #

Make a named group.

tags

(^) :: Solkattu.Tag -> SequenceT sollu -> SequenceT sollu infix 9 Source #

Infix operator to Solkattu.Tag all of the sollus it applies to.

trySetTag :: Solkattu.Tag -> SequenceT sollu -> SequenceT sollu Source #

Set if not already set.

align

__sam :: (CallStack.Stack, Pretty sollu) => Tala.Tala -> SequenceT sollu -> SequenceT sollu Source #

Align to the end of the avartanam, with rests.

This should only be used at the top level, since it gets the timing wrong under a tempo change.

__a :: (CallStack.Stack, Pretty sollu) => S.Duration -> SequenceT sollu -> SequenceT sollu Source #

Align to the end of the given number of aksharams.

sarvaA :: (CallStack.Stack, Pretty sollu) => SequenceT sollu -> S.Duration -> SequenceT sollu -> SequenceT sollu Source #

complex transformation

in3 :: SequenceT sollu -> SequenceT sollu Source #

ktknkook -> kt_kn_ko_ok

appendEach :: Int -> SequenceT sollu -> SequenceT sollu -> SequenceT sollu Source #

Append a sequence after a number of syllables. This works across groups, but not tempo changes.

mapGroup :: forall state g a. (state -> a -> (state, [S.Note g a])) -> state -> [S.Note g a] -> [S.Note g a] Source #

Apply a stateful transformation within groups. Since the transformation is allowed to add or remove notes, this will throw if there is a TempoChange in there, since now we are changing an unknown amount of time.

byGroup :: [S.Note g a] -> Maybe [Either (g, [S.Note g a]) [a]] Source #

Return groups, or runs of Notes. Nothing if there's a TempoChange in there.