]> Git — Sourcephile - tmp/julm/arpeggigon.git/blob - Reactogon/MIDI.hs
Cleaned move.
[tmp/julm/arpeggigon.git] / Reactogon / MIDI.hs
1 module MIDI ( SampleRate
2 , Pitch
3 , toPitch
4 , fromPitch
5 , Velocity
6 , Voice ( fromVoice
7 , toVoice
8 )
9 , Note(..)
10 ) where
11
12 import Sound.MIDI.Message.Channel.Voice ( fromPitch
13 , toPitch
14 )
15 import qualified Sound.MIDI.Message.Channel.Voice as Voice
16
17 type SampleRate = Int
18
19 type Pitch = Voice.Pitch
20 type Velocity = Voice.Velocity
21
22 class Voice a where
23 fromVoice :: Voice.T -> Maybe a
24 toVoice :: a -> Voice.T
25
26 data Note = NoteOn Pitch Velocity
27 | NoteOff Pitch Velocity
28 deriving(Show)
29
30 instance Voice Note where
31 fromVoice (Voice.NoteOn p v) = Just $ NoteOn p v
32 fromVoice (Voice.NoteOff p v) = Just $ NoteOff p v
33 fromVoice _ = Nothing
34 toVoice (NoteOn p v) = Voice.NoteOn p v
35 toVoice (NoteOff p v) = Voice.NoteOff p v