From 44ffb5c2fd9d65368df7b6e9172ff3e258bf4169 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Fri, 11 Dec 2015 10:10:57 -0500 Subject: Lower midi resolution to 1ms. Without this, the (several day-long) dumped.mid file ends up invalid (presumably because the largest relative time does not fit into the available number of bits). Arguably this is a bug in Codec.Midi, or anyway it's an undocumented limitation. The proper solution is probably somewhat complicated/convoluted: do a tempo change before and after very long time differences, when (or before) serializing the Midi data. There's little point in implementing that fix though, because this giant midi file is not practically useful anyway. --- midi-dump.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/midi-dump.hs b/midi-dump.hs index 5084258..1fb1fdd 100644 --- a/midi-dump.hs +++ b/midi-dump.hs @@ -301,8 +301,7 @@ toSingleTrackMidi evts = midi ticksPerSecond = ticksPerBeat * beatsPerSecond beatsPerSecond = 120 `div` 60 ticksPerBeat :: Integer - -- ticksPerBeat = 2^(15::Int) - 1 - ticksPerBeat = 2400 + ticksPerBeat = 500 -- 1ms resolution. See git blame. playEvents :: [RecordedEvent] -> MidiController () playEvents evts@(_:_) = -- cgit v1.2.3