music-score-1.6: Musical score and part representation.

Portabilitynon-portable (TF,GNTD)
Safe HaskellNone






class HasMidi a whereSource

Class of types that can be converted to MIDI.

Numeric types are interpreted as notes with a default velocity, pairs are interpreted as (pitch, velocity) pairs.

Minimal definition: getMidi. Given getMidiScore, getMidi can be implemented as getMidiScore . return.


getMidi :: a -> Score MessageSource

Convert a value to a MIDI score. Typically, generates an on event using note followed by an optional off event.

getMidiScore :: Score a -> Score MessageSource

Convert a score to a MIDI score. The default definition can be overriden for efficiency.

type HasMidiPart a = (HasPart' a, HasMidiProgram (Part a))Source

Class of types with MIDI-compatible parts.

class HasMidiProgram a whereSource

Class of part types with an associated MIDI program number.

toMidi :: forall a. (HasMidiPart a, HasMidi a) => Score a -> MidiSource

Convert a score to a MIDI file representation.

toMidiTrack :: HasMidi a => Score a -> Track MessageSource

Convert a score to a track of MIDI messages.

writeMidi :: (HasMidiPart a, HasMidi a) => FilePath -> Score a -> IO ()Source

Convert a score MIDI and write to a file.