Safe Haskell  SafeInferred 

A library for creating lists of constant time events related in time.
 data Event t a = Event {
 eventStart :: t
 eventDur :: t
 eventContent :: a
 data Track t a
 dur :: Track t a > t
 within :: Real t => t > t > Event t a > Bool
 eventEnd :: Num t => Event t a > t
 temp :: Real t => a > Track t a
 str :: Real t => t > Track t a > Track t a
 del :: Real t => t > Track t a > Track t a
 reflect :: Real t => Track t a > Track t a
 (+) :: Real t => t > Track t a > Track t a
 (*) :: Real t => t > Track t a > Track t a
 (=:=) :: Real t => Track t a > Track t a > Track t a
 (+:+) :: Real t => Track t a > Track t a > Track t a
 (=:/) :: Real t => Track t a > Track t a > Track t a
 mel :: Real t => [Track t a] > Track t a
 har :: (Real t, Ord t) => [Track t a] > Track t a
 harT :: Real t => [Track t a] > Track t a
 loop :: Real t => Int > Track t a > Track t a
 rest :: Real t => t > Track t a
 sustain :: Real t => t > Track t a > Track t a
 sustainT :: Real t => t > Track t a > Track t a
 melTemp :: Real t => [a] > Track t a
 harTemp :: Real t => [a] > Track t a
 melMap :: Real t => (a > Track t b) > [a] > Track t b
 harMap :: Real t => (a > Track t b) > [a] > Track t b
 harTMap :: Real t => (a > Track t b) > [a] > Track t b
 slice :: Real t => t > t > Track t a > Track t a
 takeT :: Real t => t > Track t a > Track t a
 dropT :: Real t => t > Track t a > Track t a
 filterEvents :: Real t => (Event t a > Bool) > Track t a > Track t a
 mapEvents :: Real t => (Event t a > Event t b) > Track t a > Track t b
 tmap :: Real t => (Event t a > b) > Track t a > Track t b
 tmapRel :: RealFrac t => (Event t a > b) > Track t a > Track t b
 render :: Real t => Track t a > [Event t a]
 alignByZero :: Real t => [Event t a] > [Event t a]
 sortEvents :: Ord t => [Event t a] > [Event t a]
 nil :: Monoid a => a
 module Data.Monoid
 linfun :: (Ord t, Fractional t) => [t] > t > t
 linfunRel :: (Ord t, Fractional t) => t > [t] > t > t
 line :: Real t => [Track t a] > Track t a
 chord :: Real t => [Track t a] > Track t a
 delay :: Real t => t > Track t a > Track t a
 stretch :: Real t => t > Track t a > Track t a
Introduction
Temporal.Media is a library for creating lists of constant time events related in time. Constant time event is value that starts at some fixed time and lasts for some fixed time. Library provides functions to build lists of such events with timerelations like sequent, parallel or delayed.
Core type of library is Track
. It provides interface
to compose list of events.
Types
Constant time events. Value a
starts at some time
and lasts for some time.
Event  

within :: Real t => t > t > Event t a > BoolSource
Tests if given Event
happens between two time stamps.
Composition
temp :: Real t => a > Track t aSource
temp
constructs just an event.
Value of type a lasts for one time unit and starts at zero.
(=:=) :: Real t => Track t a > Track t a > Track t aSource
Parallel composition. Play two tracks simultaneously.
(+:+) :: Real t => Track t a > Track t a > Track t aSource
Sequent composition. Play first track then second.
(=:/) :: Real t => Track t a > Track t a > Track t aSource
Turncating parallel composition. Total duration equals to minimum of the two tracks. All events that goes beyond the lmimt are dropped.
mel :: Real t => [Track t a] > Track t aSource
Sequent composition on list of tracks (short for melody).
har :: (Real t, Ord t) => [Track t a] > Track t aSource
Parallel composition on list of tracks (short for harmony).
loop :: Real t => Int > Track t a > Track t aSource
Analog of replicate
function for tracks. Replicated
tracks are played sequentially.
sustain :: Real t => t > Track t a > Track t aSource
After this transformation events last longer by some constant amount of time.
sustainT :: Real t => t > Track t a > Track t aSource
Prolongated events can not exceed total track duration. All event are sustained but those that are close to end of the track are sliceped. It resembles sustain on piano, when track ends you release the pedal.
Common patterns
melMap :: Real t => (a > Track t b) > [a] > Track t bSource
Transforms a sequence and then applies a mel.
harMap :: Real t => (a > Track t b) > [a] > Track t bSource
Transforms a sequence and then applies a har.
harTMap :: Real t => (a > Track t b) > [a] > Track t bSource
Transforms a sequence and then applies a harT.
Filtering
Mappings
mapEvents :: Real t => (Event t a > Event t b) > Track t a > Track t bSource
General mapping. Mapps not only values but events.
tmapRel :: RealFrac t => (Event t a > b) > Track t a > Track t bSource
Relative tmap. Time values are normalized by argument's duration.
Rendering
alignByZero :: Real t => [Event t a] > [Event t a]Source
Shifts all events so that minimal start time equals to zero if first event has negative start time.
sortEvents :: Ord t => [Event t a] > [Event t a]Source
Sorts all events by start time.
Monoid synonyms
module Data.Monoid
Miscellaneous
linfun :: (Ord t, Fractional t) => [t] > t > tSource
Linear interpolation. Can be useful with mapEvents
for
envelope changes.
linfun [a, da, b, db, c, ... ]
a, b, c ...
 values
da, db, ...
 duration of segments
linfunRel :: (Ord t, Fractional t) => t > [t] > t > tSource
With linfunRel
you can make linear interpolation
function that has equal distance between points.
First argument gives total length of the interpolation function
and second argument gives list of values. So call
linfunRel dur [a1, a2, a3, ..., aN]
is equivalent to:
linfun [a1, dur/N, a2, dur/N, a3, ..., dur/N, aN]