Portability | non-portable (TF,GNTD) |
---|---|

Stability | experimental |

Maintainer | hans@hanshoglund.se |

Safe Haskell | None |

- class HasDuration a where
- stretchTo :: (Stretchable a, HasDuration a) => Duration -> a -> a
- class HasOnset a where
- class HasOffset a where
- startAt :: (HasOnset a, Delayable a) => Time -> a -> a
- stopAt :: (HasOffset a, Delayable a) => Time -> a -> a
- withSameOnset :: (Delayable a, HasOnset a, HasOnset b) => (b -> a) -> b -> a
- withSameOffset :: (Delayable a, HasOffset a, HasOffset b) => (b -> a) -> b -> a
- durationDefault :: (HasOffset a, HasOnset a) => a -> Duration
- onsetDefault :: (HasOffset a, HasDuration a) => a -> Time
- offsetDefault :: (HasOnset a, HasDuration a) => a -> Time

# 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

HasDuration Duration | |

HasDuration Span | |

HasDuration a => HasDuration [a] | |

HasDuration a => HasDuration (Product a) | |

HasDuration a => HasDuration (NoDelay a) | |

HasDuration a => HasDuration (NoStretch a) | |

HasDuration a => HasDuration (NoRev a) | |

HasDuration (Voice a) | |

HasDuration (Note a) | |

HasDuration (Score a) | |

HasDuration (Rhythm a) | |

HasDuration (Duration, a) | |

HasDuration (Time, Duration, a) |

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 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

HasOnset Time | |

HasOnset Span | |

HasOnset a => HasOnset [a] | |

HasOnset a => HasOnset (Sum a) | |

HasOnset a => HasOnset (Set a) | |

HasOnset a => HasOnset (NoDelay a) | |

HasOnset a => HasOnset (NoStretch a) | |

HasOnset a => HasOnset (NoRev a) | |

HasOnset (Note a) | |

HasOnset (Track a) | |

HasOnset (Score a) | |

HasOnset (Time, a) | |

HasOnset k => HasOnset (Map k a) | |

HasOnset (Time, Duration, a) |

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

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

Given `HasDuration`

and `HasOffset`

instances, this function implements `onset`

.

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