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

Portabilitynon-portable (TF,GNTD)
Stabilityexperimental
Maintainerhans@hanshoglund.se
Safe HaskellNone

Music.Score.Score

Description

Provides the Score type.

Synopsis

Documentation

data Score a Source

A score is a list of events, i.e. time-duration-value triplets. Semantically

 type Score a = [(Time, Duration, a)]

There is no explicit representation for rests. However you can use `Score (Maybe a)` to represent a score with rests. Such rests are only useful when composing scores. They may be removed with removeRests.

Score is a Monoid under parallel composition. mempty is a score of no parts. For sequential composition of scores, use |>.

Score has an Applicative instance derived from the Monad instance. Not sure it is useful.

Score is an instance of VectorSpace using sequential composition as addition, and time scaling as scalar multiplication.

Instances

Monad Score

This instance is somewhat similar to the list instance.

  • return creates a score containing a single note at (0, 1).
  • s >>= k maps each note to a new score, which is then scaled and delayed by the onset and duration of the original note. That is, k returns a score t such that 0 < onset t < offset t < 1, the resulting events will not cross the boundaries of the original note.
  • join scales and offsets each inner score to fit into the note containing it, then removes the intermediate structure.
 let s = compose [(0,1,0), (1,2,1)]

 s >>= \x -> compose [ (0,1,toEnum $ x+65),
                       (1,3,toEnum $ x+97) ] :: Score Char

     ===> compose [ (1, 1, 'A'),
                    (1, 3, 'a'),
                    (1, 2, 'B'),
                    (3, 6, 'b') ]}
Functor Score 
Typeable1 Score 
MonadPlus Score 
Applicative Score 
Foldable Score 
Traversable Score 
Alternative Score 
Pointed Score 
Delayable Score 
Stretchable Score 
Performable Score 
HasOffset Score 
HasOnset Score 
HasDuration Score 
HasEvents Score 
Composable Score 
Transformable Score 
Transformable1 Score 
Eq a => Eq (Score a) 
Ord a => Ord (Score a) 
Show a => Show (Score a) 
Arbitrary a => Arbitrary (Score a) 
Monoid (Score a) 
VectorSpace (Score a) 
IsDynamics a => IsDynamics (Score a) 
IsPitch a => IsPitch (Score a) 
Semigroup (Score a) 
AdditiveGroup (Score a)