tempi-1.0.0.0: For representing musical tempi

Safe HaskellSafe
LanguageHaskell2010

Data.Tempo

Synopsis

Documentation

data Tempo Source #

Musical tempo is represented as a data structure with three orthogonal components. (Generic instances are derived in order to allow later generation of instances for Aeson classes.)

Constructors

Tempo 

Fields

Instances
Eq Tempo Source # 
Instance details

Defined in Data.Tempo

Methods

(==) :: Tempo -> Tempo -> Bool #

(/=) :: Tempo -> Tempo -> Bool #

Show Tempo Source # 
Instance details

Defined in Data.Tempo

Methods

showsPrec :: Int -> Tempo -> ShowS #

show :: Tempo -> String #

showList :: [Tempo] -> ShowS #

Generic Tempo Source # 
Instance details

Defined in Data.Tempo

Associated Types

type Rep Tempo :: Type -> Type #

Methods

from :: Tempo -> Rep Tempo x #

to :: Rep Tempo x -> Tempo #

type Rep Tempo Source # 
Instance details

Defined in Data.Tempo

origin :: Tempo -> UTCTime Source #

The origin of a Tempo is the time at which the number of elapsed cycles/beats would have been 0.

timeToCount :: Tempo -> UTCTime -> Rational Source #

Given a Tempo and a clock time (UTCTime), timeToCount tells us how many cycles/beats have elapsed at that time.

countToTime :: Tempo -> Rational -> UTCTime Source #

Given a Tempo and a count of elapsed cycles/beats, countToTime tells us when that "beat" will (or would have) take(n) place.

changeTempo :: Rational -> UTCTime -> Tempo -> Tempo Source #

Provided a new frequency and a pivot time, changeTempo modifies a given Tempo as if the frequency changed at the pivot time, with the count continuing to increase monotonically

changeTempoNow :: Rational -> Tempo -> IO Tempo Source #

For convenience, changeTempoNow is an IO action that changes the frequency of the tempo now, ie. at the time returned by a call to getCurrentTime embedded in the action.