Dragging MIDI from DAW to Plugin

I am writing a plugin where a core part of the functionality is allowing users to drag and drop midi files from their DAW into the plugin for further processing. I have built a UI with FileDragandDropTarget which specifically looks for .mid files. When testing as a standalone, it works as intended. Furthermore, while running the plugin via Ableton I can drag/drop MIDI files from my hard drive.

However, I can’t seem to actually drag MIDI clips that are in the Ableton timeline. It doesn’t seem to activate the FileDragAndDropTarget component in any way.

Is there a known workaround for this?

It makes sense to me that it wouldn’t activate a file drag-and-drop, because those MIDI clips aren’t always actually files, they could just be a blob of data inside the DAW project.

There might be a way to achieve this, but I suspect you may need some DAW-specific APIs to get it working everywhere.

Hey, thanks for the really fast reply!
With that information in mind, would you suggest that either 1.) a version of the plugin needs to be developed separately for each DAW, or 2.) This is practically infeasible and I should determine a new ‘meta’ structure of the plugin?

Without contacting each vendor, there’s no way to know what they put on the clipboard when you start a drag operation of a MIDI track/clip in any given DAW. Could be entirely proprietary information, could be MIDI. No (easy, reliable) way to know. If it happens to work in some DAW(s), that’s good. But if not, you’re out of luck, I’d guess.

if you don’t get this to work a nice alternative could be to just ask the user to capture midi with a button, similiar to how audio is captured in melodyne. however i’d also add a feature then that quantizes the start and end of the recording to the nearest beat of some measure, so that it’s easier to work with in the plugin itself

Yes, that very well may be the best workaround. It’s really too bad, because for what I’m trying to build it’s not ideal (I want to be able to drag in multiple clips and create modifications of each, store in a buffer, then activate one or another buffer for live-playback, a bit like a DJ switching between turntables).

A bit surprised about all this, as with Audio the files (at least in Ableton) are immediately stored locally and can be referenced by the plugin with a drag-and-drop operation. Seems like MIDI is the odd one out here, for a change…

Depending on how much development time & future maintenance effort you’re willing to invest, you can probably get something working in most of the major DAWs. File drag&drop might work in some, others might copy the MIDI data to the system clip tray, and others may offer DAW-specific APIs to interface with them & get the data. You can probably create a JUCE module to incorporate all these different approaches.

2 Likes