Karya, built on 2022-03-21T01:30:44 (patch 89d1651424c35e564138d93424a157ff87457245)
Safe HaskellSafe-Inferred

Midi.Midi

Synopsis

Documentation

type WriteMessages = [WriteMessage] Source #

Declared abstract here so I can switch to a more compact representation later.

data WriteMessage Source #

Constructors

WriteMessage 

Instances

Instances details
Read WriteMessage Source # 
Instance details

Defined in Midi.Midi

Show WriteMessage Source # 
Instance details

Defined in Midi.Midi

DeepSeq.NFData WriteMessage Source # 
Instance details

Defined in Midi.Midi

Methods

rnf :: WriteMessage -> () #

Eq WriteMessage Source # 
Instance details

Defined in Midi.Midi

Ord WriteMessage Source # 
Instance details

Defined in Midi.Midi

Pretty.Pretty WriteMessage Source # 
Instance details

Defined in Midi.Midi

Pretty.Pretty MidiPerformance Source # 
Instance details

Defined in Ui.UiConfig

Serialize.Serialize WriteMessage Source # 
Instance details

Defined in Midi.Instances

data ReadMessage Source #

Constructors

ReadMessage 

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.

constructors

program_change :: Int -> Program -> [ChannelMessage] Source #

Emit a program change with bank in [msb, lsb, pchange] order.

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.

data MpeZone Source #

Constructors

Lower 
Upper 

Instances

Instances details
Show MpeZone Source # 
Instance details

Defined in Midi.Midi

Eq MpeZone Source # 
Instance details

Defined in Midi.Midi

Methods

(==) :: MpeZone -> MpeZone -> Bool #

(/=) :: MpeZone -> MpeZone -> Bool #

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.

modify

predicates

valid_msg :: Message -> Bool Source #

Check to make sure midi msg vals are all in range.

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

data Message Source #

Instances

Instances details
Read Message Source # 
Instance details

Defined in Midi.Midi

Show Message Source # 
Instance details

Defined in Midi.Midi

DeepSeq.NFData Message Source # 
Instance details

Defined in Midi.Midi

Methods

rnf :: Message -> () #

Eq Message Source # 
Instance details

Defined in Midi.Midi

Methods

(==) :: Message -> Message -> Bool #

(/=) :: Message -> Message -> Bool #

Ord Message Source # 
Instance details

Defined in Midi.Midi

Pretty.Pretty Message Source # 
Instance details

Defined in Midi.Midi

Serialize.Serialize Message Source # 
Instance details

Defined in Midi.Instances

type Channel = Word4 Source #

type Velocity = Word7 Source #

type Program = Word7 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 #

newtype Key Source #

Constructors

Key Int 

Instances

Instances details
Enum Key Source # 
Instance details

Defined in Midi.Midi

Methods

succ :: Key -> Key #

pred :: Key -> Key #

toEnum :: Int -> Key #

fromEnum :: Key -> Int #

enumFrom :: Key -> [Key] #

enumFromThen :: Key -> Key -> [Key] #

enumFromTo :: Key -> Key -> [Key] #

enumFromThenTo :: Key -> Key -> Key -> [Key] #

Num Key Source # 
Instance details

Defined in Midi.Midi

Methods

(+) :: Key -> Key -> Key #

(-) :: Key -> Key -> Key #

(*) :: Key -> Key -> Key #

negate :: Key -> Key #

abs :: Key -> Key #

signum :: Key -> Key #

fromInteger :: Integer -> Key #

Read Key Source # 
Instance details

Defined in Midi.Midi

Show Key Source # 
Instance details

Defined in Midi.Midi

Methods

showsPrec :: Int -> Key -> ShowS #

show :: Key -> String #

showList :: [Key] -> ShowS #

DeepSeq.NFData Key Source # 
Instance details

Defined in Midi.Midi

Methods

rnf :: Key -> () #

Eq Key Source # 
Instance details

Defined in Midi.Midi

Methods

(==) :: Key -> Key -> Bool #

(/=) :: Key -> Key -> Bool #

Ord Key Source # 
Instance details

Defined in Midi.Midi

Methods

compare :: Key -> Key -> Ordering #

(<) :: Key -> Key -> Bool #

(<=) :: Key -> Key -> Bool #

(>) :: Key -> Key -> Bool #

(>=) :: Key -> Key -> Bool #

max :: Key -> Key -> Key #

min :: Key -> Key -> Key #

Pretty.Pretty Key Source # 
Instance details

Defined in Midi.Midi

Serialize.Serialize Key Source # 
Instance details

Defined in Midi.Midi

from_key :: Num a => Key -> a Source #

to_key :: Integral a => a -> Key Source #

to_closest_key :: RealFrac a => a -> (Key, a) Source #

data ChannelMessage Source #

Constructors

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.

MTC

data Mtc Source #

Constructors

Mtc !SmpteFragment !Word4 

Instances

Instances details
Read Mtc Source # 
Instance details

Defined in Midi.Midi

Show Mtc Source # 
Instance details

Defined in Midi.Midi

Methods

showsPrec :: Int -> Mtc -> ShowS #

show :: Mtc -> String #

showList :: [Mtc] -> ShowS #

Eq Mtc Source # 
Instance details

Defined in Midi.Midi

Methods

(==) :: Mtc -> Mtc -> Bool #

(/=) :: Mtc -> Mtc -> Bool #

Ord Mtc Source # 
Instance details

Defined in Midi.Midi

Methods

compare :: Mtc -> Mtc -> Ordering #

(<) :: Mtc -> Mtc -> Bool #

(<=) :: Mtc -> Mtc -> Bool #

(>) :: Mtc -> Mtc -> Bool #

(>=) :: Mtc -> Mtc -> Bool #

max :: Mtc -> Mtc -> Mtc #

min :: Mtc -> Mtc -> Mtc #

data SmpteFragment Source #

Instances

Instances details
Enum SmpteFragment Source # 
Instance details

Defined in Midi.Midi

Read SmpteFragment Source # 
Instance details

Defined in Midi.Midi

Show SmpteFragment Source # 
Instance details

Defined in Midi.Midi

Eq SmpteFragment Source # 
Instance details

Defined in Midi.Midi

Ord SmpteFragment Source # 
Instance details

Defined in Midi.Midi

data Smpte Source #

Instances

Instances details
Show Smpte Source # 
Instance details

Defined in Midi.Midi

Methods

showsPrec :: Int -> Smpte -> ShowS #

show :: Smpte -> String #

showList :: [Smpte] -> ShowS #

Eq Smpte Source # 
Instance details

Defined in Midi.Midi

Methods

(==) :: Smpte -> Smpte -> Bool #

(/=) :: Smpte -> Smpte -> Bool #

seconds_to_frame :: FrameRate -> Seconds -> Frames Source #

frame_to_seconds :: FrameRate -> Frames -> Seconds 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

realtime_tuning :: [(Key, NoteNumber)] -> Message Source #

Create a realtime tuning msg. Few synthesizers support this.

Based on http://www.midi.org/techspecs/midituning.php

util

join14 :: Word7 -> Word7 -> Int Source #

Join (LSB, MSB) 7-bit words into an int.

split14 Source #

Arguments

:: Int 
-> (Word7, Word7)

(LSB, MSB)

Split an Int into two 7 bit words.

join4 :: Word4 -> Word4 -> Word7 Source #

Join (MSB, LSB) into a Word7.

split4 Source #

Arguments

:: Word8 
-> (Word4, Word4)

(MSB, LSB)

Split a Word8 into nibbles.

manufacturer