diff --git a/bin/baseset/orig_win.obm b/bin/baseset/orig_win.obm
index 8e2053e..c8c4923 100644
--- a/bin/baseset/orig_win.obm
+++ b/bin/baseset/orig_win.obm
@@ -142,5 +142,17 @@ GM_TT19.GM = Funk Central
 GM_TT20.GM = Jammit
 GM_TT21.GM = Movin' On
 
+; MIDI timecodes where the playback should attemp to start and stop short.
+; This is to allow fixing undesired silences in original MIDI files.
+; However not all music drivers may support this.
+[timingtrim]
+; Theme has two beats silence at the beginning which prevents clean looping.
+GM_TT00.GM = 768:53760
+; Can't Get There From Here from the Windows version has a long silence at the end,
+; followed by a solo repeat. This isn't in the original DOS version music and is likely
+; unintentional from the people who converted the music from the DOS version.
+; Actual song ends after measure 152.
+GM_TT10.GM = 0:235008
+
 [origin]
 default      = You can find it on your Transport Tycoon Deluxe CD-ROM.
diff --git a/src/base_media_base.h b/src/base_media_base.h
index 458e1fd..edf2ca7 100644
--- a/src/base_media_base.h
+++ b/src/base_media_base.h
@@ -287,6 +287,8 @@ struct MusicSet : BaseSet<MusicSet, NUM_SONGS_AVAILABLE, false> {
 	byte track_nr[NUM_SONGS_AVAILABLE];
 	byte num_available;
 	bool has_theme;
+	int override_start[NUM_SONGS_AVAILABLE];
+	int override_end[NUM_SONGS_AVAILABLE];
 
 	bool FillSetDetails(struct IniFile *ini, const char *path, const char *full_filename);
 };
diff --git a/src/music.cpp b/src/music.cpp
index 84240c1..a896d4f 100644
--- a/src/music.cpp
+++ b/src/music.cpp
@@ -70,6 +70,7 @@ bool MusicSet::FillSetDetails(IniFile *ini, const char *path, const char *full_f
 		uint next_track_nr = 1;
 
 		IniGroup *names = ini->GetGroup("names");
+		IniGroup *timingtrim = ini->GetGroup("timingtrim");
 		for (uint i = 0, j = 1; i < lengthof(this->song_name); i++) {
 			const char *filename = this->files[i].filename;
 			if (names == NULL || StrEmpty(filename)) {
@@ -78,15 +79,16 @@ bool MusicSet::FillSetDetails(IniFile *ini, const char *path, const char *full_f
 			}
 
 			IniItem *item = NULL;
+			const char *trimmed_filename = filename;
 			/* As we possibly add a path to the filename and we compare
 			 * on the filename with the path as in the .obm, we need to
 			 * keep stripping path elements until we find a match. */
-			for (const char *p = filename; p != NULL; p = strchr(p, PATHSEPCHAR)) {
+			for (; trimmed_filename != NULL; trimmed_filename = strchr(trimmed_filename, PATHSEPCHAR)) {
 				/* Remove possible double path separator characters from
 				 * the beginning, so we don't start reading e.g. root. */
-				while (*p == PATHSEPCHAR) p++;
+				while (*trimmed_filename == PATHSEPCHAR) trimmed_filename++;
 
-				item = names->GetItem(p, false);
+				item = names->GetItem(trimmed_filename, false);
 				if (item != NULL && !StrEmpty(item->value)) break;
 			}
 
@@ -100,6 +102,15 @@ bool MusicSet::FillSetDetails(IniFile *ini, const char *path, const char *full_f
 
 			/* if there is a theme song, number that one zero */
 			this->track_nr[i] = (i==0 && this->has_theme) ? 0 : next_track_nr++;
+
+			item = timingtrim->GetItem(trimmed_filename, false);
+			if (item != NULL && !StrEmpty(item->value)) {
+				const char *endpos = strchr(item->value, ':');
+				if (endpos != NULL) {
+					this->override_start[i] = atoi(item->value);
+					this->override_end[i] = atoi(endpos + 1);
+				}
+			}
 		}
 	}
 	return ret;
