HarmTrace-Base-1.6.0.0: Parsing and unambiguously representing musical chords.

Copyright(c) 2012--2016 Chordify BV
LicenseLGPL-3
Maintainerhaskelldevelopers@chordify.net
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe
LanguageHaskell2010

HarmTrace.Base.Chord.Analysis

Contents

Description

Summary: Analyses and transforms musical chords

Synopsis

Analysis

Triads and Sevenths

analyseTriad :: IntSet -> Triad Source #

Analyses a degree list and returns MajTriad, MinTriad or NoTriad if the degrees make a chord a major, minor, or no triad, respectively.

analyseTetra :: IntSet -> Shorthand Source #

Analyses the structure of an IntSet and returns an appropriate ShortHand, if possible

toTriad :: Chord a -> Triad Source #

Takes a Chord and determines the Triad

>>> toTriad (Chord (Note Nat C) Min [NoAdd (Note Fl I3),Add (Note Nat I3)] 0 0)
maj
>>> toTriad (Chord (Note Nat C) HDim7 [Add (Note Sh I11)] 0 0)
dim
>>> toTriad (Chord (Note Nat C) Min [NoAdd (Note Fl I3)] 0 0)
NoTriad

N.B. toTriad throws an error when applied to a NoChord or UndefChord.

toMajMinChord :: ChordLabel -> ChordLabel Source #

applies toMajMin to a Chord, in case there is no triad, e.g. :sus4 or :sus2, an UndefChord is returned. Also, chord additions are removed. NoChords and UndefChords are returned untouched.

Chord components

data Third Source #

A Third can by major, minor or absent

Constructors

MajThird 
MinThird 
NoThird 

Instances

Eq Third Source # 

Methods

(==) :: Third -> Third -> Bool #

(/=) :: Third -> Third -> Bool #

Show Third Source # 

Methods

showsPrec :: Int -> Third -> ShowS #

show :: Third -> String #

showList :: [Third] -> ShowS #

data Fifth Source #

A Fifth can be perfect, diminished, augmented or absent

Instances

Eq Fifth Source # 

Methods

(==) :: Fifth -> Fifth -> Bool #

(/=) :: Fifth -> Fifth -> Bool #

Show Fifth Source # 

Methods

showsPrec :: Int -> Fifth -> ShowS #

show :: Fifth -> String #

showList :: [Fifth] -> ShowS #

data Sevth Source #

A seventh can be major, minor, diminished, or absent

Constructors

DimSev 
MinSev 
MajSev 
NoSev 

Instances

Eq Sevth Source # 

Methods

(==) :: Sevth -> Sevth -> Bool #

(/=) :: Sevth -> Sevth -> Bool #

Show Sevth Source # 

Methods

showsPrec :: Int -> Sevth -> ShowS #

show :: Sevth -> String #

showList :: [Sevth] -> ShowS #

analyseThird :: IntSet -> Third Source #

analyses the third in a degree list

analyseFifth :: IntSet -> Fifth Source #

analyses the fifth in a degree list

analyseSevth :: IntSet -> Sevth Source #

analyses the fifth in a degree list

Misc

toMode :: Triad -> Mode Source #

Converts a Shorthand to a Mode

toClassType :: Chord a -> ClassType Source #

Returns the ClassType given a Chord. This function uses analyseDegClassType to analyse a chord and derive the ClassType

isSus2 :: ChordLabel -> Bool Source #

Returns True if the ChordLabel has a major second, no third, and no fourth.

isSus4 :: ChordLabel -> Bool Source #

Returns True if the ChordLabel has a no major second, no third, but has a fourth.

Scale degree transposition

transposeRoot :: Root -> Int -> Root Source #

Transposes a Root with a Int semitones up

transposeCL :: ChordLabel -> Int -> ChordLabel Source #

Transposes a ChordLabel with a Int semitones up

transposeSD :: ScaleDegree -> Int -> ScaleDegree Source #

Transposes a scale degree with Int semitones up

toChordDegree :: Key -> ChordLabel -> ChordDegree Source #

Given a Key, calculates the the ChordDegree (i.e. relative, ScaleDegree based Chord) for an absolute ChordLabel using toScaleDegree.

toScaleDegree :: Key -> Root -> ScaleDegree Source #

Transformes a absolute Root Note into a relative ScaleDegree, given a Key.

intervalToPitch :: Root -> Interval -> Root Source #

Similar to toScaleDegree, an interval is transformed into an absolute Root pitch, given another Root that serves as a basis.

>>> intervalToPitch (Note Sh G) (Note Fl I13)
>>> E
>>> intervalToPitch (Note Nat C) (Note Sh I11)
>>> F#

toChord :: Root -> IntSet -> Interval -> Chord Root Source #

Given an IntSet (Interval Set), a Root Note and an optional bass Interval, returns a Chord