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

Safe HaskellNone

Derive.Solkattu.Sequence

Contents

Description

Low level support for rhythmic sequences in a Tala. The actual Note type is polymorphic, so this is purely rhythmic.

Synopsis

Documentation

data Note a Source #

Constructors

Note !a 
TempoChange TempoChange ![Note a] 

Instances

Functor Note # 

Methods

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

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

Eq a => Eq (Note a) # 

Methods

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

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

Ord a => Ord (Note a) # 

Methods

compare :: Note a -> Note a -> Ordering #

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

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

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

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

max :: Note a -> Note a -> Note a #

min :: Note a -> Note a -> Note a #

Show a => Show (Note a) # 

Methods

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

show :: Note a -> String #

showList :: [Note a] -> ShowS #

Pretty.Pretty a => Pretty.Pretty (Note a) # 

Methods

pretty :: Note a -> Text Source #

format :: Note a -> Doc Source #

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

(Pretty.Pretty stroke, ToStroke stroke) => ToStroke (Note stroke) # 

Methods

to_stroke :: Note stroke -> Stroke Source #

Rest (SNote stroke) # 

Methods

__ :: SNote stroke Source #

Rest (Sequence stroke) # 

Methods

__ :: Sequence stroke Source #

type Matra = Int Source #

A matra is an akshara divided by the nadai. It corresponds to a single sollu in first speed, which means the actual duration is dependent on Nadai and Speed.

type Speed = Int Source #

0 means nadai matras per akshara. Positive numbers double that and negative ones halve it.

type Nadai = Int Source #

class HasMatras a where Source #

Minimal complete definition

matras_of, has_duration

Methods

matras_of :: a -> Matra Source #

has_duration :: a -> Bool Source #

True if this note has a duration in time. Otherwise, it's a single stroke, which logically has zero duration. So far, this only affects how the note is drawn.

Instances

HasMatras Pattern # 
HasMatras (Note stroke) # 

Methods

matras_of :: Note stroke -> Matra Source #

has_duration :: Note stroke -> Bool Source #

HasMatras (Note stroke) # 

Methods

matras_of :: Note stroke -> Matra Source #

has_duration :: Note stroke -> Bool Source #

transform

simplify :: [Note a] -> [Note a] Source #

Drop empty TempoChanges, combine nested ones.

tempo

data Tempo Source #

Constructors

Tempo 

Fields

Instances

realize

notes :: [Note a] -> [a] Source #

flatten :: [Note a] -> [(Tempo, a)] Source #

flatten_with :: Tempo -> [Note a] -> [(Tempo, a)] Source #

tempo_to_state :: HasMatras a => Tala.Tala -> [(Tempo, a)] -> (State, [(State, a)]) Source #

Calculate Tala position for each note.

data Stroke a Source #

Constructors

Attack a 
Sustain a 
Rest 

Instances

Eq a => Eq (Stroke a) # 

Methods

(==) :: Stroke a -> Stroke a -> Bool #

(/=) :: Stroke a -> Stroke a -> Bool #

Show a => Show (Stroke a) # 

Methods

showsPrec :: Int -> Stroke a -> ShowS #

show :: Stroke a -> String #

showList :: [Stroke a] -> ShowS #

Pretty.Pretty a => Pretty.Pretty (Stroke a) # 

normalize_speed :: HasMatras a => Tala.Tala -> [(Tempo, a)] -> [(State, Stroke a)] Source #

Normalize to the fastest speed, then mark position in the Tala.

State

data State Source #

Keep track of timing and tala position.

Constructors

State 

Fields

functions

note_duration :: HasMatras a => Tempo -> Note a -> Duration Source #

Flatten the note and return its Duration.

matra_duration :: Tempo -> Duration Source #

Duration of one matra in the given tempo.

map_time :: HasMatras a => Tala.Tala -> (State -> a -> [Either Text b]) -> [Note a] -> [Either Text b] Source #

util

first_left :: [Either err a] -> Either ([a], err) [a] Source #

right_until_left :: [Either a b] -> ([b], Maybe a) Source #

Collect Rights until I hit a Left.