Safe Haskell  SafeInfered 

Composition and control.
 type Dur = Double
 type Score a = Track Double a
 data Event t a = Event {
 eventStart :: t
 eventDur :: t
 eventContent :: a
 eventEnd :: Num t => Event t a > t
 within :: Real t => t > t > Event t a > Bool
 temp :: a > Score a
 rest :: Dur > Score a
 stretch :: Dur > Score a > Score a
 delay :: Dur > Score a > Score a
 reflect :: Score a > Score a
 (+) :: Dur > Score a > Score a
 (*) :: Dur > Score a > Score a
 (=:=) :: 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
 sustain :: Dur > Score a > Score a
 sustainT :: Dur > Score a > Score a
 clip :: Dur > Dur > Score a > Score a
 takeS :: Dur > Score a > Score a
 dropS :: Dur > Score a > Score a
 filterEvents :: (Event Dur a > Bool) > Score a > Score a
 mapEvents :: (Event Dur a > Event Dur b) > Score a > Score b
 tmap :: (Event Dur a > b) > Score a > Score b
 tmapRel :: (Event Dur a > b) > Score a > Score b
 render :: Score a > [Event Dur a]
 alignByZero :: Real t => [Event t a] > [Event t a]
 sortEvents :: Ord t => [Event t a] > [Event t a]
 linseg :: (Ord t, Fractional t) => [t] > t > t
 linsegRel :: (Ord t, Fractional t) => t > [t] > t > t
 nil :: Monoid a => a
 module Data.Monoid
 setDiap :: VolumeLike a => (Amp, Amp) > Score a > Score a
 setDiapRel :: VolumeLike a => (Double, Double) > Score a > Score a
 setLevel :: VolumeLike a => Level > Score a > Score a
 setAccent :: VolumeLike a => Accent > Score a > Score a
 accent :: VolumeLike a => Accent > Score a > Score a
 (!) :: VolumeLike a => Score a > Accent > Score a
 louder :: VolumeLike a => Int > Score a > Score a
 quieter :: VolumeLike a => Int > Score a > Score a
 loud :: VolumeLike a => Score a > Score a
 quiet :: VolumeLike a => Score a > Score a
 envelope :: VolumeLike a => (Dur > Accent) > Score a > Score a
 envelopeSeg :: VolumeLike a => [Double] > Score a > Score a
 envelopeRel :: VolumeLike a => [Accent] > Score a > Score a
 setScale :: PitchLike a => Scale > Score a > Score a
 setBend :: PitchLike a => Bend > Score a > Score a
 setStep :: PitchLike a => Step > Score a > Score a
 step :: PitchLike a => Int > Score a > Score a
 bend :: PitchLike a => Bend > Score a > Score a
 lower :: PitchLike a => Int > Score a > Score a
 higher :: PitchLike a => Int > Score a > Score a
 low :: PitchLike a => Score a > Score a
 high :: PitchLike a => Score a > Score a
 l', h', hh', ll' :: PitchLike a => Score a > Score a
 r :: Dur > Score a
 dot :: Score a > Score a
 ddot :: Score a > Score a
 tri :: Score a > Score a
 bpm :: Dur > Score a > Score a
 bn, tn, sn, en, qn, hn, wn :: Score a > Score a
 dbn, dtn, dsn, den, dqn, dhn, dwn :: Score a > Score a
 bnr, tnr, snr, enr, qnr, hnr, wnr :: Score a
 dbnr, dtnr, dsnr, denr, dqnr, dhnr, dwnr :: Score a
Types
data Event t a
Constant time events. Value a
starts at some time
and lasts for some time.
Event  

within :: Real t => t > t > Event t a > Bool
Tests if given Event
happens between two time stamps.
Composition
temp
constructs just an event.
Value of type a
lasts for one time unit and starts at zero.
(=:/) :: Score a > Score a > Score aSource
Turncating parallel composition. Total duration equals to minimum of the two scores. All events that goes beyond the lmimt are dropped.
loop :: Int > Score a > Score aSource
Analog of replicate
function for scores. Replicated
scores are played sequentially.
sustain :: Dur > Score a > Score aSource
After this transformation events last longer by some constant amount of time.
sustainT :: Dur > Score a > Score aSource
Prolongated events can not exceed total score duration. All event are sustained but those that are close to end of the score are clipped. It resembles sustain on piano, when score ends you release the pedal.
Filtering
Mappings
mapEvents :: (Event Dur a > Event Dur b) > Score a > Score bSource
General mapping. Mapps not only values but events.
tmapRel :: (Event Dur a > b) > Score a > Score bSource
Relative tmap. Time values are normalized by argument's duration.
Rendering
alignByZero :: Real t => [Event t a] > [Event t a]
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]
Sorts all events by start time.
Miscellaneous
linseg :: (Ord t, Fractional t) => [t] > t > t
Linear interpolation. Can be useful with mapEvents
for
envelope changes.
linseg [a, da, b, db, c, ... ]
a, b, c ...
 values
da, db, ...
 duration of segments
linsegRel :: (Ord t, Fractional t) => t > [t] > t > t
With linsegRel
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
linsegRel dur [a1, a2, a3, ..., aN]
is equivalent to:
linseg [a1, dur/N, a2, dur/N, a3, ..., dur/N, aN]
Monoid synonyms
module Data.Monoid
Volume control
setDiapRel :: VolumeLike a => (Double, Double) > Score a > Score aSource
Relative update of diapason value in decibels, (0, 1) turns diapason interval into itself.
louder :: VolumeLike a => Int > Score a > Score aSource
Input becomes louder by given number of levels.
quieter :: VolumeLike a => Int > Score a > Score aSource
Input becomes quieter by given number of levels.
loud :: VolumeLike a => Score a > Score aSource
Input becomes one level louder.
quiet :: VolumeLike a => Score a > Score aSource
Input becomes one level quieter.
envelope :: VolumeLike a => (Dur > Accent) > Score a > Score aSource
Accent that depends on time of note, time is relative,
so Score
starts at 't = 0' and ends at 't = 1'.
envelopeSeg :: VolumeLike a => [Double] > Score a > Score aSource
envelopeSeg
lifts function linseg
to dynamics level
envelopeRel :: VolumeLike a => [Accent] > Score a > Score aSource
envelopeRel
lifts function linsegRel
to dynamics level
Pitch control
step :: PitchLike a => Int > Score a > Score aSource
Transposition. Increases (octave, step) coordinate by given number of steps.
Shortcuts
Denotes lower 12
and higher 12
.
Time stretching
bpm :: Dur > Score a > Score aSource
Sets tempo in beats per minute, if 1 Dur is equal to 1 second before transformation.
Shortcuts
Naming conventions :
First part x
can be [b  w  h  q  e  s  t  d[x] ]
b
means brewis (stretch 2)
w
means whole (stretch 1)
h
means half (stretch $ 1/2)
q
means quater (stretch $ 1/4)
e
means eighth (stretch $ 1/8)
s
means sixteenth (stretch $ 1/16)
t
means thirty second (stretch $ 1/32)
d[x]
means dotted [x] (stretch 1.5 $ x)
Pauses
Naming conventions are the same as for 'time stretching'.