Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
A sequence structure, courtesy https://github.com/nosuchtim/keykit.
A note has a time, a duration and a value. A phrase is a time-ascending sequence of notes and a length. The length of a phrase is independent of the contents. The sequence operator, phrase_append, sums phrase lengths. The parallel operator, phrase_merge, selects the longer length.
Operations are ordinarily on phrases, notes are operated on indirectly. The phrase indexing operation, phrase_at returns a phrase of degree one.
Synopsis
- type Time = Rational
- type Duration = Time
- type Length = Time
- data Note t = Note {
- note_start_time :: Time
- note_duration :: Duration
- note_value :: t
- note_end_time :: Note t -> Time
- note_region :: Note t -> (Time, Time)
- note_shift_time :: Time -> Note t -> Note t
- note_scale_duration :: Time -> Note t -> Note t
- note_scale_duration_and_time :: Time -> Note t -> Note t
- note_is_start_in_region :: (Time, Time) -> Note t -> Bool
- note_is_entirely_in_region :: (Time, Time) -> Note t -> Bool
- data Phrase t = Phrase {
- phrase_notes :: [Note t]
- phrase_length :: Length
- phrase_values :: Phrase t -> [t]
- phrase_set_length :: Phrase t -> Length -> Phrase t
- phrase_degree :: Phrase t -> Int
- phrase_start_time :: Phrase t -> Time
- phrase_end_time :: Phrase t -> Time
- phrase_duration :: Phrase t -> Duration
- phrase_maximum :: Ord t => Phrase t -> Note t
- phrase_minimum :: Ord t => Phrase t -> Note t
- phrase_at :: Phrase t -> Int -> Phrase t
- phrase_time_at :: Phrase t -> Int -> Time
- phrase_clear_at :: Phrase t -> Int -> Phrase t
- phrase_at_put :: Ord t => Phrase t -> Int -> Phrase t -> Phrase t
- phrase_is_empty :: Phrase t -> Bool
- phrase_append :: Ord t => Phrase t -> Phrase t -> Phrase t
- phrase_append_list :: Ord t => [Phrase t] -> Phrase t
- phrase_merge :: Ord t => Phrase t -> Phrase t -> Phrase t
- phrase_merge_list :: Ord t => [Phrase t] -> Phrase t
- phrase_select :: Phrase t -> (Note t -> Bool) -> Phrase t
- phrase_partition :: Phrase t -> (Note t -> Bool) -> (Phrase t, Phrase t)
- phrase_select_region :: Phrase t -> (Time, Time) -> Phrase t
- phrase_clear_region :: Phrase t -> (Time, Time) -> Phrase t
- phrase_select_indices :: Phrase t -> (Int, Int) -> Phrase t
- phrase_clear_indices :: Phrase t -> (Int, Int) -> Phrase t
- phrase_extract_region :: Phrase t -> (Time, Time) -> Phrase t
- phrase_delete_region :: Ord t => Phrase t -> (Time, Time) -> Phrase t
- phrase_separate :: Phrase t -> Time -> (Phrase t, Phrase t)
- phrase_reverse :: Phrase t -> Phrase t
- phrase_reorder :: Phrase t -> [Int] -> Phrase t
- phrase_truncate :: Phrase t -> Phrase t
- phrase_trim :: Phrase t -> Phrase t
- note_map :: (t -> u) -> Note t -> Note u
- phrase_value_map :: (t -> u) -> Phrase t -> Phrase u
- phrase_note_map :: (Note t -> Note u) -> Phrase t -> Phrase u
- phrase_phrase_map :: Ord u => (Phrase t -> Phrase u) -> Phrase t -> Phrase u
- phrase_map :: Ord u => (Note t -> Phrase u) -> Phrase t -> Phrase u
- phrase_shift :: Phrase t -> Time -> Phrase t
- phrase_scale_duration :: Phrase t -> Time -> Phrase t
- phrase_scale_duration_and_time :: Phrase t -> Time -> Phrase t
- phrase_scale_to_duration :: Phrase t -> Duration -> Phrase t
- phrase_scale_to_region :: Phrase t -> (Time, Duration) -> Phrase t
- phrase_to_wseq :: Phrase t -> Wseq Time t
- useq_to_phrase :: Useq Time t -> Phrase t
- dseq_to_phrase :: Dseq Time t -> Phrase t
- wseq_to_phrase :: Wseq Time t -> Phrase t
Time
Note
Note | |
|
note_end_time :: Note t -> Time Source #
Phrase
It is an un-checked invariant that the note list is in ascending order.
Phrase | |
|
phrase_values :: Phrase t -> [t] Source #
phrase_degree :: Phrase t -> Int Source #
phrase_start_time :: Phrase t -> Time Source #
phrase_end_time :: Phrase t -> Time Source #
phrase_duration :: Phrase t -> Duration Source #
phrase_at :: Phrase t -> Int -> Phrase t Source #
Keykit sets the length to the duration, i.e. ('c,e,g'%2).length is 192.
phrase_is_empty :: Phrase t -> Bool Source #
phrase_reverse :: Phrase t -> Phrase t Source #
phrase_truncate :: Phrase t -> Phrase t Source #
phrase_trim :: Phrase t -> Phrase t Source #
Functor
phrase_value_map :: (t -> u) -> Phrase t -> Phrase u Source #