Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- data MidiMessage
- data ChannelVoice
- = NoteOff !Channel !Pitch !Velocity
- | NoteOn !Channel !Pitch !Velocity
- | Aftertouch !Channel !Pitch !Touch
- | ControlChange !Channel !Controller !Word8
- | PatchChange !Channel !Patch
- | ChannelPressure !Channel !Touch
- | PitchBend !Channel !Word16
- data ChannelMode
- = AllSoundOff !Channel
- | ResetAllControllers !Channel
- | LocalControl !Channel !Bool
- | AllNotesOff !Channel
- | OmniOff !Channel
- | OmniOn !Channel
- | MonoOn !Channel !Word8
- | PolyOn !Channel
- data SystemCommon
- data SystemRealTime
- data SystemExclusive = Exclusive !VendorId ByteString
- data VendorId
- = VendorIdShort !Word8
- | VendorIdLong !Word8 !Word8
- newtype Channel = Channel {
- getChannel :: Word8
- mkChannel :: Integral a => a -> Channel
- newtype Pitch = Pitch {}
- mkPitch :: Integral a => a -> Pitch
- middleC :: Pitch
- newtype Patch = Patch {}
- mkPatch :: Integral a => a -> Patch
- newtype Velocity = Velocity {
- getVelocity :: Word8
- mkVelocity :: Integral a => a -> Velocity
- newtype Touch = Touch {}
- mkTouch :: Integral a => a -> Touch
- newtype Controller = Controller {}
- mkController :: Integral a => a -> Controller
- newtype PositionPointer = PositionPointer {}
- mkPositionPointer :: Integral a => a -> PositionPointer
- toClocks :: PositionPointer -> Int
- to4Bit :: Integral a => a -> Word8
- to7Bit :: Integral a => a -> Word8
- to14Bit :: Integral a => a -> Word16
MIDI messages
data MidiMessage Source #
A data type representing midi messages. Messages can be categorized into 5 subcategories
- Channel Voice Messages. Start, stop, or alter sounds being played.
- Channel Mode Messages. Control messages affecting the entire channel.
- System Real-Time Messages. Used by sequencers to regulate and synchronize timing.
- System Common Messages. Used for song selection, position pointers, etc.
- System Exclusive Messages. Used for device-specific extensions to the MIDI protocol.
Basic MIDI types
data ChannelVoice Source #
Type holding channel voice messages. Channel Voice messages transmit real-time performance data over a single channel. Examples include "note-on" messages which contain a MIDI note number that specifies the note's pitch, a velocity value that indicates how forcefully the note was played, and the channel number; "note-off" messages that end a note; program change messages that change a device's patch; and control changes that allow adjustment of an instrument's parameters.
data ChannelMode Source #
A type for channel mode messages. Mode messages determine how an instrument will receive all subsequent voice messages. This includes whether the receiver will play notes monophonically or polyphonically and whether it will respond only to data sent on one specific voice channel or all of them.
data SystemCommon Source #
A type for system common messages. System common messages are intended for all receivers in the system.
data SystemRealTime Source #
System real time messages. The MIDI System Real Time messages are used to synchronize all of the MIDI clock-based equipment within a system, such as sequencers and drum machines. Most of the System Real Time messages are normally ignored by keyboard instruments and synthesizers. To help ensure accurate timing, System Real Time messages are given priority over other messages, and these single-byte messages may occur anywhere in the data stream (a Real Time message may appear between the status byte and data byte of some other MIDI message).
data SystemExclusive Source #
System exclusive messages. System Exclusive messages may be used to send
data such as patch parameters or sample data between MIDI devices.
Manufacturers of MIDI equipment may define their own formats for System
Exclusive data. Manufacturers are granted unique identification (ID) numbers
by the MMA or the JMSC, and the manufacturer ID number is included as part of
the System Exclusive message. See VendorId
.
The representation used here is deliberately generic. Special sets of system exclusive messages can be implemented on top of this type.
Data type encapsulating vendor ID numbers as used in SystemExclusive
.
They have one of two possible formats:
- A one byte ID (represented by
VendorIdShort
) - A three byte ID, which must begin with
0x00
. (VendorIdLong
)
Numeric MIDI data
Only use the direct constructors when you can assure that the values fit into 7 bits! In general you should prefer the smart constructors. For values outside of the 7 bit range, the numbers should generally wrap around, but no guarantees are made!
The middle C on a piano as defined by the MIDI specification. This can serve as a reference value for working with pitches.
mkVelocity :: Integral a => a -> Velocity Source #
newtype Controller Source #
mkController :: Integral a => a -> Controller Source #
newtype PositionPointer Source #
mkPositionPointer :: Integral a => a -> PositionPointer Source #
toClocks :: PositionPointer -> Int Source #
Convert a PositionPointer
, used to indicate song position, to the MIDI
clock. Song Position Pointer is always multiplied by 6 times the MIDI clocks
(F8H). Thus the smallest Song Position change is 6 MIDI clocks, or 1/16 note.