| Copyright | (c) 2012--2016 Chordify BV | 
|---|---|
| License | LGPL-3 | 
| Maintainer | haskelldevelopers@chordify.net | 
| Stability | experimental | 
| Portability | non-portable | 
| Safe Haskell | Safe | 
| 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
 - altPitchSpelling :: ChordLabel -> Maybe ChordLabel
 - keyPitchClasses :: Key -> PCSet
 - 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.
altPitchSpelling :: ChordLabel -> Maybe ChordLabel Source #
Give the alternative pitch spelling of a chord (if it exists)
Pitch classes applied to keys
keyPitchClasses :: Key -> PCSet Source #
Return the set of pitches for the given key.
Pitch classes applied to interval sets
intValToPitchClss :: Root -> Interval -> Int Source #
As toIntervalClss, but returns the Int pitch class.
Enharmonic Equivalence
class EnHarEq a where Source #
A class to compare datatypes that sound the same (they contain the same pitch class content): http://en.wikipedia.org/wiki/Enharmonic