Safe Haskell | None |
---|---|
Language | Haskell2010 |
Provides pitch spelling.
- type Spelling = Semitones -> Number
- spell :: HasSemitones a => Spelling -> a -> Interval
- spelled :: HasSemitones a => a -> Spelling -> Interval
- modally :: Spelling
- usingSharps :: Spelling
- usingFlats :: Spelling
Spelling
About
TODO document better
The semitones
function retrieves the number of Semitones in a pitch, for example
semitones :: Interval -> Semitones semitones major third = 4
Note that semitones is surjetive. We can define a non-deterministic function spellings
spellings :: Semitones -> [Interval] spellings 4 = [majorThird, diminishedFourth]
Law
map semitones (spellings a) = replicate n a for all n > 0
Lemma
map semitones (spellings a)
Spelling type
type Spelling = Semitones -> Number Source
A spelling provide a way of notating a semitone interval such as tritone
.
Examples:
spell usingSharps tritone == _A4 spell usingFlats tritone == d5 spell modally tone == _M2
spell :: HasSemitones a => Spelling -> a -> Interval Source
Spell an interval using the given Spelling
.
spelled :: HasSemitones a => a -> Spelling -> Interval Source
Flipped version of spell
. To be used infix, as in:
d5 `spelled` usingSharps
Standard spellings
Spell using the most the most common accidentals. Double sharps and flats are not preserved.
This spelling is particularly useful for modal music where the tonic is C.
c cs d eb e f fs g gs a bb b
usingSharps :: Spelling Source
Spell using sharps. Double sharps and flats are not preserved.
c cs d ds e f fs g gs a as b
Spell using flats. Double sharps and flats are not preserved.
c db d eb e f gb g ab a bb b