haskore-0.2.0.3: The Haskore Computer Music System

Safe Haskell | Safe-Inferred

Haskore.Basic.Pitch

Synopsis

- type T = (Octave, Class)
- data Class
  - = Cf
  - | C
  - | Cs
  - | Df
  - | D
  - | Ds
  - | Ef
  - | E
  - | Es
  - | Ff
  - | F
  - | Fs
  - | Gf
  - | G
  - | Gs
  - | Af
  - | A
  - | As
  - | Bf
  - | B
  - | Bs
- type Octave = Int
- type Absolute = Int
- type Relative = Int
- toInt :: T -> Absolute
- fromInt :: Absolute -> T
- classToInt :: Class -> Relative
- classParse :: ReadS Class
- classFormat :: Class -> ShowS
- intToFreq :: Floating a => Absolute -> a
- transpose :: Relative -> T -> T

# Documentation

type T = (Octave, Class)Source

data Class Source

Constructors

Cf |
C |
Cs |
Df |
D |
Ds |
Ef |
E |
Es |
Ff |
F |
Fs |
Gf |
G |
Gs |
Af |
A |
As |
Bf |
B |
Bs |

Instances

Enum Class |
Eq Class |
Ord Class |
Read Class |
Show Class |
Ix Class |
C Class |

type Octave = Int Source

& code{(-3,A)} & 27.5 Hz \ $A_1$ & code{(-2,A)} & 55.0 Hz \ $A $ & code{(-1,A)} & 110.0 Hz \ $a $ & code{( 0,A)} & 220.0 Hz \ $a^1$ & code{( 1,A)} & 440.0 Hz \ $a^2$ & code{( 2,A)} & 880.0 Hz end{tabular} end{center} caption{Note names, Haskore representations and frequencies.} figlabel{note-freqs} end{figure}

Treating pitches simply as integers is useful in many settings, so let's also define some functions for converting between type{Pitch.T} values and type{Pitch.Absolute} values (integers): begin{haskelllisting}

type Absolute = Int Source

type Relative = Int Source

toInt :: T -> Absolute Source

fromInt :: Absolute -> T Source

classToInt :: Class -> Relative Source

classParse :: ReadS Class Source

classFormat :: Class -> ShowS Source

intToFreq :: Floating a => Absolute -> aSource

transpose :: Relative -> T -> T Source