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

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

Music.Time.Span

Contents

Description

Provides time spans.

Synopsis

Documentation

data Span Source

A Span represents two points in time u and v where t <= u or, equivalently, a time t and a duration d where d >= 0.

A third way of looking at Span is that it represents a time transformation where onset is translation and duration is scaling.

Constructing spans

(<->) :: Time -> Time -> SpanSource

t <-> u represents the span between t and u.

(>->) :: Time -> Duration -> SpanSource

t >-> d represents the span between t and t .+^ d.

era :: (HasOnset a, HasOffset a) => a -> SpanSource

Get the era (onset to offset) of a given value.

Deconstructing spans

range :: Iso' Span (Time, Time)Source

View a span as onset and offset.

Typically used with the ViewPatterns extension, as in

 foo (view range -> (u,v)) = ...

delta :: Iso' Span (Time, Duration)Source

View a span as a time and duration.

Typically used with the ViewPatterns extension, as in

 foo (view delta -> (t,d)) = ...

Span as transformation

sunit :: SpanSource

The default span, i.e. start <-> stop.

sapp :: (Delayable a, Stretchable a) => Span -> a -> aSource

Apply a span transformation.

sunder :: (Delayable a, Stretchable a, Delayable b, Stretchable b) => Span -> (a -> b) -> a -> bSource

Apply a function under a span transformation.

sinvert :: Span -> SpanSource

The inversion of a span.

 sinvert (sinvert s) = s
 sapp (sinvert s) . sapp s = id