Time is rational
Moduletidal-1.9.5Haskell2010
Sound.Tidal.Time
- 3 types
- 17 values
- Packagetidal-1.9.5
- Exports20
- LanguageHaskell2010
- LicenceGPL-3.0-only
- SourceTime.hs
An arc of time, with a start time (or onset) and a stop time (or offset)
Instances12Functor, Applicative, Eq, Fractional, Num, Ord, …
Functor ArcFDefined in tidal-1.9.5 · Sound.Tidal.TimeShow ArcDefined in tidal-1.9.5 · Sound.Tidal.Show · orphanApplicative ArcFDefined in tidal-1.9.5 · Sound.Tidal.TimeEq a => Eq (ArcF a)Defined in tidal-1.9.5 · Sound.Tidal.TimeFractional a => Fractional (ArcF a)Defined in tidal-1.9.5 · Sound.Tidal.TimeNum a => Num (ArcF a)Defined in tidal-1.9.5 · Sound.Tidal.TimeOrd a => Ord (ArcF a)Defined in tidal-1.9.5 · Sound.Tidal.TimeShow a => Show (Event a)Defined in tidal-1.9.5 · Sound.Tidal.Show · orphanShow a => Show (ArcF a)Defined in tidal-1.9.5 · Sound.Tidal.TimeGeneric (ArcF a)Defined in tidal-1.9.5 · Sound.Tidal.TimeNFData a => NFData (ArcF a)Defined in tidal-1.9.5 · Sound.Tidal.Timetype Rep (ArcF a) = D1 ('MetaDataDefined in tidal-1.9.5 · Sound.Tidal.Time"ArcF"
"Sound.Tidal.Time"
"tidal-1.9.5-JQu49Mu8iLW5BacBM4avQP"
'False) (C1 ('MetaCons"Arc"
'PrefixI 'True) (S1 ('MetaSel ('Just"start"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Just"stop"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
Utility functions - Time
5 declarationsThe sam (start of cycle) for the given time value.
Cycles have duration 1, so every integer Time value divides two cycles.
Turns a number into a (rational) time value. An alias for toRational.
Turns a (rational) time value into another number. An alias for fromRational.
The end point of the current cycle (and starting point of the next cycle)
The position of a time value relative to the start of its cycle.
Utility functions - Arc
12 declarationsconvex hull union
subArc i j is the timespan that is the intersection of i and j.
intersection
The definition is a bit fiddly as results might be zero-width, but
not at the end of an non-zero-width arc - e.g. (0,1) and (1,2) do
not intersect, but (1,1) (1,1) does.
Simple intersection of two arcs
The Arc returned is the cycle that the Time falls within.
Edge case: If the Time is an integer, the Arc claiming it is the one starting at that Time, not the previous one ending at that Time.
Shifts an Arc to one of equal duration that starts within cycle zero. (Note that the output Arc probably does not start *at* Time 0 -- that only happens when the input Arc starts at an integral Time.)
Returns the numbers of the cycles that the input Arc overlaps
(excluding the input Arc's endpoint, unless it has duration 0 --
see "Edge cases" below).
(The "cycle number" of an Arc is equal to its start value.
Thus, for instance, cyclesInArc (Arc 0 1.5) == [0,1].)
Edge cases: > cyclesInArc $ Arc 0 1.0001 == [0,1] > cyclesInArc $ Arc 0 1 == [0] -- the endpoint is excluded > cyclesInArc $ Arc 1 1 == [1] -- unless the Arc has duration 0
PITFALL: Don't be fooled by the name. The output cycles
are not necessarily completely contained in the input Arc,
but they definitely overlap it,
and they include every cycle that overlaps it.
This provides exactly the same information as cyclesInArc,
except that this represents its output as Arcs,
whereas cyclesInArc represents the same information as integral indices.
(The Arc from 0 to 1 corresponds to the index 0,
the one from 1 to 2 has index 1, etc.)
Splits the given Arc into a list of Arcs, at cycle boundaries.
Like arcCycles, but returns zero-width arcs
Similar to fmap but time is relative to the cycle (i.e. the
sam of the start of the arc)
isIn a t is True if t is inside
the arc represented by a.