1 module MIDI ( SampleRate
17 import Sound.MIDI.Message.Channel.Voice ( fromPitch
22 import qualified Sound.MIDI.Message.Channel.Voice as Voice
26 type Pitch = Voice.Pitch
27 type Velocity = Voice.Velocity
30 fromVoice :: Voice.T -> Maybe a
31 toVoice :: a -> Voice.T
33 data Note = NoteOn Pitch Velocity
34 | NoteOff Pitch Velocity
37 instance Voice Note where
38 fromVoice (Voice.NoteOn p v) = Just $ NoteOn p v
39 fromVoice (Voice.NoteOff p v) = Just $ NoteOff p v
41 toVoice (NoteOn p v) = Voice.NoteOn p v
42 toVoice (NoteOff p v) = Voice.NoteOff p v
44 type ControllerIdx = Voice.Controller
45 type ControllerValue = Int
47 data Control = Control ControllerIdx ControllerValue
49 instance Voice Control where
50 fromVoice (Voice.Control i v) = Just $ Control i v
52 toVoice (Control i v) = Voice.Control i v