HarmTrace-Base-1.4.0.1: Parsing and unambiguously representing musical chords.

Copyright(c) 2013--2014 W. Bas de Haas and Jose Pedro Magalhaes, Multiphonyx Holding BV
LicenseLGPL-3
Maintainerbas@chordify.net, dreixel@chordify.net
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

Synopsis

Documentation

data PCSet Source

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.

intSetToPC :: IntSet -> Root -> PCSet Source

Transforms an interval set to and a root into a PCSet

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

Minimal complete definition

Nothing

Methods

(&==) :: a -> a -> Bool Source

(&/=) :: a -> a -> Bool Source

Instances

Diatonic Class

class (Generic a, Show a, Enum a, Bounded a) => Diatonic a Source

A class to mark certain datatypes to have a diatonic structure: http://en.wikipedia.org/wiki/Diatonic_and_chromatic