temporal-music-notation-0.1.6: music notation

Temporal.Music.Notation.Score

Description

Functions for score composition.

Synopsis

Types

type Time = DoubleSource

time

type Dur = DoubleSource

duration

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` `Score`

`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

rest :: Dur -> Score aSource

pause for some Dur time

note :: Dur -> a -> Score aSource

Constructor of score. Constructs note out of given value that lasts for some time.

Duration querry

dur :: Score a -> DurSource

querry score's duration

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.

line :: [Score a] -> Score aSource

sequential composition for list of scores

chord :: [Score a] -> Score aSource

parallel composition for list of scores

chordT :: [Score a] -> Score aSource

turncating parallel composition for lists of scores

loop :: Int -> Score a -> Score aSource

Arranges n copies of score in line.

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

delay :: Dur -> Score a -> Score aSource

Delay scores by given duration.

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.

dot :: Score a -> Score aSource

stretch with 1.5

ddot :: Score a -> Score aSource

double `dot`, stretch with 1.75

tri :: Score a -> Score aSource

stretch with 2/3

slice :: Dur -> Dur -> Score a -> Score aSource

extracting score parts in some time interval. it reverses output if `t1 < t0`.

takeS :: Dur -> Score a -> Score aSource

take sub-score from begining

dropS :: Dur -> Score a -> Score aSource

drop sub-score

reverseS :: Score a -> Score aSource

reverse score

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

sustain :: Dur -> Score a -> Score aSource

adds given amount of duration to all notes

sustainBy :: (Time -> Dur -> a -> (Dur, b)) -> Score a -> Score bSource

general sustain

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.

Constructors

 Event FieldseventStart :: t eventDur :: t eventContent :: a

Instances

 Functor (Event t) (Eq t, Eq a) => Eq (Event t a) (Show t, Show a) => Show (Event t a)

data EventList t a

List of `Event` s. First argument stands for total duration of `EventList`.

Constructors

 EventList t [Event t a]

Instances

 Functor (EventList t) (Eq t, Eq a) => Eq (EventList t a) (Show t, Show a) => Show (EventList t a)

Transform `Score` to `EventList`

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