Control Transpose of one instrument by MIDI events from another?

I’m not trained in any way at keyboard. But I am a mathematics, computer science, and engineering type who knows a workaround when he sees one :wink:

What I want to do is use my toy MIDI controller (Akai) to let me control the transpose of notes from my serious weighted keyboard. Specifically, every time I press a key on the Akai, I want Ardour to transpose all future keys from the main keyboard so that the middle C key on the main keyboard is equal to the note I pressed on the Akai… the ultimate keyboard capo…

Can I do this in Ardour? at one point I think I had it working in Mididings but it’d be really better if I could keep it all in Ardour.


PS: I do know that I can either use the “transpose” buttons on the MIDI keyboard, or manually transpose stuff, but the point here is to be able to rapidly on-the-fly change keys without maybe a couple years of training myself in the muscle memory of the 12 key patterns on the improperly designed piano keyboard, or having to take my keyboard apart and convert it to a Bilinear Uniform Keyboard to make it rational again :wink:

No one makes a Janko MIDI controller either (at least not widely available and relatively inexpensive).

There is a midi transpose plugin in the x42 collection:

But it doesn’t fit your use case completely. You can automate the transposition but it is not controllable by midi notes.

I’ve been looking for a midi plugin that would allow this myself. Because it would make it possible for one sequencer plugin to transpose another one. You would also be able to use one midi track to transpose your other tracks.

1 Like

Yeah, I’m really surprised this isn’t a very simple thing. Transpose controlled by midi events seems obvious right?

I’ve never seen a single hardware synth that would support this (unless you include modular).

I must admit I’ve been diving into modular synths and Supercollider recently and I’m trying to recreate some of the generative aspects using midi plugins in Ardour.

I don’t know anything about automation in Ardour (though I know a lot about programming in general and I know enough about MIDI to get by). Is there some kind of lua scripting or something I could do here? It seems basically trivial, listen to one channel, whenever a key is pressed, change the transpose on another channel. done.

Ardour processes tracks in parallel so they must be independent. – You have events arriving from two different sources and want to respond on a combination of those events, so there needs to be some kind of synchronization.

There are additional considerations here. Do you want the MIDI track to receive (and record) the transposed note event? Or do you want to record two MIDI tracks (one for each keyboard) and then do the transposing after the fact on a MIDI bus with a synth?

For the latter you could write a plugin with two MIDI inputs, one MIDI output that handles events from both your controllers in sync (and keeps track of the state).

As for the former, you could to re-write the events as they arrive using a Lua session-script. Those are called in sync at the start of every process cycle.

With a bit of programming experience you could perhaps hack the example script:
Save/edit the following to ~/config/ardour6/scripts/midi_rewrite.lua, then Menu > Edit > Lua Scripts > Script Manager > Session Scripts > Load

Exactly, I want basically real-time transposition before recording, but the transposition amount is based on the most recent note played on the other controller.

I’ll take a look at the example you gave, thanks. I’ve got relatively extensive experience coding Asterisk in Lua to handle all kinds of phone calls, this certainly isn’t going to be massively different from that.

Perhaps something like midish could be used?

Yes, I think I looked at midish and mididings and I remember implementing this in one or the other of them… I’m not sure which, I haven’t used it in at least 6 months. but it just seemed more maintainable and usable if it were all built into Ardour rather than requiring starting up yet another piece of software. I guess worst case I just resurrect my previous method.

Without the requirement to have this self-contained in an Ardour session and if you only have to support Linux/ALSA, I’d recommend

1 Like

Here’s the code I used in mididings. Maybe I’ll just stick with this because it’s so short and simple and easy:

# the purpose of the transposerator is to provide a JACK MIDI device
# that has two Ports in and one port out.... Notes played on port 2
# cause the device to change its transposition of notes on port
# 1... so if you play a D on port 2, all notes played on port 1 get
# transposed up 2 steps... It turns the keyboard into a transposing
# instrument with rapid adjustment of the transposition.

from mididings import *
from mididings.event import *

def KeyToTranspose(key):
    N = ( key.data1 - 60 )
    return ProgramEvent(2,1,N+1 if N >= 0 else N+16)


scenedict = {}

for i in xrange(1,8) :
    scenedict[i] = [PortFilter(2) >> KeyFilter(53,67) >> Process(KeyToTranspose) >> SceneSwitch(),
                    PortFilter(1) >> Transpose(i-1 if i < 8 else i-16) >> Output(1,1)]
for i in xrange(8,16) :
    scenedict[i] = [PortFilter(2) >> KeyFilter(53,67) >> Process(KeyToTranspose) >> SceneSwitch(),
                    PortFilter(1) >> Transpose(i-1 if i < 8 else i-16) >> Output(1,1)]

run(scenes = scenedict)
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.