haskore-realtime-0.1: Routines for realtime playback of Haskore songsSource codeContentsIndex

This module used shell-haskell and a pipe in order to play MIDI music without temporary files. Today it uses System.Process.runInteractiveProcess.

I got this running only with GHC and Linux so far. Though it is not satisfying. It seems that timidity forks itself away so that it doesn't block the prompt of Haskell. I assume that because sometimes ghci tries to write to the pipe before timidity can read it. Interestingly if I start timidity with an input pipe from the console it stays synchronously.

Some music seems to be to large, maybe larger than a pipe buffer, then the buffer runs over and the replay fails. E.g. ChildSong6 is short enough, Kantate147 is too long.

Using a pipe is the only way to play infinite streams of music using an external program. It is no problem to control a MIDI device over an unlimited time, but unfortunately the MIDI file format uses absolute time points and a file length value. Thus it is not possible to play infinite MIDI streams via the MIDI file format! For better realtime support on Linux look at the alsa-midi package.

play :: (Ord instr, Ord drum, C time, RealFrac time, Fractional time, RealFrac dyn) => (ChannelProgramPitchTable drum, ChannelProgramTable instr, T time dyn (Note drum instr), T drum instr) -> IO ()Source
playSimple :: T -> IO ()Source
playRaw :: [String] -> ByteList -> IO ()Source
type ByteList = [Word8]Source
stringCharFromByte :: ByteList -> StringSource
Produced by Haddock version 2.7.2