midi-0.1.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 T
data Type
= Mixed
| Parallel
| Serial
empty :: T
type ElapsedTime = Integer
fromElapsedTime :: ElapsedTime -> Integer
toElapsedTime :: Integer -> ElapsedTime
type Tempo = Int
fromTempo :: Tempo -> Int
toTempo :: Int -> Tempo
explicitNoteOff :: T -> T
implicitNoteOff :: T -> T
showLines :: T -> String
changeVelocity :: Double -> T -> T
getTracks :: T -> [Track]
resampleTime :: Double -> T -> T
showEvent :: T -> 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 TSource
data Type Source
Constructors
Mixed
Parallel
Serial
show/hide Instances
empty :: TSource
An empty MIDI file.
type ElapsedTime = IntegerSource
fromElapsedTime :: ElapsedTime -> IntegerSource
toElapsedTime :: Integer -> ElapsedTimeSource
type Tempo = IntSource
fromTempo :: Tempo -> IntSource
toTempo :: Int -> TempoSource
explicitNoteOff :: T -> TSource
Convert all NoteOn p 0 to NoteOff p 64. The latter one is easier to process.
implicitNoteOff :: T -> TSource
Convert all NoteOff p 64 to NoteOn p 0. The latter one can be encoded more efficiently using the running status.
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 :: T -> 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 MIDIEvent.ProgramChange and SetTempo once at the beginning of a file in that order. The current version supports multiple MIDIEvent.ProgramChanges in a track and thus a MIDIEvent.ProgramChange is set immediately before a note. Because of this a MIDIEvent.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.1