Coding an AAX MIDI Reverse (retrograde) and Inversion plugin for a newbie!

Hello all,

I am new to this wonderful place, and generally new to coding as well.

How would one create a simple MIDI plugin that does two things (separately, two basic parameters) as a utilitarian AAX plugin…

  1. Reverses a MIDI clip (flips it horizontally/arranges it to be backwards, in reverse)

  2. Inverts a MIDI clip (inverts the intervals in a given melody)

This seems very simple to do. After reading up on the Arpeggiator tutorial on the site, I think I am getting an idea of how this could be programmed. Unfortunately I don’t have the time to be able to get to really understanding how to code it, as I am swamped with working on a commercial project that goes far into my foreseeable future.

I am wondering, if anyone would be willing to provide some insight and or code this? And then perhaps create a very simple tutorial/guide on the process of doing so. Or if anyone would be willing to do one or the other.

It’s interesting because this is a nice feature, just two little buttons, in Ableton. However, Pro Tools has yet to implement something in their recent MIDI updates that is extremely simple and helpful when composing.

Especially the time reverse is tricky because it definitely requires access to the entire MIDI data in the clips at one go. (The interval inversion probably requires it too…) JUCE does not support making plugins that can do that. There is basically support only for plugins that get a small buffer of audio or MIDI under the playcursor and which need to output their processing results as soon as possible.

Ahh, interesting…

Perhaps specifically for just interval inversion…? An arpeggiator style plugin could be coded that as you said listens in real time and immediately outputs midi data inverted. A simple function that transposes every incoming midi event to it’s inversion, and outputs the result.

E.G load the plugin on the track with the midi data, play the track, and have the plugins output signal routed to a separate midi or instrument track in Pro Tools.

One would have to play the sequence in real time in order to record the inversion to another track. Would this be something that is possible?

The reversing of a sequence as you said wouldn’t seem to have a viable way of working similarly.

I am not familiar enough with recent Pro Tools and the AAX plugin system to know what is possible. But JUCE itself does support doing (realtime) MIDI transformation plugins at least as VST2 plugins.

Duly noted, thank you for sharing your knowledge. :sunglasses:

what you CAN do with Juce is performing these operations on a midifile rather than on realtime data. Is that what you mean by ‘midi clip’?

To do that you’d read in the midi, transform to a pianoroll-like structure, invert it, and create the raw midi from that. Doing that in real time, like @Xenakios said, would be impossible as far as I can judge.

I have working code that does reading of a midi file and transform to piano-roll like structure. You’d need a pretty decent understanding of midi file formats and if you’re new to coding and Juce I think you’re in for an uphill battle though. Feel free to pm me.

The problem is that the data likely can’t conveniently be exported, transformed elsewhere and imported back into the Pro Tools track timeline. It looks like to me the original poster is looking for a “single click” solution for that. (A “clip” is what other DAW applications call “items”, “events”, “objects” and so on that reside on the tracks and contain audio or MIDI media. Pro Tools previously called them “regions”.)

Perhaps for the original poster it would be worth looking into if AAX plugins supports doing the offline “AudioSuite” style processing for MIDI clips too instead of just audio. JUCE does not support the offline processing part, but JUCE could probably be used at least for the GUI in the plugin. Of course this would require lots of research and development, which the original poster maybe isn’t willing to do…

It’s been a long time I’ve worked in ProTools, but if I remember well is should be possible to copy/paste (or export) the midi data in a clip to a midi file. Other data like samples I don’t know). But you’re right when you say “Of course this would require lots of research and development, which the original poster maybe isn’t willing to do” … and for a novice coder that amount of R&D might amount to an enormous number of hours …

Also it’s worth pointing out that developing AAX plugins is a complicated process that requires the blessings of Avid, digitally signing the plugin binaries, a special version of Pro Tools for testing and debugging etc…Considering all that hassle, looking into the external MIDI file processing application suggested by tomto66 would be a more feasible way to go, even though using it is not as convenient to use as just pressing a button in a plugin within Pro Tools.

1 Like