midi-0.2.2.2: Handling of MIDI messages and files

Safe HaskellSafe
LanguageHaskell2010

Sound.MIDI.File

Description

MIDI-File Datatype

Taken from Haskore.

Synopsis

Documentation

data T #

The datatypes for MIDI Files and MIDI Events

Constructors

Cons Type Division [Track] 

Instances

Eq T # 

Methods

(==) :: T -> T -> Bool #

(/=) :: T -> T -> Bool #

Show T # 

Methods

showsPrec :: Int -> T -> ShowS #

show :: T -> String #

showList :: [T] -> ShowS #

Arbitrary T # 

Methods

arbitrary :: Gen T #

shrink :: T -> [T] #

data Type #

Constructors

Mixed 
Parallel 
Serial 

Instances

Bounded Type # 
Enum Type # 

Methods

succ :: Type -> Type #

pred :: Type -> Type #

toEnum :: Int -> Type #

fromEnum :: Type -> Int #

enumFrom :: Type -> [Type] #

enumFromThen :: Type -> Type -> [Type] #

enumFromTo :: Type -> Type -> [Type] #

enumFromThenTo :: Type -> Type -> Type -> [Type] #

Eq Type # 

Methods

(==) :: Type -> Type -> Bool #

(/=) :: Type -> Type -> Bool #

Ord Type # 

Methods

compare :: Type -> Type -> Ordering #

(<) :: Type -> Type -> Bool #

(<=) :: Type -> Type -> Bool #

(>) :: Type -> Type -> Bool #

(>=) :: Type -> Type -> Bool #

max :: Type -> Type -> Type #

min :: Type -> Type -> Type #

Show Type # 

Methods

showsPrec :: Int -> Type -> ShowS #

show :: Type -> String #

showList :: [Type] -> ShowS #

Ix Type # 

Methods

range :: (Type, Type) -> [Type] #

index :: (Type, Type) -> Type -> Int #

unsafeIndex :: (Type, Type) -> Type -> Int

inRange :: (Type, Type) -> Type -> Bool #

rangeSize :: (Type, Type) -> Int #

unsafeRangeSize :: (Type, Type) -> Int

empty :: T #

An empty MIDI file. Tempo is set to one tick per quarter note.

type Tempo = Int #

explicitNoteOff :: T -> T #

Convert all NoteOn p 0 to NoteOff p 64. The latter one is easier to process.

implicitNoteOff :: T -> T #

Convert all NoteOff p 64 to NoteOn p 0. The latter one can be encoded more efficiently using the running status.

getTracks :: T -> [Track] #

mergeTracks :: C time => Type -> [T time event] -> T time event #

Merge all tracks into a single track according to the MIDI file type.

mapTrack :: (Track -> Track) -> T -> T #

Apply a function to each track.

secondsFromTicks :: Division -> T ElapsedTime T -> T Rational T #

Process and remove all SetTempo events. The result is an event list where the times are measured in seconds.

showLines :: T -> String #

Deprecated: only use this for debugging

Show the T with one event per line, suited for comparing MIDIFiles with diff. Can this be replaced by showFile?

changeVelocity :: Double -> T -> T #

Deprecated: only use this for debugging

A hack that changes the velocities by a rational factor.

resampleTime :: Double -> T -> T #

Deprecated: only use this for debugging

Change the time base.

showEvent :: T -> ShowS #

Deprecated: only use this for debugging

showTime :: ElapsedTime -> ShowS #

Deprecated: only use this for debugging

sortEvents :: T -> T #

Deprecated: only use this for debugging

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 -> T #

Deprecated: only use this for debugging

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.