115c3529e9
ship-ci / ci (push) Waiting to run
fix(midi): guard non-positive division in the legacy inline tempo path ( #805 )
...
convert_midi_track_to_keys_wire builds its own inline tempo map and
divides by the raw midi.ticks_per_beat at two sites (the tempo-table
precompute and the tick_to_seconds closure). A malformed header with
division == 0 raised ZeroDivisionError, and an SMPTE division (which
mido returns as a NEGATIVE signed short) produced negative/garbage
note times.
Guard the divisor with `ticks_per_beat if ticks_per_beat > 0 else 480`
so both the zero and negative cases fall back to the SMF default. The
`> 0` form (not `or 480`) is required because a negative value is
truthy and would slip past `or`. Positive-division behavior is
unchanged.
Follow-up to #796 , which fixed the same class of bug in the newer
convert_midi_tempo_map / _build_tick_to_seconds path.
Adds two focused tests: division == 0 no longer crashes and emits a
non-negative time, and a negative/SMPTE division yields sane
non-negative times.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-07-07 10:27:45 +02:00
..
2026-06-29 12:26:29 +02:00
2026-06-16 18:49:40 +01:00
2026-07-05 23:50:30 +02:00
2026-07-07 09:54:06 +02:00
2026-06-16 18:47:13 +02:00
2026-06-23 11:03:01 +02:00
2026-07-05 00:17:43 +02:00
2026-07-03 12:15:43 +02:00
2026-07-03 12:15:43 +02:00
2026-07-03 12:15:43 +02:00
2026-07-03 12:15:43 +02:00
2026-07-03 12:15:43 +02:00
2026-07-03 12:15:43 +02:00
2026-06-23 11:03:01 +02:00
2026-07-03 12:15:43 +02:00
2026-07-03 12:15:43 +02:00
2026-06-16 18:47:13 +02:00
2026-07-03 12:15:43 +02:00
2026-06-23 11:03:01 +02:00
2026-07-03 22:58:39 +02:00
2026-07-03 12:15:43 +02:00
2026-07-03 12:15:43 +02:00
2026-07-03 12:15:43 +02:00
2026-07-03 12:15:43 +02:00
2026-07-03 12:15:43 +02:00
2026-07-03 13:01:07 +02:00
2026-06-23 11:03:01 +02:00
2026-07-03 13:01:07 +02:00
2026-07-05 00:15:50 +02:00
2026-06-16 19:36:53 +01:00
2026-07-05 00:18:18 +02:00
2026-06-23 11:03:01 +02:00
2026-07-03 12:15:43 +02:00
2026-07-05 23:35:58 +02:00
2026-07-05 21:09:38 +02:00
2026-06-23 11:03:01 +02:00
2026-07-02 08:40:20 +02:00
2026-06-16 18:47:13 +02:00
2026-07-05 00:20:31 +02:00
2026-06-23 11:03:01 +02:00
2026-06-16 18:47:13 +02:00
2026-07-05 20:08:19 +02:00
2026-07-03 12:15:43 +02:00
2026-06-16 18:47:13 +02:00
2026-07-03 12:15:43 +02:00
2026-07-03 12:15:43 +02:00
2026-07-03 12:15:43 +02:00
2026-07-05 21:00:30 +02:00
2026-07-03 12:15:43 +02:00
2026-07-03 12:15:43 +02:00
2026-06-16 18:47:13 +02:00
2026-06-23 11:03:01 +02:00
2026-07-03 12:15:43 +02:00
2026-06-16 19:36:53 +01:00
2026-06-16 19:36:53 +01:00
2026-07-05 21:09:38 +02:00
2026-07-05 01:11:38 +02:00
2026-06-16 18:47:13 +02:00
2026-07-07 10:27:45 +02:00
2026-07-07 10:27:17 +02:00
2026-07-03 12:15:43 +02:00
2026-06-16 18:47:13 +02:00
2026-07-02 08:40:20 +02:00
2026-06-16 18:47:13 +02:00
2026-06-23 11:03:01 +02:00
2026-07-03 12:15:43 +02:00
2026-06-23 11:03:01 +02:00
2026-07-03 14:45:30 +02:00
2026-06-25 00:02:16 +02:00
2026-07-03 12:15:43 +02:00
2026-07-03 12:15:43 +02:00
2026-06-16 18:47:13 +02:00
2026-07-03 12:15:43 +02:00
2026-06-16 19:36:53 +01:00
2026-06-16 18:47:13 +02:00
2026-07-03 12:15:43 +02:00
2026-07-06 20:35:51 +02:00
2026-07-03 12:15:43 +02:00
2026-07-03 12:15:43 +02:00
2026-07-05 00:16:42 +02:00
2026-06-16 18:47:13 +02:00
2026-07-03 12:15:43 +02:00
2026-06-16 18:47:13 +02:00
2026-06-20 21:59:04 +02:00
2026-07-03 12:15:43 +02:00
2026-06-20 14:10:04 -07:00
2026-06-20 21:23:48 +02:00
2026-06-16 18:47:13 +02:00
2026-06-23 18:05:45 +02:00
2026-06-20 21:35:07 +02:00
2026-06-16 18:47:13 +02:00
2026-07-03 12:15:43 +02:00
2026-07-03 12:15:43 +02:00
2026-06-23 11:03:01 +02:00
2026-07-02 20:51:57 +02:00
2026-07-03 12:15:43 +02:00
2026-07-03 12:15:43 +02:00
2026-06-23 11:03:01 +02:00
2026-06-16 18:47:13 +02:00
2026-07-05 00:16:42 +02:00
2026-07-03 12:15:43 +02:00
2026-06-16 18:47:13 +02:00
2026-07-03 12:15:43 +02:00
2026-07-03 12:15:43 +02:00
2026-07-03 12:15:43 +02:00
2026-06-16 18:47:13 +02:00