music-score-1.9.0: Musical score and part representation.

Copyright(c) Hans Hoglund 2012-2014
LicenseBSD-style
Maintainerhans@hanshoglund.se
Stabilityexperimental
Portabilitynon-portable (TF,GNTD)
Safe HaskellNone
LanguageHaskell2010

Music.Time.Score

Contents

Description

 

Synopsis

Score type

data Score a Source

A Score is a sequential or parallel composition of values, and allows overlapping events

Instances

Alternative Score 
Monad Score 
Functor Score 
MonadPlus Score 
Applicative Score 
Foldable Score 
Traversable Score 
HasBackendScore NoteList (Score a) 
(HasPart' a, Ord (Part a), HasMidiProgram (Part a)) => HasBackendScore Midi (Score a) 
(HasPart' a, Ord (Part a)) => HasBackendScore SuperCollider (Score a) 
(HasDynamicNotation a b c, HasArticulationNotation c d e, (~) * (Part e) (Part c), HasOrdPart a, Transformable a, Semigroup a, Tiable e, HasOrdPart c, Show (Part c), HasLilypondInstrument (Part c), Satisfied) => HasBackendScore Lilypond (Score a) 
(HasDynamicNotation a b c, HasOrdPart a, Transformable a, Semigroup a, HasOrdPart c, Tiable c, Show (Part a), HasMusicXmlInstrument (Part a)) => HasBackendScore MusicXml (Score a) 
Enum a => Enum (Score a) 
Num a => Num (Score a) 
(Show a, Transformable a) => Show (Score a) 
IsString a => IsString (Score a) 
Monoid (Score a) 
Wrapped (Score a) 
Semigroup (Score a) 
IsPitch a => IsPitch (Score a) 
IsInterval a => IsInterval (Score a) 
IsDynamics a => IsDynamics (Score a) 
ToJSON a => ToJSON (Score a) 
FromJSON a => FromJSON (Score a) 
Transformable (Score a) 
HasDuration (Score a) 
HasPosition (Score a) 
HasMeta (Score a) 
Alterable a => Alterable (Score a) 
Augmentable a => Augmentable (Score a) 
Tiable a => Tiable (Score a) 
HasSlide a => HasSlide (Score a) 
HasText a => HasText (Score a) 
HasHarmonic a => HasHarmonic (Score a) 
HasTremolo a => HasTremolo (Score a) 
HasColor a => HasColor (Score a) 
Rewrapped (Score a) (Score b) 
HasParts a b => HasParts (Score a) (Score b) 
HasPitches a b => HasPitches (Score a) (Score b) 
HasDynamics a b => HasDynamics (Score a) (Score b) 
HasArticulations a b => HasArticulations (Score a) (Score b) 
(HasPart' a, Ord (Part a)) => HasPhrases (Score a) (Score b) a b

Traverses all phrases in each voice, using extracted.

Typeable (* -> *) Score 
type SetPart g (Score a) = Score (SetPart g a) 
type SetPitch b (Score a) = Score (SetPitch b a) 
type SetDynamic b (Score a) = Score (SetDynamic b a) 
type SetArticulation b (Score a) = Score (SetArticulation b a) 
type BackendScoreEvent NoteList (Score a) = a 
type BackendScoreEvent Midi (Score a) = a 
type BackendScoreEvent SuperCollider (Score a) = a 
type BackendScoreEvent Lilypond (Score a) = SetArticulation ArticulationNotation (SetDynamic DynamicNotation a) 
type BackendScoreEvent MusicXml (Score a) = SetDynamic DynamicNotation a 
type Unwrapped (Score a) 
type Part (Score a) = Part a 
type Pitch (Score a) = Pitch a 
type Dynamic (Score a) = Dynamic a 
type Articulation (Score a) = Articulation a 

Query

Construction

score :: Getter [Event a] (Score a) Source

Create a score from a list of events.

events :: Lens (Score a) (Score b) [Event a] [Event b] Source

View a Score as a list of Event values.

eras :: Traversal' (Score a) Span Source

Print all eras of the given score.

>>> toListOf eras $ scat [c,d,e :: Score Integer]
[0 <-> 1,1 <-> 2,2 <-> 3]

triples :: Lens (Score a) (Score b) [(Time, Duration, a)] [(Time, Duration, b)] Source

View a score as a list of time-duration-value triplets.

Traversal

mapWithSpan :: (Span -> a -> b) -> Score a -> Score b Source

Map over the values in a score.

filterWithSpan :: (Span -> a -> Bool) -> Score a -> Score a Source

Filter the values in a score.

mapFilterWithSpan :: (Span -> a -> Maybe b) -> Score a -> Score b Source

Combination of mapTriples and filterTriples.

mapTriples :: (Time -> Duration -> a -> b) -> Score a -> Score b Source

Map over the values in a score.

filterTriples :: (Time -> Duration -> a -> Bool) -> Score a -> Score a Source

Filter the values in a score.

mapFilterTriples :: (Time -> Duration -> a -> Maybe b) -> Score a -> Score b Source

Efficient combination of mapTriples and filterTriples.

Simultaneous

simultaneous :: (Transformable a, Semigroup a) => Score a -> Score a Source

Merge all simultaneous events using their Semigroup instance.

Normalize

normalizeScore :: Score a -> Score a Source

Normalize a score, assuring its events spans are all forward (as by isForwardSpan), and that its onset is at least zero. Consequently, the onset and offset of each event in the score is at least zero.

Utility

printEras :: Score a -> IO () Source

Print the span of each event, as given by eras.

Unsafe versions

unsafeEvents :: Iso (Score a) (Score b) [Event a] [Event b] Source

A score is a list of events up to meta-data. To preserve meta-data, use the more restricted score and events.

unsafeTriples :: Iso (Score a) (Score b) [(Time, Duration, a)] [(Time, Duration, b)] Source

A score is a list of (time-duration-value triples) up to meta-data. To preserve meta-data, use the more restricted triples.