representing volume
 type Amplitude = Double
 type Diapason = (Amplitude, Amplitude)
 type Accent = Double
 class Seg a => Vol a where
 data Seg n => Volume n = Volume {
 volumeDiapason :: Diapason
 volumeLevel :: Level n
 data Seg n => Level n = Level {
 levelAccent :: Accent
 levelStep :: n
 volumeNum :: Seg n => Volume n > Int
 levelNum :: Seg n => Level n > Int
 level :: Seg n => n > Level n
 mediumLevel :: Seg n => Level n
 class VolumeFunctor a where
 class LevelFunctor a where
 setDiapason :: VolumeFunctor a => (Amplitude, Amplitude) > a > a
 setDiapasonRel :: VolumeFunctor a => (Double, Double) > a > a
 setLevel :: (Seg n, LevelFunctor a) => n > a > a
 setAccent :: LevelFunctor a => Accent > a > a
 accent :: LevelFunctor a => Accent > a > a
 al' :: LevelFunctor a => Accent > a > a
 aq' :: LevelFunctor a => Accent > a > a
 loud :: LevelFunctor a => a > a
 quiet :: LevelFunctor a => a > a
 louder :: LevelFunctor a => Int > a > a
 quieter :: LevelFunctor a => Int > a > a
 dynamics :: LevelFunctor a => (Time > Accent) > Score a > Score a
 dynamicsRel :: LevelFunctor a => [Accent] > Score a > Score a
 dynamicsSeg :: LevelFunctor a => [Double] > Score a > Score a
 amplitude :: Seg n => Diapason > Level n > Amplitude
 unsafeAmplitude :: Seg n => Diapason > Level n > Amplitude
 absVolume :: Seg n => Volume n > Amplitude
 unsafeAbsVolume :: Seg n => Volume n > Amplitude
 diapasonAt :: Diapason > Double > Double
 levelAsDouble :: Seg s => Level s > Double
 unsafeLevelAsDouble :: Seg s => Level s > Double
 levelAsDoubleRel :: Seg s => Level s > Double
 unsafeLevelAsDoubleRel :: Seg s => Level s > Double
Types
Main datatypes are Amplitude
, Diapason
and Level
.
Volume
consists of Diapason
and Level
. Every
Volume
can be converted to Amplitude
(see absVolume
).
Amplitude
is linear units and Level
is logarithmic units,
or decibels. Diapason
defines lower and upper bound for volume level
in amplitude linear units.
type Diapason = (Amplitude, Amplitude)Source
Volume lower and upper bounds. Lower bound must be positive and upper bound must exceed lower bound.
Volume  

Level
defines number of equally spaced stamps on
logarithmic scale (steps), and degree of diversion
from the stamps (accents).
Level  

mediumLevel :: Seg n => Level nSource
Medium level
Transformers
class VolumeFunctor a whereSource
VolumeFunctor a => VolumeFunctor (Score a)  
Seg n => VolumeFunctor (Volume n)  
Seg nVol => VolumeFunctor (Drum nVol a)  
(Seg nVol, Seg nPch) => VolumeFunctor (Note nVol nPch a) 
class LevelFunctor a whereSource
LevelFunctor a => LevelFunctor (Score a)  
Seg n => LevelFunctor (Level n)  
Seg n => LevelFunctor (Volume n)  
Seg nVol => LevelFunctor (Drum nVol a)  
(Seg nVol, Seg nPch) => LevelFunctor (Note nVol nPch a) 
setDiapason :: VolumeFunctor a => (Amplitude, Amplitude) > a > aSource
sets diapason to specified value
setDiapasonRel :: VolumeFunctor a => (Double, Double) > a > aSource
relative update of diapason value in decibels, (0, 1) turns diapason interval into itself.
al' :: LevelFunctor a => Accent > a > aSource
shorcut for 'accent louder'
aq' :: LevelFunctor a => Accent > a > aSource
shorcut for 'accent quieter'
loud :: LevelFunctor a => a > aSource
Input becomes one step louder
quiet :: LevelFunctor a => a > aSource
Input becomes one step quieter
louder :: LevelFunctor a => Int > a > aSource
Input becomes given number of steps louder
quieter :: LevelFunctor a => Int > a > aSource
Input becomes given number of steps quieter
dynamics :: LevelFunctor a => (Time > Accent) > Score a > Score aSource
Accent that depends on time of note
dynamicsRel :: LevelFunctor a => [Accent] > Score a > Score aSource
Linear relative dyn
function. Function is defined by list of
its values equaly spaced along time axis. For example
list [0, 1, 0] defines rise then decay lineary along full Score
's
input duration. Time intervals of
rise and decay segments are equal to dur
/2. And list [0, 1, 0.5, 0]
defines
rise and decay again but here decay segment is twice longer then
rise segment.
dynamicsSeg :: LevelFunctor a => [Double] > Score a > Score aSource
dynSeg
lifts linseg
function to dynamics level
Rendering
absVolume :: Seg n => Volume n > AmplitudeSource
converts volume to amplitude with amplitude
function
unsafeAbsVolume :: Seg n => Volume n > AmplitudeSource
converts volume to amplitude with unsafeAmplitude
function
diapasonAt :: Diapason > Double > DoubleSource
mapps decibels to amplitudes within specified amplitude diapason, 0 turns to lower diapason value and 1 turns to higher diapason value
levelAsDouble :: Seg s => Level s > DoubleSource
converts level value to double
unsafeLevelAsDouble :: Seg s => Level s > DoubleSource
converts level value to double, value can exceed level limits
levelAsDoubleRel :: Seg s => Level s > DoubleSource
converts level value to double, and normalizes output by level limits
unsafeLevelAsDoubleRel :: Seg s => Level s > DoubleSource
converts level value to double and normalizes output by level limits, value can exceed (0, 1) interval