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

Safe HaskellNone

Derive.Solkattu.Realize

Contents

Description

Realize an abstract solkattu Sequence to concrete instrument-dependent Notes.

Synopsis

Documentation

type SNote stroke = S.Note (Note stroke) Source #

data Note stroke Source #

The Solkattu.Sollus have been reduced to concrete strokes.

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 #

Show stroke => Show (Note stroke) # 

Methods

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

show :: Note stroke -> String #

showList :: [Note stroke] -> ShowS #

Pretty.Pretty stroke => Pretty.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 #

ToStroke (Note Stroke) # 
ToStroke (Note Stroke) # 
Rest (SNote stroke) # 

Methods

__ :: SNote stroke Source #

data Stroke stroke Source #

Constructors

Stroke 

Fields

Instances

Functor Stroke # 

Methods

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

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

Eq stroke => Eq (Stroke stroke) # 

Methods

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

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

Ord stroke => Ord (Stroke stroke) # 

Methods

compare :: Stroke stroke -> Stroke stroke -> Ordering #

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

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

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

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

max :: Stroke stroke -> Stroke stroke -> Stroke stroke #

min :: Stroke stroke -> Stroke stroke -> Stroke stroke #

Show stroke => Show (Stroke stroke) # 

Methods

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

show :: Stroke stroke -> String #

showList :: [Stroke stroke] -> ShowS #

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

Methods

pretty :: Stroke stroke -> Text Source #

format :: Stroke stroke -> Doc Source #

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

Expr.ToExpr (Stroke Stroke) # 
Expr.ToExpr (Stroke Stroke) # 
Expr.ToExpr (Stroke Stroke) # 
Expr.ToExpr (Stroke Stroke) # 
ToStroke (Stroke Stroke) # 
ToStroke (Stroke Stroke) # 

stroke :: stroke -> Stroke stroke Source #

rest :: SNote stroke Source #

newtype Patterns stroke Source #

This maps a Pattern of a certain duration to a realization. The S.Matras should the same duration as the the list in the default tempo. This is enforced in the constructor patterns.

Constructors

Patterns (Map Solkattu.Pattern [SNote stroke]) 

Instances

Eq stroke => Eq (Patterns stroke) # 

Methods

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

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

Show stroke => Show (Patterns stroke) # 

Methods

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

show :: Patterns stroke -> String #

showList :: [Patterns stroke] -> ShowS #

Monoid (Patterns stroke) # 

Methods

mempty :: Patterns stroke #

mappend :: Patterns stroke -> Patterns stroke -> Patterns stroke #

mconcat :: [Patterns stroke] -> Patterns stroke #

Pretty.Pretty stroke => Pretty.Pretty (Patterns stroke) # 

Methods

pretty :: Patterns stroke -> Text Source #

format :: Patterns stroke -> Doc Source #

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

patterns :: Pretty.Pretty stroke => [(Solkattu.Pattern, [SNote stroke])] -> Either Text (Patterns stroke) Source #

Make a Patterns while checking that the durations match.

map_patterns :: ([SNote stroke] -> [SNote stroke]) -> Patterns stroke -> Patterns stroke Source #

StrokeMap

newtype StrokeMap stroke Source #

Sollus and Strokes should be the same length. This is enforced in the constructor stroke_map. Nothing is a rest, which applies to longer sequences like dinga.

Instances

Eq stroke => Eq (StrokeMap stroke) # 

Methods

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

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

Show stroke => Show (StrokeMap stroke) # 

Methods

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

show :: StrokeMap stroke -> String #

showList :: [StrokeMap stroke] -> ShowS #

Monoid (StrokeMap stroke) # 

Methods

mempty :: StrokeMap stroke #

mappend :: StrokeMap stroke -> StrokeMap stroke -> StrokeMap stroke #

mconcat :: [StrokeMap stroke] -> StrokeMap stroke #

Pretty.Pretty stroke => Pretty.Pretty (StrokeMap stroke) # 

Methods

pretty :: StrokeMap stroke -> Text Source #

format :: StrokeMap stroke -> Doc Source #

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

simple_stroke_map :: [([Solkattu.Sollu], [Maybe.Maybe stroke])] -> StrokeMap stroke Source #

Directly construct a StrokeMap from strokes.

stroke_map :: Pretty.Pretty stroke => [([S.Note (Solkattu.Note stroke)], [SNote stroke])] -> Either Text (StrokeMap stroke) Source #

Instrument

data Instrument stroke Source #

Sollu to instrument stroke mapping.

Constructors

Instrument 

Fields

Instances

Eq stroke => Eq (Instrument stroke) # 

Methods

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

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

Show stroke => Show (Instrument stroke) # 

Methods

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

show :: Instrument stroke -> String #

showList :: [Instrument stroke] -> ShowS #

Monoid (Instrument stroke) # 

Methods

mempty :: Instrument stroke #

mappend :: Instrument stroke -> Instrument stroke -> Instrument stroke #

mconcat :: [Instrument stroke] -> Instrument stroke #

Pretty.Pretty stroke => Pretty.Pretty (Instrument stroke) # 

Methods

pretty :: Instrument stroke -> Text Source #

format :: Instrument stroke -> Doc Source #

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

instrument :: Pretty.Pretty stroke => StrokeMap stroke -> [([S.Note (Solkattu.Note stroke)], [SNote stroke])] -> Patterns stroke -> Either Text (Instrument stroke) Source #

realize

type Event stroke = (S.Duration, Solkattu.Note stroke) Source #

realize :: forall stroke. Pretty.Pretty stroke => StrokeMap stroke -> [(S.Tempo, Solkattu.Note (Stroke stroke))] -> Either Text [(S.Tempo, Note stroke)] Source #

map_until_left :: (a -> [a] -> Either err (b, [a])) -> [a] -> ([b], Maybe.Maybe err) Source #

Apply the function until it returns Left. The function can consume a variable number of elements.

find_sequence :: StrokeMap stroke -> a -> Solkattu.NoteT (Stroke stroke) -> [(a, Solkattu.Note (Stroke stroke))] -> Either Text ([(a, Note stroke)], [(a, Solkattu.Note (Stroke stroke))]) Source #

Find the longest matching sequence and return the match and unconsumed notes.

replace_sollus :: [Maybe.Maybe (Stroke stroke)] -> [(a, Solkattu.Note (Stroke stroke))] -> ([(a, Note stroke)], [(a, Solkattu.Note (Stroke stroke))]) Source #

Match each stroke to a Sollu, copying over Rests without consuming a stroke.

format text

format :: Pretty.Pretty stroke => Maybe.Maybe Int -> Int -> Tala.Tala -> [(S.Tempo, Note stroke)] -> Text Source #

Format the notes according to the tala.

The line breaking for rulers is a bit weird in that if the line is broken, I only emit the first part of the ruler. Otherwise I'd have to have a multiple line ruler too, which might be too much clutter. I'll have to see how it works out in practice.

thin_rests :: [(a, Text)] -> [(a, Text)] Source #

Drop single character rests on odd columns, to make the output look less cluttered.

format_final_avartanam :: [[[(S.State, Text)]]] -> [[[(S.State, Text)]]] Source #

If the final non-rest is at sam, drop trailing rests, and don't wrap it onto the next line.

format_lines :: Pretty.Pretty stroke => Int -> Int -> Tala.Tala -> [(S.Tempo, Note stroke)] -> [[[(S.State, Text)]]] Source #

Break into [avartanam], where avartanam = [line].

break_avartanams :: [(S.State, a)] -> [[(S.State, a)]] Source #

attach_ruler :: [(Text, Text)] -> Text Source #

Strip duplicate rulers and attach to the notation lines. Avartanams which were broken due to width are separated with two newlines to make that visible.

map_with_fst :: (a -> b -> c) -> [(a, b)] -> [(a, c)] Source #

Like second, but also give fst as an argument.

break_line :: Int -> [(S.State, Text)] -> [[(S.State, Text)]] Source #

If the text goes over the width, break at the middle akshara, or the last one before the width if there isn't a middle.

break_before :: Int -> [(S.State, Text)] -> [[(S.State, Text)]] Source #

Yet another word-breaking algorithm. I must have 3 or 4 of these by now.

break_fst :: (key -> Bool) -> [(key, a)] -> ([a], [a]) Source #

format html

write_html :: Pretty.Pretty stroke => FilePath -> Tala.Tala -> [[(S.Tempo, Note stroke)]] -> IO () Source #

format_table :: Pretty.Pretty stroke => Tala.Tala -> [(S.Tempo, Note stroke)] -> [[(S.State, Doc.Html)]] Source #