| Copyright | (c) 2012--2013 W. Bas de Haas and Jose Pedro Magalhaes |
|---|---|
| License | LGPL-3 |
| Maintainer | bas@chordify.net, dreixel@chordify.net |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell98 |
HarmTrace.Base.MusicRep
Contents
Description
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 PieceLabel = PieceLabel Key [ChordLabel]
- data Note a = Note (Maybe Accidental) a
- data Accidental
- type Root = Note DiatonicNatural
- data DiatonicNatural
- type ScaleDegree = Note DiatonicDegree
- data DiatonicDegree
- data Key = Key {}
- data Mode
- data Chord a = Chord {
- chordRoot :: a
- chordShorthand :: Shorthand
- chordAdditions :: [Addition]
- getLoc :: Int
- duration :: Int
- data Shorthand
- data Addition
- data Interval
- type ChordLabel = Chord Root
- type ChordDegree = Chord ScaleDegree
- noneLabel :: ChordLabel
- unknownLabel :: ChordLabel
- data ClassType
- data Triad
- isNone :: Root -> Bool
- isNoneChord :: ChordLabel -> Bool
- isUnknown :: Root -> Bool
- isRoot :: Root -> Bool
- isAddition :: Addition -> Bool
- toClassType :: Chord a -> ClassType
- toTriad :: Chord a -> Triad
- analyseDegTriad :: [Addition] -> Triad
- toDegreeList :: Chord a -> [Addition]
- toMode :: Triad -> Mode
- toMajMin :: Triad -> ClassType
- toMajMinChord :: ChordLabel -> ChordLabel
- simplifyRoot :: Root -> Root
- toChordDegree :: Key -> ChordLabel -> ChordDegree
- toScaleDegree :: Key -> Root -> ScaleDegree
- transposeSem :: ScaleDegree -> Int -> ScaleDegree
- toSemitone :: (Show a, Enum a) => Note a -> Int
- toRoot :: Int -> Root
Representing musical chords and keys
data PieceLabel Source
A container type combinint a key and a list of ChordLabels
Constructors
| PieceLabel Key [ChordLabel] |
Instances
A musical note is a pitch (either absolute or relative) posibly modified
by an Accidental
Constructors
| Note (Maybe Accidental) a |
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
Constructors
| Chord | |
Fields
| |
Intervals for additonal chord notes
type ChordLabel = Chord Root Source
A chord based on absolute Root notes
type ChordDegree = Chord ScaleDegree Source
A chord based on relative ScaleDegrees
noneLabel :: ChordLabel Source
No Chord label
unknownLabel :: ChordLabel Source
Unknown Chord label
Derived types for classification of chords
We introduce four chord categories: major chords, minor chords, dominant seventh chords, and diminshed seventh chords
A Triad comes in four flavours: major, minor, augmented, dimished, and
sometimes a chord does not have a triad (e.g. suspended chords, etc.)
Tests
isNoneChord :: ChordLabel -> Bool Source
Returns True if the ChordLabel is not a chord, and False otherwise
isAddition :: Addition -> Bool Source
Transformation and analysis of chords
toClassType :: Chord a -> ClassType Source
analyseDegTriad :: [Addition] -> Triad Source
toDegreeList :: Chord a -> [Addition] Source
Transforms a Chord into a list of relative degrees (i.e. Additions,
without the root note).
>>>toDegreeList (Chord (Note Nothing C) HDim7 [Add (Note (Just Sh) I11)] 0 0)[3b,5b,7b,11#]
>>>toDegreeList (Chord (Note Nothing C) Min13 [NoAdd (Note Nothing I11)] 0 0)[3b,5,7b,9,13]
>>>toDegreeList (parseData pChord "D:7(b9)")[3,5,7b,9b]
simplifyRoot :: Root -> Root Source
Simplify note roots to a single enharmonic representation. For instance, D♭ becomes C♯, E♯ becomes F, and G𝄫 becomes F.
Scale degree transposition
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.
transposeSem :: ScaleDegree -> Int -> ScaleDegree Source
Transposes a scale degree with sem semitones up
toSemitone :: (Show a, Enum a) => Note a -> Int Source
Returns the semitone value [0 .. 11] of a ScaleDegree where
0 = C, e.g. F# = 6. For the constructors N and X an error is thrown.
The reverse of toSemitone returning the 'Note DiatonicNatural' given a
Integer [0..11] semitone, where 0 represents C. When the integer is out
of the range [0..11] an error is thrown.