Midi Generation on DAW track

How would one create a plugin which essentially generates a midi sequence internally and then instantiates it on the track of the DAW for playback through a software instrument. No real time processing need to happen.

To clarify, is there a way to write midi data to a DAW track while bypassing the process block? Essentially just to load a midi sequence as a midi track. Can’t seem to find good instruction on this.

This isn’t really what a plugin does.

Thanks, I know it isn’t typically what a plug-in does but it doesn’t seem to be a useless functionality even in the context of a plug-in.

In any case my application is specific and intentional and my question is more in the manner of “is this possible?” Rather than “is this what a plug-in does?”

In the case of melodyne you have a fully functional midi editor within a plug-in and I imagine the answer would be something in that direction.

Also a workaround would perhaps be something like offline processing or direct control of the transport to record the sequence from the daw as it’s passed through frame by frame but without the user having to click record in the daw and then click generate in the plug-in. Is this true?

A plugin can output audio and/or midi to the host. That’s the only thing within your power to do.

The user could record your plugin’s midi output into a midi track in their DAW project. But to my knowledge, using a plugin to write directly to the DAW’s timeline or control the DAW transport is not possible.

It is possible to create an app (or potentially even plugin) that can generate and write midi files, which could then be easily imported to a DAW

See your last response is interesting. I have written applications which write and process midi files so I am familiar with the process. Additionally it is possible to write to midi file from a plug-in. Isn’t it conceivable that there would be a way to write to a midi file within the plug-in and then load it into the daw directly?

If this functionality does not exist in any way I would be surprised. Again, I haven’t used melodyne much but isn’t that an example of a midi file directly manipulating static midi track data? It doesn’t seem like melodyne is operating with a constant throughput of data but rather reading and manipulating the whole string of midi at once, but I could be wrong about that.

You can absolutely use JUCE to build a plugin that will create a MIDI file during runtime and save it to your user’s computer.

The sticky point is this part:

the user can easily drag your generated MIDI file into the DAW. But as far as I know, your plugin cannot directly write to the DAW’s timeline, or force it to load a MIDI file.

I think what’s happening in Melodyne (never really used it myself) is that they have an internal editor – there’s another timeline within Melodyne itself, right?

So you could absolutely write your own piano roll & timeline inside your plugin and keep track of your midi, so that that’s what you’re outputting to the host each processBlock() call, depending on the transport position. But that midi data would only live inside your plugin, you can’t force the host to record your output. What would really be happening here is that your plugin would have its own internal concept of a “timeline” – as far as I know, directly interfacing with the DAW’s timeline through any plugin API is not possible.

Melodyne used to use an internal editor that manipulates pre-recorded data.

Back in the day, you had to click ‘record’, wait until the host streamed all the track data into the plugin and from that point on they only streamed into the DAW the audio that was edited from what was recorded earlier, discarding the live input completely.

That changed a few years ago with ARA:
https://www.celemony.com/en/service1/about-celemony/technologies

That format isn’t supported on all hosts, and also requires using an extension to JUCE (GitHub - Celemony/JUCE_ARA: The JUCE cross-platform C++ framework, augmented with support for the Celemony ARA API).

However I think it doesn’t support MIDI (yet?). It would be super cool if it did though.

Yea thanks, you might be right. I just did some further research and it looks like melodyne does in fact do something like what I am trying to do and have actually developed a relatively new API just for that call Audio Random Access (ARA).

It is too bad if that API is the only way to do this as I doubt it is free to use :confused:

Thank you! Yea I just found ARA as I was digging a bit further, but didn’t find it till I went to melodyne website to see how their app works, so it doesn’t seem to be very well known at this stage, or at least widely used.

I will have to check how much it costs and whether it has midi capabilities.

Do you have any suggestions in the event that ARA does not support midi? I know it is pretty simple to stream tracks into the plug-in and record them in the plug-in but is there a simple way to then record them back onto the track without leaving the plug-in? Perhaps not.

Not that I know of. ARA is pretty unique because over the years many popular hosts (like Cubase, Studio One, Logic, etc) added their support to it, and even then it doesn’t support other popular hosts (Ableton Live, for example).

Solutions I’ve seen try to be creative by either doing the editing within the plugin, doing it in a separate standalone app, dragging a midi file with the finished data back to the DAW, etc.

I’d be happy to see if someone has other ideas for that kind of workflow.

One other idea for workflow - dragging a MIDI clip directly from a plug-in window to a host MIDI track. I feel like I’ve done that before (might have been with EZ Drummer) though I don’t know if it’s possible to build a plug-in that does that with JUCE.

I am a hobbyist so my experience is limited solely to Reaper.

‘dragging a MIDI clip’ (A MIDI file). I would think one can do this, regardless of the DAW. If one can drag a MIDI file from the Desktop into a track on the DAW then one can certainly drag a MIDI file from a plug in into the DAW track (I do this all the time from my plugins to Reaper tracks).

Reaper:
Reaper has an API / SDK that allows a plugin to manipulate ‘Midi Items’ on a track. A ‘Midi Item’ is a MIDI clip. The entire tracks MIDI is made up of ‘Midi Items’. I have used this in several plugins. The API / SDK is of course proprietary to Reaper so would not be of much help in the real world…

1 Like

Hi rMidi! I’m new to JUCE and would like to know more about how you can use JUCE to manipulate Midi Items on a track in REAPER. Is there any tutorial or documentation I should check out? Or is any of your MIDI plugins open source so I can take a look? Thank you so much!

When I said ‘I am a hobbyist’ I was referring to the fact that I am not a professional musician. I am not a hobbyist programmer as I am a C++ / Windows / Linux programmer by trade.

  • www.Reaper.fm.
  • At the bottom of the home page Developer->Extensions SDK.
  • On the Extension SDK page there is a link gitHub for the SDK.
  • There is also a link to SWS (open source) which is built on the Extensions SDK. I am sure they do it in some form within that.
  • None of the above is documented and they freely admit that.
  • The ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum had a few people who where aware of the Extension SDK (meaning C++) but the majority of these people are asking about scripting (ReaScript, Java). I would poke that forum…
  • The reason I looked at the above was to perhaps leverage it to quickly get to a working proto type.
  • I remember identifying how to do it via the SDK, but decided it was not suitable to manipulate the track during play back which is what I required.

Will it work for you?
Depends upon what you are attempting.

Hope this helps.

If you don’t want to force the user to open Finder/Explorer, then you could have an icon in your plugin that you can click and drag a generated MIDI file from to drop in a MIDI track in the host. Enable the icon whenever you have successfully generated a MIDI file, and respond to the click and drag start by putting that file path into the same type of drag structure that Finder/Explorer would use. The host won’t care where it came from.

But I know of no way (except using those Reaper extensions) to directly deposit your MIDI to another track.

1 Like