conductive-base-0.3: a library for live coding and real-time musical applications

Safe HaskellNone

Sound.Conductive.MusicalTime

Description

This is a module for functions concerned with time and its use in music.

Synopsis

Documentation

displayMusicalTime :: MusicalTime -> [Char]Source

a function which displays a musical time with beats to three decimal places, as it's more readable that way...

currentTime :: IO DoubleSource

a cast from POSIX time to a Double

lastTempoChange :: TempoClock -> TempoChangeSource

returns the latest (current) tempo change (not tempo) of a clock

lastTimeSignatureChange :: TempoClock -> TimeSignatureSource

returns the latest (may not be current) time signature change (not timesignature) of a clock

currentTempo :: TempoClock -> DoubleSource

returns the latest (current) tempo of a clock

currentTimeSignatureChange :: TempoClock -> IO TimeSignatureSource

returns the current (may not be latest) time signature change of a clock

currentTimeSignature :: TempoClock -> IO IntSource

returns the current time signature of a clock

elapsedTime :: TempoClock -> IO DoubleSource

returns the time elapsed since the start time of a given clock

timeSinceTempoChange :: TempoClock -> IO DoubleSource

returns the time elapsed since the last tempo change

deltasToAbsolutes :: Num a => a -> [a] -> [a]Source

converts a list of relative time deltas to a list of absolute times starting from the given time (first argument)

absolutesToDeltas :: Num a => [a] -> [a]Source

converts a list of relative time deltas to a list of absolute times

deltaToBeats :: Fractional a => a -> a -> aSource

converts a time delta (first argument) to a length specified in beats based on the given tempo (second argument)

beatsToDelta' :: Fractional a => a -> a -> aSource

beatsToDelta :: TempoClock -> Double -> DoubleSource

converts a time delta specified in beats (second argument) to one in seconds based on the given clock (first argument)

currentBeat :: TempoClock -> IO DoubleSource

when given a clock, returns the current beat

elapsedBeats :: TempoClock -> IO DoubleSource

an alias for currentBeat

currentMeasure :: TempoClock -> IO IntSource

when given a clock, returns the current measure

currentMusicalTime :: TempoClock -> IO MusicalTimeSource

when given a clock, returns the current MusicalTime

elapsedMusicalTime :: TempoClock -> IO MusicalTimeSource

shows the elapsed time in terms of a MusicalTime

currentMusicalTime2 :: TempoClock -> IO [Char]Source

returns the time as a more human-readable string version of MusicalTime

changeTempo :: TempoClock -> Double -> IO TempoClockSource

given a TempoClock and a new tempo, adds a TempoChange to it and returns a new clock

changeTimeSignature :: TempoClock -> Int -> IO TempoClockSource

given a TempoClock and a new time signature, adds a TimeSignatureChange and returns a new TempoClock. Changing the time signature takes effect in the next measure after the current one.

timeStringToMusicalTime :: [Char] -> MusicalTimeSource

converts a string with the time, written as measure.beat.decimalFractionOfABeat, to a MusicalTime.

For example, 2.2.5 converts to MusicalTime { measure = 2, beat = 2.5 }.

musicalTimeToBeats :: TempoClock -> MusicalTime -> DoubleSource

a cast from MusicalTime to beats