I just wanted to share my script for creating an interface where Midi Guitar 2 can send note values to the 3 Note Generator in the Line 6 Helix. Unfortunately, the Helix does not take midi note information for the 3 Note Generator, so I had to convert the pitch values to CC messages to the corresponding Note and Octaves in the Helix.
The appropriate MIDI CC configurations are set up on the line 6 custom tone:
Here’s the code.
noteArray = {} -- This holds 0-n notes being played simultaneously
ccNoteArray = {4, 5, 6, 7, 8, 9 } -- Which CC this will send for note information
ccOctaveArray = {10,11,12,13,14,15} -- Which CC this will send for octave information
ccLevelsArray = {16,17,18,19,20,21} -- Which CC this will send for volume information
function OnNote(channel, pitch, velocity)
if(velocity>0) then
table.insert(noteArray,pitch)
else
-- If there is a dead note, clean up
local currentIndex = indexOf(noteArray,pitch)
table.remove(noteArray,currentIndex,1)
end
Note(channel, pitch, velocity) -- This can be removed if passthrough midi note is not needed
outputNotes()
end
function convertNoteToHelixVelocity(inputNote)
local currentNote = inputNote%12
return math.floor(((currentNote+1)/12)*127)
end
function convertNoteToOctave(inputOctave)
return math.floor((inputOctave/8)*127)
end
function getNoteOctave(inputNote)
return math.floor(inputNote/12)
end
function outputNotes()
for i=1,#(noteArray) do
Control(1,ccNoteArray[i],convertNoteToHelixVelocity(noteArray[i]))
Control(1,ccOctaveArray[i],convertNoteToOctave(getNoteOctave(noteArray[i])))
Control(1,ccLevelsArray[i],64) --volume 5
end
-- For any unused oscillators, make sure to mute them
for i=#(noteArray)+1,#(ccLevelsArray) do
Control(1,ccLevelsArray[i],0)
end
end
function indexOf(array,value)
for i,v in ipairs(array) do
if v == value then
return i
end
end
return nil
end
function OnStart(info)
-- assign a description to be displayed in the header
info.description = "Convert guitar notes into something the Helix can process with the 3 Note Generator"
info.link = "http://jamorigin.com/midi-machine"
end