Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
The hardware-independent part of the MIDI binding.
- type TimeStamp = Word32
- data MidiMessage'
- = NoteOff !Int
- | NoteOn !Int !Int
- | PolyAftertouch !Int !Int
- | CC !Int !Int
- | ProgramChange !Int
- | Aftertouch !Int
- | PitchWheel !Int
- data MidiMessage
- = MidiMessage !Int !MidiMessage'
- | SysEx [Word8]
- | SongPosition !Int
- | SongSelect !Int
- | TuneRequest
- | SRTClock
- | SRTStart
- | SRTContinue
- | SRTStop
- | ActiveSensing
- | Reset
- | Undefined
- data MidiEvent = MidiEvent !TimeStamp !MidiMessage
- type ClientCallback = MidiEvent -> IO ()
- data ShortMessage = ShortMessage {}
- translateShortMessage :: ShortMessage -> MidiMessage
- untranslateShortMessage :: MidiMessage -> ShortMessage
- shortMessage :: Int -> Int -> Int -> Int -> ShortMessage
Documentation
data MidiMessage' Source
A "regular" MIDI message.
Remark: NoteOff
not having a velocity field is a design decision, and a questionable one. According to the
MIDI standard, NoteOff also has a velocity. However, most keyboards do not use this feature (send the default
value 64), and there are keyboards which do not send NoteOff messages at all, but send NoteOn messages with
zero velocity instead (for example the EMU Xboard series). I don't know what would be a good solution.
At the moment, the code auto-translates NoteOn messages with zero velocity to NoteOff messages, and the
NoteOff velocity is ignored. This behaviour can be inverted with the Cabal flag NoNoteOff.
NoteOff !Int | Note Off (key) |
NoteOn !Int !Int | Note On (key, velocity) |
PolyAftertouch !Int !Int | Polyphonic key pressure (key, pressure) |
CC !Int !Int | Control Change (controller, value) |
ProgramChange !Int | Program Change (program) |
Aftertouch !Int | Global aftertouch (pressure) |
PitchWheel !Int | Pitch wheel (value, from -8192..+8191) |
data MidiMessage Source
The type representing a MIDI message.
MidiMessage !Int !MidiMessage' | first argument is the MIDI channel (1..16) |
SysEx [Word8] | not including the bytes 0xf0, 0xf7 |
SongPosition !Int | |
SongSelect !Int | |
TuneRequest | |
SRTClock | |
SRTStart | |
SRTContinue | |
SRTStop | |
ActiveSensing | |
Reset | |
Undefined |
The type representing a timestamped MIDI message.
Time is measured in milisecs elapsed since the last call to start
.
type ClientCallback = MidiEvent -> IO () Source
Type of the user callback function.
shortMessage :: Int -> Int -> Int -> Int -> ShortMessage Source