Portability | non-portable (TF,GNTD) |
---|---|
Stability | experimental |
Maintainer | hans@hanshoglund.se |
Safe Haskell | None |
Combinators for manipulating scores and related structures.
- note :: Monad m => a -> m a
- rest :: MonadPlus m => m (Maybe a)
- noteRest :: MonadPlus m => Maybe a -> m a
- removeRests :: MonadPlus m => m (Maybe a) -> m a
- mapEvents :: (Time -> Duration -> a -> b) -> Score a -> Score b
- filterEvents :: (Time -> Duration -> a -> Bool) -> Score a -> Score a
- mapFilterEvents :: (Time -> Duration -> a -> Maybe b) -> Score a -> Score b
- before :: Time -> Score a -> Score a
- after :: Time -> Score a -> Score a
- split :: Time -> Score a -> (Score a, Score a)
- slice :: Time -> Time -> Score a -> Score a
- splice :: Time -> Duration -> Score a -> (Score a, Score a, Score a)
- metaAt :: (HasPart' a, IsAttribute b) => Time -> Score a -> b
- metaAtStart :: (HasPart' a, IsAttribute b) => Score a -> b
- withMeta :: (IsAttribute a, HasPart' b) => (a -> Score b -> Score b) -> Score b -> Score b
- withGlobalMeta :: IsAttribute a => (a -> Score b -> Score b) -> Score b -> Score b
- withMetaAtStart :: (IsAttribute a, HasPart' b) => (a -> Score b -> Score b) -> Score b -> Score b
- withGlobalMetaAtStart :: IsAttribute a => (a -> Score b -> Score b) -> Score b -> Score b
- mapFirst :: HasPart' a => (a -> b) -> (a -> b) -> Score a -> Score b
- mapLast :: HasPart' a => (a -> b) -> (a -> b) -> Score a -> Score b
- mapPhrase :: HasPart' a => (a -> b) -> (a -> b) -> (a -> b) -> Score a -> Score b
- mapPhraseSingle :: (a -> b) -> (a -> b) -> (a -> b) -> Score a -> Score b
- filterPart :: HasPart' a => (Part a -> Bool) -> Score a -> Score a
- extractParts :: HasPart' a => Score a -> [Score a]
- extractParts' :: HasPart' a => Score a -> [(Part a, Score a)]
- mapParts :: HasPart' a => (Score a -> Score b) -> Score a -> Score b
- mapAllParts :: HasPart' a => ([Score a] -> [Score b]) -> Score a -> Score b
- (</>) :: (HasPart' a, Enum (Part a)) => Score a -> Score a -> Score a
- rcat :: (HasPart' a, Enum (Part a)) => [Score a] -> Score a
- applySingle :: Voice (Score a -> Score b) -> Score a -> Score b
Basic
note :: Monad m => a -> m aSource
Create a score containing a note at time zero and duration one. This is an alias for return
.
noteRest :: MonadPlus m => Maybe a -> m aSource
Create a note or a rest at time zero and duration one. This is an alias for mfromMaybe
.
removeRests :: MonadPlus m => m (Maybe a) -> m aSource
Remove all rests from a score. This is an alias for mcatMaybes
.
Mapping over events
mapEvents :: (Time -> Duration -> a -> b) -> Score a -> Score bSource
Map over the events in a score.
Filtering events
Editing
filterEvents :: (Time -> Duration -> a -> Bool) -> Score a -> Score aSource
Filter the events in a score.
mapFilterEvents :: (Time -> Duration -> a -> Maybe b) -> Score a -> Score bSource
Efficient combination of mapEvents
and filterEvents
.
Editing
before :: Time -> Score a -> Score aSource
Retain only the notes whose offset does not fall after the given time.
after :: Time -> Score a -> Score aSource
Retain only the notes whose onset does not fall before the given time.
slice :: Time -> Time -> Score a -> Score aSource
Returns notes whose onset and offset fall between the given times.
splice :: Time -> Duration -> Score a -> (Score a, Score a, Score a)Source
Split a score into three parts
Meta-events
metaAtStart :: (HasPart' a, IsAttribute b) => Score a -> bSource
withGlobalMeta :: IsAttribute a => (a -> Score b -> Score b) -> Score b -> Score bSource
withMetaAtStart :: (IsAttribute a, HasPart' b) => (a -> Score b -> Score b) -> Score b -> Score bSource
withGlobalMetaAtStart :: IsAttribute a => (a -> Score b -> Score b) -> Score b -> Score bSource
Map over phrases
mapFirst :: HasPart' a => (a -> b) -> (a -> b) -> Score a -> Score bSource
Map over the first, and remaining notes in each part.
If a part has only one notes, the first function is applied. If a part has no notes, it is returned unchanged.
mapLast :: HasPart' a => (a -> b) -> (a -> b) -> Score a -> Score bSource
Map over the last, and preceding notes in each part.
If a part has only one notes, the first function is applied. If a part has no notes, it is returned unchanged.
mapPhrase :: HasPart' a => (a -> b) -> (a -> b) -> (a -> b) -> Score a -> Score bSource
Map over the first, middle and last note in each part.
If a part has fewer than three notes the first takes precedence over the last, and last takes precedence over the middle.
mapPhraseSingle :: (a -> b) -> (a -> b) -> (a -> b) -> Score a -> Score bSource
Equivalent to mapPhrase
for single-part scores.
Fails if the score contains overlapping events.
(a -> b) -> (a -> b) -> (a -> b) -> Score a -> Score b
Parts
Extracting parts
filterPart :: HasPart' a => (Part a -> Bool) -> Score a -> Score aSource
Deprecated:
Filter a score to include only those events whose parts match a given predicate.
extractParts :: HasPart' a => Score a -> [Score a]Source
Deprecated:
Extract parts from the a score.
The parts are returned in the order defined the associated Ord
instance part type.
extractParts' :: HasPart' a => Score a -> [(Part a, Score a)]Source
Deprecated:
Extract parts from the a score and include the part name.
The parts are returned in the order defined the associated Ord
instance part type.
Map over parts
mapParts :: HasPart' a => (Score a -> Score b) -> Score a -> Score bSource
Deprecated:
Map over all parts in the given score.
(Score a -> Score a) -> Score a -> Score a
mapAllParts :: HasPart' a => ([Score a] -> [Score b]) -> Score a -> Score bSource
Deprecated:
Map over all parts in the given score.
([Score a] -> [Score a]) -> Score a -> Score a
Part composition
(</>) :: (HasPart' a, Enum (Part a)) => Score a -> Score a -> Score aSource
Similar to <>
, but increases parts in the second part to prevent collision.