Copyright | (c) Hans Hoglund 2012-2014 |
---|---|
License | BSD-style |
Maintainer | hans@hanshoglund.se |
Stability | experimental |
Portability | non-portable (TF,GNTD) |
Safe Haskell | None |
Language | Haskell2010 |
- module Music.Time.Duration
- class HasDuration a => HasPosition a where
- era :: (HasPosition a, Transformable a) => Lens' a Span
- _onset :: HasPosition a => a -> Time
- _offset :: HasPosition a => a -> Time
- position :: (HasPosition a, Transformable a) => Duration -> Lens' a Time
- onset :: (HasPosition a, Transformable a) => Lens' a Time
- midpoint :: (HasPosition a, Transformable a) => Lens' a Time
- offset :: (HasPosition a, Transformable a) => Lens' a Time
- preOnset :: (HasPosition a, Transformable a) => Lens' a Time
- postOffset :: (HasPosition a, Transformable a) => Lens' a Time
- postOnset :: (HasPosition a, Transformable a) => Lens' a Time
- startAt :: (Transformable a, HasPosition a) => Time -> a -> a
- stopAt :: (Transformable a, HasPosition a) => Time -> a -> a
- placeAt :: (Transformable a, HasPosition a) => Duration -> Time -> a -> a
- stretchRelative :: (HasPosition a, Transformable a) => Duration -> Duration -> a -> a
- stretchRelativeOnset :: (HasPosition a, Transformable a) => Duration -> a -> a
- stretchRelativeMidpoint :: (HasPosition a, Transformable a) => Duration -> a -> a
- stretchRelativeOffset :: (HasPosition a, Transformable a) => Duration -> a -> a
- delayRelative :: (HasPosition a, Transformable a) => Duration -> Duration -> a -> a
- delayRelativeOnset :: (HasPosition a, Transformable a) => Duration -> a -> a
- delayRelativeMidpoint :: (HasPosition a, Transformable a) => Duration -> a -> a
- delayRelativeOffset :: (HasPosition a, Transformable a) => Duration -> a -> a
- transformRelative :: (HasPosition a, Transformable a) => Duration -> Span -> a -> a
- transformRelativeOnset :: (HasPosition a, Transformable a) => Span -> a -> a
- transformRelativeMidpoint :: (HasPosition a, Transformable a) => Span -> a -> a
- transformRelativeOffset :: (HasPosition a, Transformable a) => Span -> a -> a
Documentation
module Music.Time.Duration
The HasPosition class
class HasDuration a => HasPosition a where Source
Class of values that have a position in time.
Many values such as notes, envelopes etc can in fact have many positions such as onset,
attack point, offset, decay point time etc. Rather than having separate methods for a
discrete set of cases, this class provides an interpolation from a local position to
a global position. While the local position goes from 0 to 1, the global position
goes from the onset
to the offset
of the value.
For instantaneous values, a suitable instance is:
_position
x =const
t
For values with an onset and offset we can use alerp
:
_position
x =alerp
(_onset
x) (_offset
x)
Nothing
HasPosition Span | |
(HasPosition a, HasDuration a) => HasPosition [a] | |
HasPosition a => HasPosition (Bound a) | |
HasPosition a => HasPosition (AddMeta a) | |
HasPosition (Event a) | |
HasPosition (Score a) | |
HasDuration v => HasPosition (Aligned v) |
Era
era :: (HasPosition a, Transformable a) => Lens' a Span Source
A lens to the position
_onset :: HasPosition a => a -> Time Source
_offset :: HasPosition a => a -> Time Source
Position
position :: (HasPosition a, Transformable a) => Duration -> Lens' a Time Source
Position of the given value.
Specific positions
onset :: (HasPosition a, Transformable a) => Lens' a Time Source
Onset of the given value.
midpoint :: (HasPosition a, Transformable a) => Lens' a Time Source
Midpoint of the given value, or the value between the decay and sustain phases.
offset :: (HasPosition a, Transformable a) => Lens' a Time Source
Onset of the given value.
preOnset :: (HasPosition a, Transformable a) => Lens' a Time Source
Pre-onset of the given value, or the value right before the attack phase.
postOffset :: (HasPosition a, Transformable a) => Lens' a Time Source
Post-offset of the given value, or the value right after the release phase.
postOnset :: (HasPosition a, Transformable a) => Lens' a Time Source
Deprecated: Use midpoint
Moving
startAt :: (Transformable a, HasPosition a) => Time -> a -> a Source
Move a value forward in time.
stopAt :: (Transformable a, HasPosition a) => Time -> a -> a Source
Move a value forward in time.
placeAt :: (Transformable a, HasPosition a) => Duration -> Time -> a -> a Source
stretchRelative :: (HasPosition a, Transformable a) => Duration -> Duration -> a -> a Source
stretchRelativeOnset :: (HasPosition a, Transformable a) => Duration -> a -> a Source
stretchRelativeMidpoint :: (HasPosition a, Transformable a) => Duration -> a -> a Source
stretchRelativeOffset :: (HasPosition a, Transformable a) => Duration -> a -> a Source
delayRelative :: (HasPosition a, Transformable a) => Duration -> Duration -> a -> a Source
delayRelativeOnset :: (HasPosition a, Transformable a) => Duration -> a -> a Source
delayRelativeMidpoint :: (HasPosition a, Transformable a) => Duration -> a -> a Source
delayRelativeOffset :: (HasPosition a, Transformable a) => Duration -> a -> a Source
transformRelative :: (HasPosition a, Transformable a) => Duration -> Span -> a -> a Source
transformRelativeOnset :: (HasPosition a, Transformable a) => Span -> a -> a Source
transformRelativeMidpoint :: (HasPosition a, Transformable a) => Span -> a -> a Source
transformRelativeOffset :: (HasPosition a, Transformable a) => Span -> a -> a Source