| 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.PitchClass
Contents
Description
Summary: this module provides some functions that transform notes and chords into pitch classes and pitch class sets. See for more info: http://en.wikipedia.org/wiki/Pitch_class
- data PCSet
- pc :: PCSet -> IntSet
- toPitchClass :: Diatonic a => Note a -> Int
- pcToRoot :: Int -> Root
- toPitchClasses :: ChordLabel -> PCSet
- rootPC :: ChordLabel -> Int
- bassPC :: ChordLabel -> Int
- ignorePitchSpelling :: ChordLabel -> ChordLabel
- intValToPitchClss :: Root -> Interval -> Int
- intSetToPC :: IntSet -> Root -> PCSet
- class EnHarEq a where
- class (Generic a, Show a, Enum a, Bounded a) => Diatonic a
Documentation
We hide the constructors, such that a PCSet can only be constructed with
toPitchClasses, this to overcome confusion between interval sets and
pitch class sets, which are both IntSets
Pitch classes
toPitchClass :: Diatonic 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.
pcToRoot :: Int -> Root Source
The reverse of toPitchClass returning the 'Note DiatonicNatural' given a
Integer [0..11] semitone, where 0 represents C. All pitch spelling is ignored
and the the following twelve pitch names will be output: C, C#, D, Eb, E, F
F#, G, Ab, A, Bb, B. When the integer is out of the range [0..11] an
error is thrown.
Pitch classes applied to chords
toPitchClasses :: ChordLabel -> PCSet Source
Similar to toIntSet but returns Int pitch classes and includes the
Root and the bass Note of the the Chord. toPitchClasses throws an
error when applied to a NoChord or UndefChord.
rootPC :: ChordLabel -> Int Source
A short-cut applying toPitchClass to a Chord. rootPC throws an
error when applied to a NoChord or UndefChord.
bassPC :: ChordLabel -> Int Source
A short-cut applying intValToPitchClss to a Chord. bassPC throws an
error when applied to a NoChord or UndefChord.
ignorePitchSpelling :: ChordLabel -> ChordLabel Source
Ignores the pitch spelling of a chord by applying pcToRoot and
toPitchClass to the root of a ChordLabel.
Pitch classes applied to interval sets
intValToPitchClss :: Root -> Interval -> Int Source
As toIntervalClss, but returns the Int pitch class.
Enharmonic Equivalence
A class to compare datatypes that sound the same (they contain the same pitch class content): http://en.wikipedia.org/wiki/Enharmonic
Minimal complete definition
Nothing
Instances
| EnHarEq ChordLabel | |
| Diatonic a => EnHarEq (Note a) |