hmt-0.15: Haskell Music Theory

Safe Haskell | Safe
Language | Haskell98

Music.Theory.Clef

Description

Common music notation clefs.

Synopsis

- data Clef_T
  - = Bass
  - | Tenor
  - | Alto
  - | Treble
  - | Percussion
- data Clef i = Clef {
  - clef_t :: Clef_T
  - clef_octave :: i
  }
- clef_range :: Clef_T -> Maybe (Pitch, Pitch)
- clef_suggest :: Integral i => Pitch -> Clef i
- clef_zero :: Integral i => Clef i -> Clef i
- clef_restrict :: Integral i => i -> Clef i -> Clef i

# Documentation

data Clef_T Source #

Clef enumeration type.

Constructors

Bass |
Tenor |
Alto |
Treble |
Percussion |

Instances

Eq Clef_T Source # |
Methods (==) :: Clef_T -> Clef_T -> Bool # (/=) :: Clef_T -> Clef_T -> Bool #
Ord Clef_T Source # |
Methods compare :: Clef_T -> Clef_T -> Ordering # (<) :: Clef_T -> Clef_T -> Bool # (<=) :: Clef_T -> Clef_T -> Bool # (>) :: Clef_T -> Clef_T -> Bool # (>=) :: Clef_T -> Clef_T -> Bool # max :: Clef_T -> Clef_T -> Clef_T # min :: Clef_T -> Clef_T -> Clef_T #
Show Clef_T Source # |
Methods showsPrec :: Int -> Clef_T -> ShowS # show :: Clef_T -> String # showList :: [Clef_T] -> ShowS #

data Clef i Source #

Clef with octave offset.

Constructors

Clef |

Fields

- clef_t :: Clef_T
- clef_octave :: i

Instances

Eq i => Eq (Clef i) Source # |
Methods (==) :: Clef i -> Clef i -> Bool # (/=) :: Clef i -> Clef i -> Bool #
Ord i => Ord (Clef i) Source # |
Methods compare :: Clef i -> Clef i -> Ordering # (<) :: Clef i -> Clef i -> Bool # (<=) :: Clef i -> Clef i -> Bool # (>) :: Clef i -> Clef i -> Bool # (>=) :: Clef i -> Clef i -> Bool # max :: Clef i -> Clef i -> Clef i # min :: Clef i -> Clef i -> Clef i #
Show i => Show (Clef i) Source # |
Methods showsPrec :: Int -> Clef i -> ShowS # show :: Clef i -> String # showList :: [Clef i] -> ShowS #

clef_range :: Clef_T -> Maybe (Pitch, Pitch) Source #

Give clef range as a `Pitch` pair indicating the notes below and above the staff.

    map clef_range [Treble,Bass] == [Just (d4,g5),Just (f2,b3)]
    clef_range Percussion == Nothing

clef_suggest :: Integral i => Pitch -> Clef i Source #

Suggest a `Clef` given a `Pitch`.

    map clef_suggest [c2,c4] == [Clef Bass (-1),Clef Treble 0]

clef_zero :: Integral i => Clef i -> Clef i Source #

Set `clef_octave` to `0`.

clef_restrict :: Integral i => i -> Clef i -> Clef i Source #

Set `clef_octave` to be no further than r from `0`.