Copyright | (c) 2012--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 |
Summary: A set of types and classes for representing musical chords. The chord datatypes are based on the unambiguous chord representation presented in: Christopher Harte, Mark Sandler and Samer Abdallah (2005), Symbolic representation of musical chords: a proposed syntax for text annotations, In: Proceedings of 6th International Conference on Music Information Retrieval (http://ismir2005.ismir.net/proceedings/1080.pdf).
- data Note a = Note Accidental a
- data Accidental
- type Root = Note DiatonicNatural
- data DiatonicNatural
- type ScaleDegree = Note DiatonicDegree
- data DiatonicDegree
- data Key = Key {}
- data Mode
- data Chord a
- chordRoot :: Show a => Chord a -> a
- chordShorthand :: Show a => Chord a -> Shorthand
- chordAdditions :: Show a => Chord a -> [Addition]
- chordBass :: Show a => Chord a -> Interval
- data Shorthand
- data Addition
- data IntNat
- type Interval = Note IntNat
- type ChordLabel = Chord Root
- type ChordDegree = Chord ScaleDegree
- data ClassType
- data Triad
- shortChord :: Root -> Shorthand -> ChordLabel
- discardBass :: Chord a -> Chord a
- isNoneChord :: ChordLabel -> Bool
- isAddition :: Addition -> Bool
- catchNoChord :: Show a => String -> (Chord a -> b) -> Chord a -> b
Representing musical chords and keys
A musical note is a pitch (either absolute or relative) possibly modified
by an Accidental
data Accidental Source
A musical Accidental
type Root = Note DiatonicNatural Source
Representing absolute Root
notes
data DiatonicNatural Source
The seven diatonic naturals
type ScaleDegree = Note DiatonicDegree Source
Key relative scale degrees to abstract from the absolute Root notes
data DiatonicDegree Source
All Diatonic scale degrees
Keys
The Mode
of a key, which can be major or minor
Chords
The representation for a single chord consisting of a root, a Shorthand
representing the interval structure of the chord, a list of Additions
,
for representing other (additional) structure, and the base Inversion
chordRoot :: Show a => Chord a -> a Source
Returns the root of a Chord
, and throws an error in case of a NoChord
or an UndefChord
.
chordShorthand :: Show a => Chord a -> Shorthand Source
Returns the Shorthand
of a Chord
, and throws an error in case of
a NoChord
or an UndefChord
.
chordAdditions :: Show a => Chord a -> [Addition] Source
Returns the list of Additions
of a Chord
, and throws an error in case
of a NoChord
or an UndefChord
.
chordBass :: Show a => Chord a -> Interval Source
Returns the bass Interval
of a Chord
, and throws an error in case of
a NoChord
or an UndefChord
.
Intervals for additional chord notes
type ChordLabel = Chord Root Source
A chord based on absolute Root
notes
type ChordDegree = Chord ScaleDegree Source
A chord based on relative ScaleDegree
s
Derived types for classification of chords
Updates the root field of a Chord
updateRoot :: Chord a -> a -> Chord a
updateRoot (Chord r sh a b) r' = Chord r' sh a b
We introduce four chord categories: major chords, minor chords, dominant seventh chords, and diminished seventh chords
A Triad
comes in four flavours: major, minor, augmented, diminished, and
sometimes a chord does not have a triad (e.g. suspended chords, etc.)
Tests & Utilities
shortChord :: Root -> Shorthand -> ChordLabel Source
discardBass :: Chord a -> Chord a Source
isNoneChord :: ChordLabel -> Bool Source
Returns True if the ChordLabel
is not a chord, and False otherwise
isAddition :: Addition -> Bool Source
catchNoChord :: Show a => String -> (Chord a -> b) -> Chord a -> b Source
Checks if the ChordLabel
is a NoChord
or UndefChord
and throws
an error using the first argument as an function identifier for debugging.
In case of a ChordLabel
the second argument is applied to the third
argument.