Feature #463

Skip trailing silence in MIDI files

Added by mark ma about 2 years ago. Updated about 2 years ago.

Status:Closed Start date:September 09, 2014
Priority:Minor Due date:
Assignee:- % Done:


Target version:3.6
Affects version:3.5.1


using 3.4.3 on 14.04. if i need to upgrade, i'm happy to do so.

but the length of some midi songs are simply wrong. i cross-checked the time reported by Winamp, QMMP on the same Linux box.. even qtractor.. There are simply a number of songs in my midi collection that are not calculated correctly.

what to do? otherwise LOVE audacious/Fluidsynth/jack. things sound really good again.

cars_just_wha.mid (32.2 kB) mark ma, September 11, 2014 20:56

rosegarden.png (17.7 kB) John Lindgren, September 13, 2014 01:18

Associated revisions

Revision 68915105
Added by John Lindgren about 2 years ago

amidi-plug: Add silence detection. Closes: #463.


#1 Updated by John Lindgren about 2 years ago

Please attach an example file. Does the file play correctly (tempo changes handled correctly and all that), and only the length shown in the playlist is wrong?

#2 Updated by mark ma about 2 years ago

file plays fine. tempo is fine. just length is 10 min, and song is 2 min long on the same machine using qmmp, on a Win machine using Win Media Player or Winamp etc..

#3 Updated by John Lindgren about 2 years ago


#4 Updated by John Lindgren about 2 years ago

Rosegarden has this to say:

I'm no MIDI expert, so I wonder what the technical difference between the "formal duration" and "playing duration" is.

#5 Updated by John Lindgren about 2 years ago

  • Tracker changed from Bug to Feature
  • Subject changed from midi song lengths to Skip trailing silence in MIDI files
  • Category set to plugins/amidi-plug
  • Status changed from New to Closed
  • Target version set to 3.6
  • % Done changed from 0 to 100
  • Affects version 3.5.1 added

Well, "playing duration" is apparently calculated based on the time of the last MIDI event in the file, and the "end marker" is the 0xff 0x2f sequence at the end of a track. By design, that end marker has a time of its own, so that MIDI playlists can have a little bit of silence between the last note of one song and the first note of the next. Your test file just happens to have a lot of silence before its end marker.

It seems wrong that the other players are ignoring that silence, but whatever is the "correct" behavior, I've added options to our MIDI plugin to skip leading and trailing silence if desired.

Also available in: Atom PDF