1 module MIDI ( SampleRate
15 import Sound.MIDI.Message.Channel.Voice ( fromPitch
18 import qualified Sound.MIDI.Message.Channel.Voice as Voice
22 type Pitch = Voice.Pitch
23 type Velocity = Voice.Velocity
26 fromVoice :: Voice.T -> Maybe a
27 toVoice :: a -> Voice.T
29 data Note = NoteOn Pitch Velocity
30 | NoteOff Pitch Velocity
33 instance Voice Note where
34 fromVoice (Voice.NoteOn p v) = Just $ NoteOn p v
35 fromVoice (Voice.NoteOff p v) = Just $ NoteOff p v
37 toVoice (NoteOn p v) = Voice.NoteOn p v
38 toVoice (NoteOff p v) = Voice.NoteOff p v
40 type ControllerIdx = Voice.Controller
41 type ControllerValue = Int
43 data Control = Control ControllerIdx ControllerValue
45 instance Voice Control where
46 fromVoice (Voice.Control i v) = Just $ Control i v
48 toVoice (Control i v) = Voice.Control i v