Output midi channels

(Linuxium) #1

Hello all,

I have a little problem with midi channels (Ardour 5.8 and Linux). I have midi keyboard connected to computer via USB. I have external soud card Lexicon Lambda with midi. To this midi I have plug Novation Circuit. I set input midi (usb keyboard) and output midi (Lexicon Lambda). My problem is, when I can not set other output channel than 1. Please, exists any other possibilities? Thank you for help.

(Stefan) #2

Yes, noticed this too. There is no way to change the midi channel on the midi output in realtime. The MIDI channel selector on the track does not change the realtime output. Does it just change the played notes from the track? Never tried it. The only way to change the channel in realtime I have found is using the plugin MIDI Channel Map from x42. http://x42-plugins.com/x42/x42-midifilter

MIDI keyboard controll channel 1 always
(Linuxium) #3

Hello Swindus, thank you very much. For me is this plugin good solution.

(Robert Schneider) #4

Here ist another solution to this, it spares you from having to set 16 channel dropdowns to the same channel. Save this in a file called _midi_fix_channel.lua in your ~/.config/ardour5/scripts folder. Restart Ardour, you will then have a Plugin MIDI fix channel. Add it to your strip, double-click to edit the MIDI channel you want to nail everyting to.

function dsp_ioconfig ()
return { { midi_in = 1, midi_out = 1, audio_in = 0, audio_out = 0}, }
end

function dsp_params ()
return
{
{ [“type”] = “input”,
name = “Channel”,
doc = “Channel to be used for all data”,
min = 1, max = 16, default = 1, integer = true }
}
end

function dsp_run (_, _, n_samples)
assert (type(midiin) == “table”)
assert (type(midiout) == “table”)
local cnt = 1
local ctrl = CtrlPorts:array ()
local channel = ctrl[1];

function tx_midi (time, data)
	midiout[cnt] = {}
	midiout[cnt]["time"] = time;
	midiout[cnt]["data"] = data;
	cnt = cnt + 1;
end

-- for each incoming midi event
for _,b in pairs (midiin) do
	local t = b["time"] -- t = [ 1 .. n_samples ]
	local d = b["data"] -- get midi-event

	if (bit32.band (d[1], 240) ~= 240) then -- not a SYSEX
		d[1] = bit32.band (d[1], 240) + channel - 1
	end
	tx_midi (t, d)
end

end

1 Like
(Linuxium) #5

Dear Robert,
thank you very much for next solution. I am save script to file and put it to script folder. But I cannot find script in the Ardour. In log is write Script ‘/home/linuxium/.config/ardour5/scripts/_midi_fix_channel.lua’ has no valid descriptor. Please, what I make bad?
Thank you for your help :slight_smile:

(Robert Schneider) #6

I am sorry, indeed, the descriptor is missing. I have pasted the complete file with proper indention here: http://pastebin.com/nF9B4PRt
Now it should work.

(Linuxium) #7

Good job. Works very good.
Thank you very much Robert.

(dacr) #8

Hey Robert!

I installed your script and I have a problem.
I can set only numbers that cannot be divided into three.
So missings: 3, 6, 9, 12

Have you any idea?

Thanl you,
David

(Robin Gareus) #9

That’s a bug in Ardour 5.x integer control widget [1] :frowning: You can work around this by using the slider in the editor’s automation lane for the parameter (that also allows numeric entry, double-click). Or show the inline-control of the plugin in the mixer-strip.

[1] The bug is that this control uses range as steps e.g. here (16 - 1) = 15 steps. While the control has actually 16 distinct values.

PS. Perhaps editing the script and removing integer = true in line 20 can also work around this.

(dacr) #10

If I remove integer option, then ardour crash. But inline-controll working fine.
Thank you Robin!