Split midi input / one track notes to multiple instruments using protoplug VSTi / Panning by note -> VSTi instance
Hi, since Renoise 3.1 doesn’t seem to be capable to split midi to multiple tracks/instruments, I made a little script with protoplug. You can split one midi input / the notes of one track to multiple instruments with it, see example song below. It will transpose each n note to n*split_range (e.g. 24).
Very helpful for me, maybe for you, too. I can do this marvelous note auto panning for example, even with VSTis that do not support panning.
midi split by notes followup
[SPOILER]
--[[
name: midi split followup v0.1
author: J.R.
--]]
require "include/protoplug"
-- what kind of chord ?
local noteoffs = {}
local blockEvents = {}
local cNotes = 0
local numInstrs = 2
local splitRange = 24
function plugin.processBlock(samples, smax, midiBuf)
blockEvents = {}
-- analyse midi buffer and prepare a chord for each note
for ev in midiBuf:eachEvent() do
if ev:isNoteOn() then
noteOff(ev)
noteOn(ev)
cNotes = (cNotes + 1) % (numInstrs)
elseif ev:isNoteOff() then
noteOff(ev)
elseif ev:isPitchBend() then
table.insert(blockEvents, midi.Event.pitchBend(ev:getChannel(), ev:getPitchBendValue()))
elseif ev:isControl() then
table.insert(blockEvents, midi.Event.control(ev:getChannel(), ev:getControlNumber(), ev:getControlValue()))
end
end
-- fill midi buffer with prepared notes
midiBuf:clear()
if #blockEvents>0 then
for _,e in ipairs(blockEvents) do
midiBuf:addEvent(e)
end
end
end
function noteOn(root)
noteoffs[root:getNote()] = root:getNote() + cNotes*splitRange
local newEv = midi.Event.noteOn(
root:getChannel(),
noteoffs[root:getNote()],
root:getVel())
table.insert(blockEvents, newEv)
end
function noteOff(root)
if not noteoffs[root:getNote()] then return end
local newEv = midi.Event.noteOff(
root:getChannel(),
noteoffs[root:getNote()])
table.insert(blockEvents, newEv)
noteoffs[root:getNote()] = nil
end
params = plugin.manageParams {
{
name = "Num of instr.";
type = "list";
values = {2,3,4,5,6,7,8};
default = 3;
changed = function (val) numInstrs = val end;
};
{
name = "Split range";
type = "list";
values = {12,24,36,48};
default = 24;
changed = function (val) splitRange = val end;
};
}
[/SPOILER]
Example song:
http://tstlab.virtualcreations.de/renoise_forum/multiple_instr_note_followup.xrns
You needsynth1 VSTiand luaprotoplug VSTi. Also you need to setup a loopback driver in midi OSX settings or some loopback driver for windows:
Routing in example should be (could be not set, because of loopback driver device name):
instr 0: midi input your midi keyboard, midi routing to instrument 1
instr 1: midi input none, output midi loopback/iac driver
instr 2: midi input loopack/iac, midi ch.1, key c3-b4
instr 3: midi input loopack/iac, midi ch.1, key c5-b6
instr 3: midi input loopack/iac, midi ch.1, key c7++
Play on instr. 0, using the key range c-3 to b-4.
EDIT: fixed song link
EDIT 2: Added pitch bend and control data support!