Page tree
Skip to end of metadata
Go to start of metadata

releaseVoice(noteID)

Description

Function to release a note with a specific note ID.

Available in: Processor.

Arguments

noteIDThe note ID of the note you want to release.number

Example

-- generate major chords
local notes = {}

function onNote(event)

  local id1 = playNote(event.note, event.velocity)
  local id2 = playNote(event.note + 4, event.velocity)
  local id3 = playNote(event.note + 7, event.velocity)
  
  local ids = notes[event.note]
  if ids == nil then
     ids = {}
     notes[event.note] = ids
  end
  
  table.insert(ids, id1)
  table.insert(ids, id2)
  table.insert(ids, id3)

end

function onRelease(event)

  for i,v in ipairs(notes[event.note]) do
    releaseVoice(v)
  end

  notes[event.note] = nil

end

1 Comment