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

Safe HaskellNone

Derive.Solkattu.Solkattu

Contents

Description

Notation for Carnatic solkattu.

This is actually a separate library that's independent of Derive. The only connection is that its final output can be stroke names for some instrument and thus easily inserted into a track.

Salkattu is a general form of rhythmic notation. Since the syllables (sollus) are independent of any particular instrument, they can express general rhythmic structures, which can then be realized in a form idiomatic to different instruments.

The system is split up in a somewhat complicated way to separate rhythmic handling from sollus, and separate realizations sollus to various instruments. The structure from low to high level is:

Derive.Solkattu.Tala - General Tala.Tala type.

Derive.Solkattu.Sequence - Generic rhythmic framework, where the "payload" note type is abstract. This can express rhythms in terms of S.Speed and S.Nadai, check them against a Tala, and realize down to S.Duration tagged notes.

Derive.Solkattu.Solkattu - Fill in a Sequence's note with a Sollu type. This supports all of the notation in Derive.Solkattu.Dsl. As Sequence leaves the note type abstract, this leaves the instrument-dependent stroke type abstract.

Derive.Solkattu.Realize - This has an instrument-specific Stroke, which is the result of resolving the sollus. The stroke type is still abstract since it's polymorphic over the specific instrument.

Derive.Solkattu.Instrument.Mridangam, Derive.Solkattu.Instrument.KendangTunggal, etc. - These describe specific instruments for Realize.

Derive.Solkattu.Korvai - A Korvai unifies the instrument-specific Patterns and StrokeMaps together with Tala and a solkattu sequence. So I can support multiple instruments from one solkattu score, it merges the stroke types into a single type, and projects out the specific strokes depending on which instrument is being realized.

Derive.Solkattu.Dsl, Derive.Solkattu.SolkattuGlobal, Derive.Solkattu.Notation - Functions for creating solkattu scores. Dsl defines (or replaces) various operators to make scores look nicer.

Derive.Solkattu.Score.Solkattu* - Instrument-independent korvais.

Derive.Solkattu.MridangamGlobal, Derive.Solkattu.Score.Mridangam* - These are similar to Dsl and Score.Solkattu*, except they use concrete mridangam strokes instead of abstract sollus.

The naming convention is that "Note" is the level-specific value, itself may have a "Note" constructor with the "next level" of value. "SNote" is an alias for composing Note with Note, and "Sequence" is an alias for a list of those, but is abstractly the monoid where you can put together notation to form a score.

Synopsis

Documentation

data Note stroke Source #

Constructors

Note (NoteT stroke) 
Space !Space 
Pattern !Pattern 
Alignment !Tala.Akshara 

Instances

Functor Note # 

Methods

fmap :: (a -> b) -> Note a -> Note b #

(<$) :: a -> Note b -> Note a #

Eq stroke => Eq (Note stroke) # 

Methods

(==) :: Note stroke -> Note stroke -> Bool #

(/=) :: Note stroke -> Note stroke -> Bool #

Ord stroke => Ord (Note stroke) # 

Methods

compare :: Note stroke -> Note stroke -> Ordering #

(<) :: Note stroke -> Note stroke -> Bool #

(<=) :: Note stroke -> Note stroke -> Bool #

(>) :: Note stroke -> Note stroke -> Bool #

(>=) :: Note stroke -> Note stroke -> Bool #

max :: Note stroke -> Note stroke -> Note stroke #

min :: Note stroke -> Note stroke -> Note stroke #

Show stroke => Show (Note stroke) # 

Methods

showsPrec :: Int -> Note stroke -> ShowS #

show :: Note stroke -> String #

showList :: [Note stroke] -> ShowS #

Pretty stroke => Pretty (Note stroke) # 

Methods

pretty :: Note stroke -> Text Source #

format :: Note stroke -> Doc Source #

formatList :: [Note stroke] -> Doc Source #

S.HasMatras (Note stroke) # 

Methods

matras_of :: Note stroke -> S.Matra Source #

has_duration :: Note stroke -> Bool Source #

Rest (Sequence stroke) # 

Methods

__ :: Sequence stroke Source #

data Space Source #

A note that can take up a variable amount of space. Since it doesn't have set strokes (or any, in the case of Rest), it can be arbitrarily divided.

Constructors

Rest 
Sarva 

Instances

Eq Space # 

Methods

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

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

Ord Space # 

Methods

compare :: Space -> Space -> Ordering #

(<) :: Space -> Space -> Bool #

(<=) :: Space -> Space -> Bool #

(>) :: Space -> Space -> Bool #

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

max :: Space -> Space -> Space #

min :: Space -> Space -> Space #

Show Space # 

Methods

showsPrec :: Int -> Space -> ShowS #

show :: Space -> String #

showList :: [Space] -> ShowS #

data NoteT stroke Source #

Constructors

NoteT 

Fields

  • _sollu :: !Sollu
     
  • _karvai :: !Bool

    If it's a karvai stroke, and it's followed by a rest, it will replace the rest. Otherwise, it will be replaced by a note.

  • _stroke :: !(Maybe stroke)
     
  • _tag :: !(Maybe Tag)

    Tag a sequence for alternate realization.

Instances

Functor NoteT # 

Methods

fmap :: (a -> b) -> NoteT a -> NoteT b #

(<$) :: a -> NoteT b -> NoteT a #

Eq stroke => Eq (NoteT stroke) # 

Methods

(==) :: NoteT stroke -> NoteT stroke -> Bool #

(/=) :: NoteT stroke -> NoteT stroke -> Bool #

Ord stroke => Ord (NoteT stroke) # 

Methods

compare :: NoteT stroke -> NoteT stroke -> Ordering #

(<) :: NoteT stroke -> NoteT stroke -> Bool #

(<=) :: NoteT stroke -> NoteT stroke -> Bool #

(>) :: NoteT stroke -> NoteT stroke -> Bool #

(>=) :: NoteT stroke -> NoteT stroke -> Bool #

max :: NoteT stroke -> NoteT stroke -> NoteT stroke #

min :: NoteT stroke -> NoteT stroke -> NoteT stroke #

Show stroke => Show (NoteT stroke) # 

Methods

showsPrec :: Int -> NoteT stroke -> ShowS #

show :: NoteT stroke -> String #

showList :: [NoteT stroke] -> ShowS #

Pretty stroke => Pretty (NoteT stroke) # 

Methods

pretty :: NoteT stroke -> Text Source #

format :: NoteT stroke -> Doc Source #

formatList :: [NoteT stroke] -> Doc Source #

type Tag = Int Source #

A sollu can have a tag attached. This is used to map certain sets of sollus to a different realization. The idea is that even though the sollus are the same, they may be realized different ways in different contexts.

note :: Sollu -> Maybe stroke -> NoteT stroke Source #

modify_stroke :: (Maybe a -> Maybe b) -> Note a -> Note b Source #

modify_note :: (NoteT a -> NoteT b) -> Note a -> Note b Source #

data Pattern Source #

Constructors

PatternM !S.Matra 
Nakatiku

4-matra faran nakatikutarikita

Taka

Common ornaments. TODO there should be a lighter weight way to declare these, so I can put them per-korvai as generic groups.

Takanaka 

data Karvai Source #

Constructors

Karvai 
NotKarvai 

Instances

data Sollu Source #

Constructors

NoSollu

a dummy sollu for a Sollu with an explicit stroke

Dheem 
Dhom 
Di 
Din 
Dit 
Ga 
Gin 
Ka 
Ki 
Ku 
Lang 
Mi 
Na 
Nam 
Nang 
Ri 
Ta 
Tam 
Tang 
Tat 
Tha 
Thom 
Ti 
Kum 

Instances

Eq Sollu # 

Methods

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

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

Ord Sollu # 

Methods

compare :: Sollu -> Sollu -> Ordering #

(<) :: Sollu -> Sollu -> Bool #

(<=) :: Sollu -> Sollu -> Bool #

(>) :: Sollu -> Sollu -> Bool #

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

max :: Sollu -> Sollu -> Sollu #

min :: Sollu -> Sollu -> Sollu #

Show Sollu # 

Methods

showsPrec :: Int -> Sollu -> ShowS #

show :: Sollu -> String #

showList :: [Sollu] -> ShowS #

Pretty Sollu # 

durations

functions

cancel_karvai :: [(a, Note stroke)] -> [(a, Note stroke)] Source #

A Karvai Note followed by a Space will replace the rest, if followed by a Note or Pattern, the Karvai will be dropped. Since a Karvai note logically has no duration, if it's the last note it will be dropped entirely.

drop_next_rest :: [(a, Note stroke)] -> (Bool, [(a, Note stroke)]) Source #

verify_alignment Source #

Arguments

:: Pretty stroke 
=> Tala.Tala 
-> [(S.Tempo, Note stroke)] 
-> ([(S.Tempo, Note stroke)], Maybe Error)

If there's an error, still return the elemnts leading up to it.

Verify that the notes start and end at sam, and the given Alignments fall where expected.

vary

vary Source #

Arguments

:: (S.Matra -> Variations)

variations allowed for this duration

-> [S.Note (Note stroke)] 
-> [[S.Note (Note stroke)]] 

Variation means replacing a triad of patterns of the same duration with a an increasing or decreasing sequence. For instance, 666 can become 567, 765, or 777 can become 678 or 579 or their inverses.

TODO Variation on a higher order is also possible, so for instance 777, 777, 777 may become 666, 777, 888

TODO Also we have 5, 55, 555 -> 55, 55, 55 -> 555, 55, 5. This actually applies to more than just Patterns, e.g. 3 as tadin_. I think this is orthogonal and could get a different function.

find_triads :: [S.Note (Note stroke)] -> [(S.Matra, (Int, Int, Int))] Source #

Find triples of Patterns with the same length and return their indices. The indices are in ascending order.

util

apply_modifications Source #

Arguments

:: (a -> mod -> a) 
-> [(Int, mod)]

modifications along with their indices, in ascending order

-> [a] 
-> [a] 

permute_fst :: (a -> [b]) -> [(a, x)] -> [[(b, x)]] Source #