midi-0.0.5: Handling of MIDI messages and filesSource codeContentsIndex
Sound.MIDI.File
Description

MIDI-File Datatype

Taken from Haskore.

Synopsis
data T = Cons Type Division [Track]
data Division
= Ticks Tempo
| SMPTE Int Int
type Track = T ElapsedTime Event
data Type
= Mixed
| Parallel
| Serial
type SchedEvent = (ElapsedTime, Event)
data Event
= MIDIEvent Channel T
| MetaEvent MetaEvent
| SysExStart ByteString
| SysExCont ByteString
type ElapsedTime = Integer
type Tempo = Int
type SMPTEHours = Int
type SMPTEMins = Int
type SMPTESecs = Int
type SMPTEFrames = Int
type SMPTEBits = Int
data MetaEvent
= SequenceNum Int
| TextEvent String
| Copyright String
| TrackName String
| InstrName String
| Lyric String
| Marker String
| CuePoint String
| MIDIPrefix Channel
| EndOfTrack
| SetTempo Tempo
| SMPTEOffset SMPTEHours SMPTEMins SMPTESecs SMPTEFrames SMPTEBits
| TimeSig Int Int Int Int
| KeySig Key Mode
| SequencerSpecific ByteString
| Unknown Int ByteString
maybeMIDIEvent :: Event -> Maybe (Channel, T)
maybeMetaEvent :: Event -> Maybe MetaEvent
data Key
= KeyCf
| KeyGf
| KeyDf
| KeyAf
| KeyEf
| KeyBf
| KeyF
| KeyC
| KeyG
| KeyD
| KeyA
| KeyE
| KeyB
| KeyFs
| KeyCs
data Mode
= Major
| Minor
defltST :: Tempo
defltDurT :: ElapsedTime
empty :: T
showLines :: T -> String
changeVelocity :: Double -> T -> T
getTracks :: T -> [Track]
resampleTime :: Double -> T -> T
showEvent :: Event -> ShowS
showTime :: ElapsedTime -> ShowS
sortEvents :: T -> T
progChangeBeforeSetTempo :: T -> T
Documentation
data T Source
The datatypes for MIDI Files and MIDI Events
Constructors
Cons Type Division [Track]
show/hide Instances
data Division Source
Constructors
Ticks Tempo
SMPTE Int Int
show/hide Instances
type Track = T ElapsedTime EventSource
data Type Source
Constructors
Mixed
Parallel
Serial
show/hide Instances
type SchedEvent = (ElapsedTime, Event)Source
data Event Source
Constructors
MIDIEvent Channel T
MetaEvent MetaEvent
SysExStart ByteString
SysExCont ByteString
show/hide Instances
type ElapsedTime = IntegerSource
type Tempo = IntSource
type SMPTEHours = IntSource
type SMPTEMins = IntSource
type SMPTESecs = IntSource
type SMPTEFrames = IntSource
type SMPTEBits = IntSource
data MetaEvent Source
Constructors
SequenceNum Int
TextEvent String
Copyright String
TrackName String
InstrName String
Lyric String
Marker String
CuePoint String
MIDIPrefix Channel
EndOfTrack
SetTempo Tempo
SMPTEOffset SMPTEHours SMPTEMins SMPTESecs SMPTEFrames SMPTEBits
TimeSig Int Int Int Int
KeySig Key Mode
SequencerSpecific ByteString
Unknown Int ByteString
show/hide Instances
maybeMIDIEvent :: Event -> Maybe (Channel, T)Source
maybeMetaEvent :: Event -> Maybe MetaEventSource
data Key Source
The following enumerated type lists all the keys in order of their key signatures from flats to sharps. (Cf = 7 flats, Gf = 6 flats ... F = 1 flat, C = 0 flats/sharps, G = 1 sharp, ... Cs = 7 sharps.) Useful for transposition.
Constructors
KeyCf
KeyGf
KeyDf
KeyAf
KeyEf
KeyBf
KeyF
KeyC
KeyG
KeyD
KeyA
KeyE
KeyB
KeyFs
KeyCs
show/hide Instances
data Mode Source
The Key Signature specifies a mode, either major or minor.
Constructors
Major
Minor
show/hide Instances
defltST :: TempoSource
defltDurT :: ElapsedTimeSource
Default duration of a whole note, in seconds; and the default SetTempo value, in microseconds per quarter note. Both express the default of 120 beats per minute.
empty :: TSource
An empty MIDI file.
showLines :: T -> StringSource
Show the T with one event per line, suited for comparing MIDIFiles with diff. Can this be replaced by Sound.MIDI.Load.showFile?
changeVelocity :: Double -> T -> TSource
A hack that changes the velocities by a rational factor.
getTracks :: T -> [Track]Source
resampleTime :: Double -> T -> TSource
Change the time base.
showEvent :: Event -> ShowSSource
showTime :: ElapsedTime -> ShowSSource
sortEvents :: T -> TSource
Sort MIDI note events lexicographically. This is to make MIDI files unique and robust against changes in the computation. In principle Performance.merge should handle this but due to rounding errors in Float the order of note events still depends on some internal issues. The sample rate of MIDI events should be coarse enough to assert unique results.
progChangeBeforeSetTempo :: T -> TSource
Old versions of Haskore.Interface.MIDI.Write wrote ProgramChange and SetTempo once at the beginning of a file in that order. The current version supports multiple ProgramChanges in a track and thus a ProgramChange is set immediately before a note. Because of this a ProgramChange is now always after a SetTempo. For checking equivalence with old MIDI files we can switch this back.
Produced by Haddock version 2.6.0