Ardour - MIDI output channel change

Support & discussion regarding DAWs and MIDI sequencers.

Moderators: khz, MattKingUSA

User avatar
khz
Established Member
Posts: 1244
Joined: Thu Apr 17, 2008 6:29 am
Location: German

Ardour - MIDI output channel change

Postby khz » Sat Jul 27, 2019 4:21 pm

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.

Source: https://discourse.ardour.org/t/output-midi-channels/89371/4

Code: Select all

ardour {
   ["type"]    = "dsp",
   name        = "MIDI fix channel",
   category    = "MIDI", -- "Utility"
   license     = "MIT",
   author      = "Robert Schneider",
   description = [[A MIDI filter that nails all data to one channel.]]
}

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

Source: https://pastebin.com/nF9B4PRt


####

##
# http://x42-plugins.com/x42/x42-midifilter
##
FZ - Does humor belongs in Music?
GNU/LINUX@AUDIO ~ /Wiki $ Howto.Info && GNU/Linux Debian installing >> Linux Audio Workstation LAW
    I don't care about the freedom of speech because I have nothing to say.

Return to “Recorders & Sequencers”

Who is online

Users browsing this forum: No registered users and 2 guests