Safe Haskell | Safe-Inferred |
---|
Synopsis
- type WriteMessages = [WriteMessage]
- type ReadMessages = [ReadMessage]
- data WriteMessage = WriteMessage {}
- data ReadMessage = ReadMessage {}
- data ReadDevice
- data WriteDevice
- read_device :: Text -> ReadDevice
- write_device :: Text -> WriteDevice
- read_device_text :: ReadDevice -> Text
- write_device_text :: WriteDevice -> Text
- peek_wdev :: CString -> IO WriteDevice
- peek_rdev :: CString -> IO ReadDevice
- with_wdev :: WriteDevice -> (CString -> IO a) -> IO a
- with_rdev :: ReadDevice -> (CString -> IO a) -> IO a
- add_timestamp :: RealTime -> WriteMessage -> WriteMessage
- modify_timestamp :: (RealTime -> RealTime) -> WriteMessage -> WriteMessage
- program_change :: Int -> Program -> [ChannelMessage]
- reset_channel :: Channel -> [Message]
- realtime_sysex :: ByteString.ByteString -> Message
- pitch_bend_range :: Double -> [ChannelMessage]
- nrpn_tuning :: [(Key, NoteNumber)] -> [ChannelMessage]
- data MpeZone
- mpe_2_to_16 :: [Message]
- rpn :: (ControlValue, ControlValue) -> (ControlValue, ControlValue) -> [ChannelMessage]
- nrpn :: (ControlValue, ControlValue) -> (ControlValue, ControlValue) -> [ChannelMessage]
- set_channel :: Channel -> Message -> Message
- valid_msg :: Message -> Bool
- valid_chan_msg :: ChannelMessage -> Bool
- is_cc :: Message -> Bool
- is_sysex :: Message -> Bool
- is_note :: Message -> Bool
- is_note_on :: Message -> Bool
- is_state :: Message -> Bool
- is_pitched :: Message -> Bool
- channel_message :: Message -> Maybe.Maybe ChannelMessage
- message_channel :: Message -> Maybe.Maybe Channel
- data Message
- type Channel = Word4
- type Velocity = Word7
- type Control = CC.Control
- type Program = Word7
- type ControlValue = Word7
- type PitchBendValue = Float
- type Manufacturer = Word7
- newtype Key = Key Int
- from_key :: Num a => Key -> a
- to_key :: Integral a => a -> Key
- to_closest_key :: RealFrac a => a -> (Key, a)
- data ChannelMessage
- = NoteOff !Key !Velocity
- | NoteOn !Key !Velocity
- | Aftertouch !Key !ControlValue
- | ControlChange !Control !ControlValue
- | ProgramChange !Program
- | ChannelPressure !ControlValue
- | PitchBend !PitchBendValue
- | PitchBendInt !Word7 !Word7
- | AllSoundOff
- | ResetAllControls
- | LocalControl !Bool
- | AllNotesOff
- | UndefinedChannelMode !Word7 !Word7
- data CommonMessage
- data RealtimeMessage
- data Mtc = Mtc !SmpteFragment !Word4
- data FrameRate
- data SmpteFragment
- data Smpte = Smpte {
- smpte_hours :: !Word8
- smpte_minutes :: !Word8
- smpte_seconds :: !Word8
- smpte_frames :: !Word8
- seconds_to_frame :: FrameRate -> Seconds -> Frames
- frame_to_seconds :: FrameRate -> Frames -> Seconds
- frame_to_smpte :: FrameRate -> Frames -> Smpte
- seconds_to_smpte :: FrameRate -> Seconds -> Smpte
- generate_mtc :: FrameRate -> Frames -> [(Double, Message)]
- mtc_sync :: FrameRate -> Smpte -> Message
- mtc_fragments :: FrameRate -> Smpte -> [Mtc]
- type NoteNumber = Double
- realtime_tuning :: [(Key, NoteNumber)] -> Message
- join14 :: Word7 -> Word7 -> Int
- split14 :: Int -> (Word7, Word7)
- join4 :: Word4 -> Word4 -> Word7
- split4 :: Word8 -> (Word4, Word4)
- manufacturer_name :: Manufacturer -> Text
- yamaha_code :: Manufacturer
- korg_code :: Manufacturer
Documentation
type WriteMessages = [WriteMessage] Source #
Declared abstract here so I can switch to a more compact representation later.
type ReadMessages = [ReadMessage] Source #
data WriteMessage Source #
Instances
data ReadMessage Source #
Instances
devices
data ReadDevice Source #
Implementation independent representation of a MIDI Device.
This can be saved to and loaded from files without regard for the devices actually installed or opened.
Instances
data WriteDevice Source #
Instances
read_device :: Text -> ReadDevice Source #
write_device :: Text -> WriteDevice Source #
read_device_text :: ReadDevice -> Text Source #
write_device_text :: WriteDevice -> Text Source #
add_timestamp :: RealTime -> WriteMessage -> WriteMessage Source #
modify_timestamp :: (RealTime -> RealTime) -> WriteMessage -> WriteMessage Source #
constructors
program_change :: Int -> Program -> [ChannelMessage] Source #
Emit a program change with bank in [msb, lsb, pchange] order.
reset_channel :: Channel -> [Message] Source #
realtime_sysex :: ByteString.ByteString -> Message Source #
This is a special kind of sysex which is meant to be interpreted in real time.
rpn / nrpn
pitch_bend_range :: Double -> [ChannelMessage] Source #
Emit a pitch bend range RPN message for the given range.
nrpn_tuning :: [(Key, NoteNumber)] -> [ChannelMessage] Source #
This is an emulation of realtime_tuning
for Kontakt KSP, which
understands NRPNs, but not sysex.
Each key gets (50, 0) with the source key, (51, 0) with the destination, and (52, 0) with tenths of a cent as a 14-bit number. I have to put source and destination NoteNumbers into separate NRPN numbers because msb and lsb arrive separately, so they pretty much have to be used as msb and lsb of a single number.
The KSP for this is UserElaforgeInstrumentKontaktksp/nrpn_tuning.ksp.
mpe_2_to_16 :: [Message] Source #
MPE config where channel 0 is the useless master and 1-15 are used for notes. This is the one the MPE doc recommends MPE synths start up in.
rpn :: (ControlValue, ControlValue) -> (ControlValue, ControlValue) -> [ChannelMessage] Source #
nrpn :: (ControlValue, ControlValue) -> (ControlValue, ControlValue) -> [ChannelMessage] Source #
modify
predicates
valid_chan_msg :: ChannelMessage -> Bool Source #
is_note_on :: Message -> Bool Source #
is_state :: Message -> Bool Source #
Is this a message that will change the channel state? These are the messages that will affect subsequent NoteOns.
is_pitched :: Message -> Bool Source #
True for messages with a pitch: NoteOn, NoteOff and PitchBend.
types
ChannelMessage !Channel !ChannelMessage | |
CommonMessage !CommonMessage | |
RealtimeMessage !RealtimeMessage | |
UnknownMessage !Word8 !Word8 !Word8 |
type Control = CC.Control Source #
type ControlValue = Word7 Source #
type PitchBendValue = Float Source #
This is converted to and from the -0x2000 and +0x2000 range by the parser.
type Manufacturer = Word7 Source #
to_closest_key :: RealFrac a => a -> (Key, a) Source #
data ChannelMessage Source #
NoteOff !Key !Velocity | |
NoteOn !Key !Velocity | |
Aftertouch !Key !ControlValue | |
ControlChange !Control !ControlValue | |
ProgramChange !Program | |
ChannelPressure !ControlValue | |
PitchBend !PitchBendValue | |
PitchBendInt !Word7 !Word7 | This is PitchBend, but with precise control over the bytes sent. |
AllSoundOff | channel mode messages (special control values) |
ResetAllControls | |
LocalControl !Bool | |
AllNotesOff | |
UndefinedChannelMode !Word7 !Word7 | There are a few values in the ChannelMode range left undefined. |
Instances
data CommonMessage Source #
SystemExclusive !Manufacturer !ByteString.ByteString | manufacturer id, data including eox |
SongPositionPointer !Int | |
SongSelect !Word8 | |
TuneRequest | |
EOX | |
UndefinedCommon !Word8 |
Instances
Read CommonMessage Source # | |
Defined in Midi.Midi readsPrec :: Int -> ReadS CommonMessage # readList :: ReadS [CommonMessage] # | |
Show CommonMessage Source # | |
Defined in Midi.Midi showsPrec :: Int -> CommonMessage -> ShowS # show :: CommonMessage -> String # showList :: [CommonMessage] -> ShowS # | |
DeepSeq.NFData CommonMessage Source # | |
Defined in Midi.Midi rnf :: CommonMessage -> () # | |
Eq CommonMessage Source # | |
Defined in Midi.Midi (==) :: CommonMessage -> CommonMessage -> Bool # (/=) :: CommonMessage -> CommonMessage -> Bool # | |
Ord CommonMessage Source # | |
Defined in Midi.Midi compare :: CommonMessage -> CommonMessage -> Ordering # (<) :: CommonMessage -> CommonMessage -> Bool # (<=) :: CommonMessage -> CommonMessage -> Bool # (>) :: CommonMessage -> CommonMessage -> Bool # (>=) :: CommonMessage -> CommonMessage -> Bool # max :: CommonMessage -> CommonMessage -> CommonMessage # min :: CommonMessage -> CommonMessage -> CommonMessage # |
data RealtimeMessage Source #
Instances
Read RealtimeMessage Source # | |
Defined in Midi.Midi | |
Show RealtimeMessage Source # | |
Defined in Midi.Midi showsPrec :: Int -> RealtimeMessage -> ShowS # show :: RealtimeMessage -> String # showList :: [RealtimeMessage] -> ShowS # | |
DeepSeq.NFData RealtimeMessage Source # | |
Defined in Midi.Midi rnf :: RealtimeMessage -> () # | |
Eq RealtimeMessage Source # | |
Defined in Midi.Midi (==) :: RealtimeMessage -> RealtimeMessage -> Bool # (/=) :: RealtimeMessage -> RealtimeMessage -> Bool # | |
Ord RealtimeMessage Source # | |
Defined in Midi.Midi compare :: RealtimeMessage -> RealtimeMessage -> Ordering # (<) :: RealtimeMessage -> RealtimeMessage -> Bool # (<=) :: RealtimeMessage -> RealtimeMessage -> Bool # (>) :: RealtimeMessage -> RealtimeMessage -> Bool # (>=) :: RealtimeMessage -> RealtimeMessage -> Bool # max :: RealtimeMessage -> RealtimeMessage -> RealtimeMessage # min :: RealtimeMessage -> RealtimeMessage -> RealtimeMessage # |
MTC
Mtc !SmpteFragment !Word4 |
Instances
Enum FrameRate Source # | |
Defined in Midi.Midi succ :: FrameRate -> FrameRate # pred :: FrameRate -> FrameRate # fromEnum :: FrameRate -> Int # enumFrom :: FrameRate -> [FrameRate] # enumFromThen :: FrameRate -> FrameRate -> [FrameRate] # enumFromTo :: FrameRate -> FrameRate -> [FrameRate] # enumFromThenTo :: FrameRate -> FrameRate -> FrameRate -> [FrameRate] # | |
Show FrameRate Source # | |
data SmpteFragment Source #
Instances
Smpte | |
|
seconds_to_frame :: FrameRate -> Seconds -> Frames Source #
frame_to_seconds :: FrameRate -> Frames -> Seconds Source #
frame_to_smpte :: FrameRate -> Frames -> Smpte Source #
seconds_to_smpte :: FrameRate -> Seconds -> Smpte Source #
generate_mtc :: FrameRate -> Frames -> [(Double, Message)] Source #
Generate MTC starting at the given time and going on until the well of time runs dry. Or 7 bits overflow.
Since MTC can only start on a frame, the first returned time might be slightly before the requested time.
One MtcQuarterFrame is transmitted per quarter frame. Since it takes 8 to make a complete SMPTE frame, you wind up getting every other frame.
mtc_sync :: FrameRate -> Smpte -> Message Source #
Send full MTC sync code. This is supposed to happen every time there is a time dicontinuity.
tuning
type NoteNumber = Double Source #
realtime_tuning :: [(Key, NoteNumber)] -> Message Source #
Create a realtime tuning msg. Few synthesizers support this.
util
manufacturer
manufacturer_name :: Manufacturer -> Text Source #