| Copyright | (c) 2013--2014 W. Bas de Haas and Jose Pedro Magalhaes, Multiphonyx Holding BV |
|---|---|
| License | LGPL-3 |
| Maintainer | bas@chordify.net, dreixel@chordify.net |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
HarmTrace.Base.Chord.Analysis
Description
Summary: Analyses and transforms musical chords
- analyseTriad :: IntSet -> Triad
- analyseTetra :: IntSet -> Shorthand
- toTriad :: Chord a -> Triad
- toMajMinChord :: ChordLabel -> ChordLabel
- data Third
- data Fifth
- data Sevth
- analyseThird :: IntSet -> Third
- analyseFifth :: IntSet -> Fifth
- analyseSevth :: IntSet -> Sevth
- toMode :: Triad -> Mode
- toMajMin :: Triad -> ClassType
- toClassType :: Chord a -> ClassType
- isSus2 :: ChordLabel -> Bool
- isSus4 :: ChordLabel -> Bool
- transposeRoot :: Root -> Int -> Root
- transposeSD :: ScaleDegree -> Int -> ScaleDegree
- toChordDegree :: Key -> ChordLabel -> ChordDegree
- toScaleDegree :: Key -> Root -> ScaleDegree
- intervalToPitch :: Root -> Interval -> Root
- icToInterval :: Int -> Interval
- toChord :: Root -> IntSet -> Maybe Interval -> Chord Root
Analysis
Triads and Sevenths
analyseTriad :: IntSet -> Triad Source
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
A Third can by major, minor or absent
A Fifth can be perfect, diminished, augmented or absent
A seventh can be major, minor, diminished, or absent
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
toClassType :: Chord a -> ClassType Source
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
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#