midi-0.2.1.5: Handling of MIDI messages and files

Safe HaskellSafe-Inferred
LanguageHaskell2010

Sound.MIDI.Message.Channel

Description

Channel messages

Synopsis

Documentation

data T Source

Constructors

Cons 

Instances

Eq T 
Ord T 
Show T 
Arbitrary T 
C T 
C T 
C T 

data Body Source

Constructors

Voice T 
Mode T 

Instances

get :: C parser => Int -> Channel -> Int -> Fragile parser T Source

Parse a MIDI Channel message. Note that since getting the first byte is a little complex (there are issues with running status), the code, channel and first data byte must be determined by the caller.

getWithStatus :: C parser => Int -> Fragile (T parser) T Source

Parse an event. Note that in the case of a regular MIDI Event, the tag is the status, and we read the first byte of data before we call get. In the case of a MIDIEvent with running status, we find out the status from the parser (it's been nice enough to keep track of it for us), and the tag that we've already gotten is the first byte of data.

put :: C writer => T -> writer Source

putWithStatus :: C writer => T -> T writer Source

data Channel Source

This definition should be in Message.Channel, but this results in a cyclic import.

data Velocity Source

Instances

Bounded Velocity

ToDo: We have defined minBound = Velocity 0, but strictly spoken the minimum Velocity is 1, since Velocity zero means NoteOff. One can at least think of NoteOff with (Velocity 0), but I have never seen that.

Eq Velocity 
Ord Velocity 
Show Velocity 
Arbitrary Velocity 
Random Velocity 

data Controller Source

We do not define Controller as enumeration with many constructors, because some controllers have multiple names and some are undefined. It is also more efficient this way. Thus you cannot use case for processing controller types, but you can use lookup instead.

maybe (putStrLn "unsupported controller") putStrLn $
lookup ctrl $
   (portamento, "portamento") :
   (modulation, "modulation") :
   []

decodeStatus :: Int -> (Int, Channel) Source

for internal use