--------------------------------------------------------------------------------
--! @example legato.lua
--------------------------------------------------------------------------------
local notes = {}
Fade =
Knob(
"fade", 40, 10, 100)
local sampleOffset = 50 -- ms
if #notes > 0 then
local fadetime = Fade.value
fadeout(notes[#notes].
id, fadetime,
true)
table.insert(notes, e)
else
table.insert(notes, e)
end
end
for i,noteon in ipairs(notes) do
if noteon.note == e.note then
table.remove(notes, i)
local shouldRetrigger = Retrigger.value and #notes > 0 and i > #notes
if shouldRetrigger then
local noteon = notes[#notes]
local
id =
playNote(noteon.note, noteon.velocity)
noteon.id = id
local fadetime = Fade.value
end
break
end
end
end