midi-0.2.0.1: Handling of MIDI messages and files

Safe Haskell | None

Sound.MIDI.File.Save

Description

Save MIDI data to files.

The functions in this module allow `T`s to be written into Standard MIDI files (`*.mid`) that can be read and played by music programs such as Cakewalk.

Synopsis

- toSeekableFile :: FilePath -> T -> IO ()
- toFile :: FilePath -> T -> IO ()
- toByteList :: T -> ByteList
- toByteString :: T -> ByteString
- toCompressedByteString :: T -> ByteString

# Documentation

toSeekableFile Source

Arguments

:: FilePath | file name
-> T |
-> IO () |

Directly write to a file. Since chunks lengths are not known before writing, we need to seek in a file. Thus you cannot write to pipes with this function.

toFile Source

Arguments

:: FilePath | file name
-> T |
-> IO () |

The function `toFile` is the main function for writing `T` values to an actual file.

toByteList :: T -> ByteList Source

Convert a MIDI file to a `ByteList`.

toByteString :: T -> ByteString Source

Convert a MIDI file to a lazy `ByteString`.

toCompressedByteString :: T -> ByteString Source

Convert a MIDI file to a lazy `ByteString`. It converts `NoteOff p 64` to `NoteOn p 0` and then uses the running MIDI status in order to compress the file.