Functions for score composition.
 type Time = Double
 type Dur = Double
 type Score a = Media Dur a
 rest :: Dur > Score a
 note :: Dur > a > Score a
 dur :: Score a > Dur
 (+:+) :: Score a > Score a > Score a
 (=:=) :: Score a > Score a > Score a
 (=:/) :: Score a > Score a > Score a
 line :: [Score a] > Score a
 chord :: [Score a] > Score a
 chordT :: [Score a] > Score a
 loop :: Int > Score a > Score a
 trill :: Int > Score a > Score a > Score a
 delay :: Dur > Score a > Score a
 stretch :: Dur > Score a > Score a
 bpm :: Double > Score a > Score a
 dot :: Score a > Score a
 ddot :: Score a > Score a
 tri :: Score a > Score a
 slice :: Dur > Dur > Score a > Score a
 takeS :: Dur > Score a > Score a
 dropS :: Dur > Score a > Score a
 reverseS :: Score a > Score a
 pedal :: Dur > Score a > Score a
 pedalBy :: (Time > Dur > a > (Dur, b)) > Score a > Score b
 sustain :: Dur > Score a > Score a
 sustainBy :: (Time > Dur > a > (Dur, b)) > Score a > Score b
 tmap :: (Time > a > b) > Score a > Score b
 dmap :: (Dur > a > b) > Score a > Score b
 tdmap :: (Time > Dur > a > b) > Score a > Score b
 eventMap :: (Event Dur a > Event Dur b) > Score a > Score b
 data Event t a = Event {
 eventStart :: t
 eventDur :: t
 eventContent :: a
 data EventList t a = EventList t [Event t a]
 renderScore :: Score a > EventList Dur a
 tmapRel :: (Time > a > b) > Score a > Score b
 dmapRel :: (Dur > a > b) > Score a > Score b
 tdmapRel :: (Time > Dur > a > b) > Score a > Score b
 linseg :: (Ord t, Fractional t) => [t] > t > t
Types
type Score a = Media Dur aSource
In Score
a
values of type a
can be wrapped in time events as if they present or abscent for some
time Dur
and combined together in parrallel or sequent ways.
Score is instance of
Functor
instance means that you can map over score values
with some function (a > b)
, rests are mapped to rests and values
transformed with given function.
Constructors
note :: Dur > a > Score aSource
Constructor of score. Constructs note out of given value that lasts for some time.
Duration querry
Composition
(+:+) :: Score a > Score a > Score aSource
binary sequential composition, a +:+ b
means play a and then play b.
(=:=) :: Score a > Score a > Score aSource
binary parallel composition, a =:= b
means play a and b simultoneously.
(=:/) :: Score a > Score a > Score aSource
turncating parallel composition
for a =:/ b composes two scores together and turncates biggest one by duration of smallest one.
trill :: Int > Score a > Score a > Score aSource
loop for two groups of notes. Repeats n times line of two scores.
Transformers
In time domain
stretch :: Dur > Score a > Score aSource
stretch in time domain. Duration of every note segemnt is multiplied by given factor.
bpm :: Double > Score a > Score aSource
set tempo in beats per minute, if 1 Dur is equal to 1 second before transformation.
slice :: Dur > Dur > Score a > Score aSource
extracting score parts in some time interval.
it reverses output if t1 < t0
.
pedal :: Dur > Score a > Score aSource
adds sustain, but total duration of score elements remains unchaged
notes are sustained within total duration interval. adds given amount of time to all notes.
pedalBy :: (Time > Dur > a > (Dur, b)) > Score a > Score bSource
general "pedal"
Total duration of score element remains unchanged. notes are sustained within total duration interval
Mappings
tmap :: (Time > a > b) > Score a > Score bSource
temporal functor tmap
method for scores
map with time
dmap :: (Dur > a > b) > Score a > Score bSource
temporal functor dmap
method for scores
map with duration
tdmap :: (Time > Dur > a > b) > Score a > Score bSource
temporal functor tdmap
method for scores
map with time and duration
eventMap :: (Event Dur a > Event Dur b) > Score a > Score bSource
General mapping. In the end all values of type Score
are to be converted to EventList
wich is list of Event
s
and function eventMap
allows mapping on Score
subvalues as if
they are events already.
Warning : It is possible to change start time position with
eventMap
but it can lead to unexpected outcome when used
with slice
function. slice
operates on structure of
type Score
(how value was built with sequent
, parallel
or stretch
and other functions), but eventMap
operates
on Score
subvalues as if they are converted to Event
s
and some shifted events can slip through slice
's fingers.
Rendering
data Event t a
Constant time events. Value a
starts at some time
and lasts for some time.
Event  

data EventList t a
Miscellaneous
tmapRel :: (Time > a > b) > Score a > Score bSource
relative tmap
map with time normalized by total duration value
dmapRel :: (Dur > a > b) > Score a > Score bSource
relative dmap
map with duration normalized by total duration value
tdmapRel :: (Time > Dur > a > b) > Score a > Score bSource
relative tdmap
map with time and duration normalized by total duration value
linseg :: (Ord t, Fractional t) => [t] > t > t
Linear interpolation. Can be useful with eventMap
for
envelope changes.
linseg [a, da, b, db, c, ... ]
a, b, c ...
 values
da, db, ...
 duration of segments