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

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

Music.Time.Onset

Contents

Description

This misleadingly named module provide a way to query a value for its duration, onset and offset.

Synopsis

Duration class

class HasDuration a whereSource

Class of types with a duration.

If a type has an instance for both HasOnset and HasDuration, the following laws should hold:

 duration a = offset a .-. onset a

Methods

duration :: a -> DurationSource

stretchTo :: (Stretchable a, HasDuration a) => Duration -> a -> aSource

Stretch a score to fit into the given duration.

 Duration -> Score a -> Score a

Onset and offset class

class HasOnset a whereSource

Class of types with a position in time.

Onset and offset are logical start and stop time, i.e. the preferred beginning and end of the sound, not o the the time of the attack and damp actions on an instrument,

If a type has an instance for both HasOnset and HasDuration, the following laws should hold:

 duration a = offset a .-- onset a

Methods

onset :: a -> TimeSource

Get the onset of the given value.

class HasOffset a whereSource

Methods

offset :: a -> TimeSource

Get the offset of the given value.

startAt :: (HasOnset a, Delayable a) => Time -> a -> aSource

Move a score so that its onset is at the specific time.

 Time -> Score a -> Score a

stopAt :: (HasOffset a, Delayable a) => Time -> a -> aSource

Move a score so that its offset is at the specific time.

 Time -> Score a -> Score a

withSameOnset :: (Delayable a, HasOnset a, HasOnset b) => (b -> a) -> b -> aSource

Transform a score without affecting its onset.

 Time -> Score a -> Score a

withSameOffset :: (Delayable a, HasOffset a, HasOffset b) => (b -> a) -> b -> aSource

Transform a score without affecting its offset.

 Time -> Score a -> Score a

Utility

Default implementations

durationDefault :: (HasOffset a, HasOnset a) => a -> DurationSource

Given HasOnset and HasOffset instances, this function implements duration.

onsetDefault :: (HasOffset a, HasDuration a) => a -> TimeSource

Given HasDuration and HasOffset instances, this function implements onset.

offsetDefault :: (HasOnset a, HasDuration a) => a -> TimeSource

Given HasOnset and HasOnset instances, this function implements offset.