music-pitch-1.6.2: Abstract representation of musical pitch.

Portabilitynon-portable (TF,GNTD)
Stabilityexperimental
Maintainerhans@hanshoglund.se
Safe HaskellNone

Music.Pitch.Common.Semitones

Contents

Description

Provides semitone, octave and step representaiton of intervals.

Synopsis

Types

Octaves

data Octaves Source

An interval represented as a number of octaves, including negative intervals.

 octaves a = semitones a `div` 12
 steps   a = semitones a `mod` 12

Steps

data Steps Source

An interval represented as a number of steps in the range 0 ≤ x < 12.

 octaves a = semitones a `div` 12
 steps   a = semitones a `mod` 12

Semitones

data Semitones Source

An interval represented as a number of semitones, including negative intervals, as well as intervals larger than one octave. This representation does not take spelling into account, so for example a major third and a diminished fourth can not be distinguished.

Intervals that name a number of semitones (i.e. semitone, tritone) does not have an unequivocal spelling. To convert these to an interval, a Spelling must be provided as in:

 spell sharps tritone == augmented fourth
 spell flats  tritone == diminished fifth

class HasSemitones a whereSource

Class of intervals that can be converted to a number of Semitones.

Methods

semitones :: a -> SemitonesSource

Returns the number of semitones spanned by an interval.

The number of semitones is negative if and only if the interval is negative.

Examples:

 semitones (perfect unison)  =  0
 semitones tritone           =  6
 semitones d5                =  6
 semitones (-_P8)            =  -12

semitone :: SemitonesSource

Precisely one semitone.

tone :: SemitonesSource

Precisely one whole tone, or two semitones.

ditone :: SemitonesSource

Precisely two whole tones, or four semitones.

tritone :: SemitonesSource

Precisely three whole tones, or six semitones.

isSemitone :: HasSemitones a => a -> BoolSource

Returns true iff the given interval spans one semitone.

isTone :: HasSemitones a => a -> BoolSource

Returns true iff the given interval spans one whole tone (two semitones).

isTritone :: HasSemitones a => a -> BoolSource

Returns true iff the given interval spans three whole tones (six semitones).

Enharmonic equivalence

(=:=) :: HasSemitones a => a -> a -> BoolSource

Enharmonic equivalence.

(/:=) :: HasSemitones a => a -> a -> BoolSource

Enharmonic non-equivalence.