zmidi-core-0.6.0: Read and write MIDI files.

PortabilityAs per dependencies.
Stabilityunstable
MaintainerStephen Tetley <stephen.tetley@gmail.com>
Safe HaskellNone

ZMidi.Core.ReadFile

Contents

Description

A top down (Parsec style) MIDI file parser.

For valid input, the parser should parse without error (i.e all cases of event types are fully enumerated). Malformed input (syntactically bad events, or truncated data) will cause fatal parse errors.

Note - the parser returns a literal result if the input uses Running Status, i.e, - the answer matches the input - where running status uses a NoteOn event with velocity 0 to stand for a NoteOff, the parser likewise returns a Note-On. Use the ZMidi.Core.Canonical to translate the input to canonical form where note-offs are encoded directly with NoteOff.

Synopsis

Read a MIDI file

readMidi :: FilePath -> IO (Either ParseErr MidiFile)Source

Read a well formed MIDI file.

Auxiallary types

data ParseErr Source

ParseErr is the position of the error and a message.

Constructors

ParseErr !Pos !ErrMsg 

Instances

type Pos = IntSource

Position of the parser in the input stream.

This is exposed by the ReadFile API and may be useful for disassembling a MIDI file that causes a parse failure.

type ErrMsg = StringSource

Error message - alias for String.