summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2015-12-11 10:10:57 -0500
committerAndrew Cady <d@jerkface.net>2015-12-11 10:17:29 -0500
commit44ffb5c2fd9d65368df7b6e9172ff3e258bf4169 (patch)
tree9bd166fcd6f4a439efff86111cd597bda2fa16e1
parentc012a42e53c1bccd5e113fea5f616115f6f85835 (diff)
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.
-rw-r--r--midi-dump.hs3
1 files changed, 1 insertions, 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
301 ticksPerSecond = ticksPerBeat * beatsPerSecond 301 ticksPerSecond = ticksPerBeat * beatsPerSecond
302 beatsPerSecond = 120 `div` 60 302 beatsPerSecond = 120 `div` 60
303 ticksPerBeat :: Integer 303 ticksPerBeat :: Integer
304 -- ticksPerBeat = 2^(15::Int) - 1 304 ticksPerBeat = 500 -- 1ms resolution. See git blame.
305 ticksPerBeat = 2400
306 305
307playEvents :: [RecordedEvent] -> MidiController () 306playEvents :: [RecordedEvent] -> MidiController ()
308playEvents evts@(_:_) = 307playEvents evts@(_:_) =