midi-0.2.0.1: Handling of MIDI messages and files

Safe Haskell | None

Sound.MIDI.File.Event

Description

MIDI messages in MIDI files. They are not a superset of the messages, that are used for real-time communication between MIDI devices. For these refer to Sound.MIDI.Message. Namely System Common and System Real Time messages are missing. If you need both real-time and file messages (say for ALSA sequencer), you need a custom datatype.

Synopsis

- data T
  - = MIDIEvent T
  - | MetaEvent T
  - | SystemExclusive T
- get :: C parser => Fallible (T parser) T
- put :: C writer => T -> T writer
- type TrackEvent = (ElapsedTime, T)
- getTrackEvent :: C parser => Fallible (T parser) TrackEvent
- type ElapsedTime = Integer
- fromElapsedTime :: ElapsedTime -> Integer
- toElapsedTime :: Integer -> ElapsedTime
- mapBody :: (T -> T) -> TrackEvent -> TrackEvent
- maybeMIDIEvent :: T -> Maybe T
- maybeMetaEvent :: T -> Maybe T
- maybeVoice :: T -> Maybe (Channel, T)
- mapVoice :: (T -> T) -> T -> T

# Documentation

data T Source

Constructors

MIDIEvent T |
MetaEvent T |
SystemExclusive T |

Instances

Eq T |
Ord T |
Show T |
Arbitrary T |

get :: C parser => Fallible (T parser) T Source

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

The following functions encode various `T` elements into the raw data of a standard MIDI file.

type TrackEvent = (ElapsedTime, T)Source

getTrackEvent :: C parser => Fallible (T parser) TrackEvent Source

Each event is preceded by the delta time: the time in ticks between the last event and the current event. Parse a time and an event, ignoring System Exclusive messages.

type ElapsedTime = Integer Source

fromElapsedTime :: ElapsedTime -> Integer Source

toElapsedTime :: Integer -> ElapsedTime Source

mapBody :: (T -> T) -> TrackEvent -> TrackEvent Source

maybeMIDIEvent :: T -> Maybe T Source

maybeMetaEvent :: T -> Maybe T Source

maybeVoice :: T -> Maybe (Channel, T)Source

mapVoice :: (T -> T) -> T -> T Source