Plugin to send off note after X seconds

All your LV2 and LADSPA goodness and more.

Moderators: MattKingUSA, khz

Post Reply
AndyBuru
Established Member
Posts: 6
Joined: Tue Mar 20, 2018 4:27 pm

Plugin to send off note after X seconds

Post by AndyBuru »

Hey,
I'm toying around with aubio to pickup notes from vibrations, but I only get the "on" notes, and never the "off" notes. Does anyone know about a plugin that can be configured to give a note a max duration, or length, and then once that is passed send an off note?

Thank you
Luc
Established Member
Posts: 741
Joined: Fri Mar 27, 2015 1:04 pm
Been thanked: 1 time

Re: Plugin to send off note after X seconds

Post by Luc »

I didn't check, but there must be a Piz Midi plugin that does what you want. Check them out:

https://bitbucket.org/agraef/pizmidi

Their original site has been offline for some time, but they're still available from other sources such as the one above. The KXStudio repository provides them.
ventosus
Established Member
Posts: 33
Joined: Sat Jun 27, 2015 6:29 pm
Been thanked: 1 time
Contact:

Re: Plugin to send off note after X seconds

Post by ventosus »

moony [1] LV2 plugin is up to the task.

Code snippet that does what you want (without bender, etc.)

Code: Select all

local srate = math.tointeger(Options[Param.sampleRate].body or 48000)
local delay_ms = 4000 -- 4 seconds
local delay_samples = srate * delay_ms // 1000
local sched = {}

local midiR = MIDIResponder({
  [MIDI.NoteOn] = function(self, frames, forge, chan, note, vel)
    forge:time(frames):midi(MIDI.NoteOn | chan, note, vel) 

    local id = (chan << 7) | note
    sched[id] = delay_samples
  end
})

local function advance(from, to, forge)
  local dn = to - from

  for id, v in pairs(sched) do
    if dn < v then
      sched[id] = v - dn
    else
      local frames = from + v
      local chan = id >> 7
      local note = id & 0x7f
      forge:time(frames):midi(MIDI.NoteOff | chan, note, 0x0)
      sched[id] = nil
      print('note off', chan, Note[note])
    end
  end
end

function run(n, control, notify, seq, forge)
  local from = 0

  for to, atom in seq:foreach() do
    midiR(from, forge, atom)
    advance(from, to, forge)
    from = to
  end

  advance(from, n, forge)
end
[1] https://open-music-kontrollers.ch/lv2/moony
Post Reply