View Issue Details

IDCategoryLast Update
0007071features2020-02-08 14:04
ReportercolinfAssigned To 
Reproducibilityhave not tried 
Status newResolutionopen 
Product Version5.X git (version in description) 
Fixed in Version 
Summary0007071: MIDI tracks not available for stem export
DescriptionMIDI tracks aren't available in the list of tracks offered for stem export (they're specifically excluded, in fact). Being able to render MIDI tracks without faffing around with extra buses would be quite handy.
Additional InformationI made a half-baked trivial patch to make this work: it works exporting audio outputs from MIDI tracks, but obviously exports nothing when exporting region contents of MIDI tracks. I'm not sure what should happen in that case: I imagine implementing a full-blown MIDI export would be a non-trivial task, but it feels a bit weird to have tracks visible in the stem export dialogue that will only be exported when 'track outputs' is selected.
TagsNo tags attached.


has duplicate 0007606 new Unable to export MIDI tracks as stems 
related to 0007838 new Offline Rendering for Midi Tracks 



2017-09-05 11:01


midi-stem-export.patch (1,213 bytes)
diff --git a/gtk2_ardour/ b/gtk2_ardour/
index 9043da312..4dd2fb587 100644
--- a/gtk2_ardour/
+++ b/gtk2_ardour/
@@ -651,6 +651,7 @@ TrackExportChannelSelector::select_none ()
 TrackExportChannelSelector::track_outputs_selected ()
+	fill_list();
@@ -676,13 +677,27 @@ TrackExportChannelSelector::fill_list()
 	for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) {
-		if (boost::dynamic_pointer_cast<AudioTrack>(*it)) {
-			if (!(*it)->active ()) {
-				// don't include inactive tracks
+		if (!(*it)->active ()) {
+			// don't include inactive tracks
+			continue;
+		}
+		if (!boost::dynamic_pointer_cast<Track>(*it)) {
+			// not a track, we've already handled it
+			continue;
+		}
+		if (track_output_button.get_active()) {
+			if ((*it)->output()->n_ports().n_audio() <= 0) {
+			// track has no audio outputs
+				continue;
+			}
+		} else {
+			// can only do pre-processor export of audio tracks for now
+			if (!boost::dynamic_pointer_cast<AudioTrack>(*it)) {
-			add_track (*it);
+		add_track (*it);
midi-stem-export.patch (1,213 bytes)


2018-07-04 12:23

administrator   ~0020335

Colin - do you think we should still apply this patch?


2018-07-04 12:37

updater   ~0020337

The patch is definitely no more than half-baked: it'll allow MIDI tracks to be selected in the stem export dialogue even if 'Apply track/bus processing' isn't ticked, but then the export won't produce anything for those tracks. Ideally, it should export a MIDI file in that case. Otherwise, at least it should not allow MIDI tracks to be selected for an export that wouldn't produce an audio file.

I toyed with the idea of refreshing the list of tracks when 'Apply track/bus processing' is toggled, so that MIDI tracks would only appear when it's enabled, but I seem to remember finding some annoying snag with that scheme: I think it was that all tracks became unselected for export when the list is refreshed, but I can't remember for sure: it was a long time ago...


2019-03-20 23:42

updater   ~0020616

Remarkably, the patch still seems to apply cleanly. I'll look back into this when I have a spare moment or two.


2020-01-30 14:50

reporter   ~0020941

Could this be merged into 6.0?


2020-01-30 15:04

administrator   ~0020942

> Could this be merged into 6.0?

Not unless it'll be fully baked by then :) Maybe 6.1 is more likely at this point.


2020-01-30 15:12

updater   ~0020943

I really will try to find a few spare moments to poke at this...

I wonder whether adding SMF export will be any simpler following commits 22da7793 .. b83ef099?


2020-02-07 20:13

updater   ~0020954

I've looked at what might be involved in adding MIDI file export, and it looks non-trivial: the export code seems to have the assumption that it's dealing with audio baked in pretty deeply. I'm sure it's doable, but I wonder whether it's the best target for the amount of effort it seems likely to take, or whether just audio export from MIDI tracks covers a sufficient majority of the use cases to make tweaking the UI to make it clear that that's what is supported is enough.


2020-02-07 20:21

administrator   ~0020955

What I'd like to see for MIDI is basically just "put an SMF file corresponding to this region somewhere outside the session". It won't cover 100% of the issues, but it will cover a lot of them. I don't think it should in anyway connected with the current export code.


2020-02-08 14:04

updater   ~0020956

Paul: so you're happy for, and would prefer, 'Stem Export' to remain audio-only? That's good as far as I'm concerned: I'd started off changing ARDOUR::AudioPort to ARDOUR::Port in gtk2_ardour/export_channel_selector.{cc|h} and chasing the compile errors to find out what else needed to change, but the depth of that rabbit-hole quickly became clear...

I'll have a go at working out a way of presenting MIDI tracks in the stem export UI to make it clear that export is audio-only, then.

Issue History

Date Modified Username Field Change
2016-10-12 19:46 colinf New Issue
2017-09-05 11:01 colinf File Added: midi-stem-export.patch
2018-06-26 11:57 colinf Relationship added has duplicate 0007606
2018-07-04 12:23 paul Note Added: 0020335
2018-07-04 12:37 colinf Note Added: 0020337
2019-03-20 23:42 colinf Note Added: 0020616
2019-11-14 17:16 colinf Relationship added related to 0007838
2020-01-30 14:50 unfa Note Added: 0020941
2020-01-30 15:04 x42 Note Added: 0020942
2020-01-30 15:12 colinf Note Added: 0020943
2020-02-07 20:13 colinf Note Added: 0020954
2020-02-07 20:21 paul Note Added: 0020955
2020-02-08 14:04 colinf Note Added: 0020956