music-pitch-1.9.0: Musical pitch representation.

Safe HaskellNone
LanguageHaskell2010

Music.Pitch.Common.Semitones

Contents

Description

Semitones and enharmonic equivalence.

Synopsis

Types

Octaves

data Octaves Source

Number of octaves. May be negative, indicating a downward interval.

Semitones

type Semitones = ChromaticSteps Source

Number of semitones. May be negative, indicating a downward interval.

class HasSemitones a where Source

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

Methods

semitones :: a -> Semitones Source

Returns the number of semitones spanned by an interval.

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

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

semitone :: Semitones Source

Precisely one semitone.

tone :: Semitones Source

Precisely one whole tone, or two semitones.

ditone :: Semitones Source

Precisely two whole tones, or four semitones.

tritone :: Semitones Source

Precisely three whole tones, or six semitones.

isSemitone :: HasSemitones a => a -> Bool Source

Returns true iff the given interval spans one semitone.

isTone :: HasSemitones a => a -> Bool Source

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

isTritone :: HasSemitones a => a -> Bool Source

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

Enharmonic equivalence

(=:=) :: HasSemitones a => a -> a -> Bool infix 4 Source

Enharmonic equivalence.

>>> asInterval _A2 == m3
False
>>> asInterval _A2 =:= m3
True

(/:=) :: HasSemitones a => a -> a -> Bool infix 4 Source

Enharmonic non-equivalence.

>>> asInterval _A2 /= m3
True
>>> asInterval _A2 /:= m3
False