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

Copyright(c) 2013--2014 W. Bas de Haas and Jose Pedro Magalhaes, Multiphonyx Holding BV
LicenseLGPL-3
Maintainerbas@chordify.net, dreixel@chordify.net
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe-Inferred
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

data Fifth Source

A Fifth can be perfect, diminished, augmented or absent

Instances

data Sevth Source

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

Constructors

DimSev 
MinSev 
MajSev 
NoSev 

Instances

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

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#

icToInterval :: Int -> Interval Source

Converts an Interval class to an Interval

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

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