temporal-music-notation-0.2.3: music notation

Temporal.Music.Pitch

Contents

Description

This module defines notion of pitch.

Synopsis

# Documentation

type Hz = DoubleSource

Cycles per second

type Interval = DoubleSource

Multiplier of Hz

Middle C (261.626 Hz)

Middle A (440 Hz)

Transpose cycles per second by some interval.

# Pitch

data Pitch Source

`Pitch` denotes `Hz` value. But it's not a double for ease of performing some musical transformations, transposition, bend, inversion, changing scales. `Pitch` can be converted to `Hz` with function `hz`. Pitch contains `Scale`, and point on the tone plane. The point is a triple `(bend, octave, step)`. `Bend` denotes divergens from vertices of scale grid. `Octave` and `Step` are integers.

Constructors

 Pitch FieldspitchScale :: Scale pitchBend :: Bend pitchOctave :: Octave pitchStep :: Step

Instances

 Eq Pitch Show Pitch Default Pitch PitchLike Pitch

Constructs `Pitch` from some step value. `Bend` and `Octave` are set to zeroes. `Scale` is set to default scale which is defined in `HasScale` class.

type Bend = DoubleSource

`Bend` represents tone's diversion from scale grid.

# Scale

data Scale Source

`Scale` defines 2D grid (octave, step) in space of `Hz` units. `Bend` is a level of diversion from grid vertices. 1-level bend is equal to 1 step. For tones with fractional bends frequency is calculated with linear interpolation by nearest values in scale. Example:

``` s = Scale f0 d intervals
```

Here scale `s` defines 2D grid that mapps center point `(0, 0)` to frequency `f0` `Hz`. Value `d` is octave interval. Octave interval is divided on steps. Steps are `Interval` s from base frequency `f0` to desired frequency. Let's define equal temperament scale:

``` eqt = Scale c1 2 \$ Vector.fromList \$ (map ((2 **) . (/12)) [0..11])
```

Constructors

 Scale FieldsscaleBase :: Hz scaleOctave :: Interval scaleSteps :: Vector Interval

Instances

 Eq Scale Show Scale Default Scale

fromIntervals :: Interval -> [Interval] -> Hz -> ScaleSource

`Scale` constructor.

Gives scale multiplier

Gives number of steps in one octave.

# PitchLike

class PitchLike a whereSource

`Pitch` can be used alongside with many other parameters (they can define timbre or loudness). Class `PitchLike` provides getters and setters for data types that contain value of type `Pitch`. In Temporal.Music.Score module you can find many functions that are defined in terms of this class. Once you have chosen some note representation you can make an instance for it and use all pitch-modifiers.

Methods

setPitch :: Pitch -> a -> aSource

getPitch :: a -> PitchSource

Instances

 PitchLike Pitch PitchLike (Note a)

mapPitch :: PitchLike a => (Pitch -> Pitch) -> a -> aSource

Pitch modifier.

# Render

absPitch :: PitchLike a => a -> HzSource

Calculates cycles per second for a pitch.

Calculates position on tone plane for value of type `Pitch`.

Scale value on doubles