Skip to content

Commit

Permalink
eval notes_off logic on every frame tick
Browse files Browse the repository at this point in the history
  • Loading branch information
John Corrigan committed Jul 19, 2019
1 parent 42c1e57 commit cdebd75
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/library/_midi.lua
@@ -1,5 +1,5 @@
local midi_out = function ( self, x, y )

self.y = y
self.x = x
self.name = 'midi'
Expand All @@ -8,16 +8,16 @@ local midi_out = function ( self, x, y )
local channel = util.clamp( self:listen( self.x + 1, self.y ) or 0, 0, 16 )
local octave = util.clamp( self:listen( self.x + 2, self.y ) or 4, 0, 8 )
local vel = util.clamp( self:listen( self.x + 4, self.y ) or 10, 0, 16 )
local length = self:listen( self.x + 5, self.y ) or 1
local length = self:listen( self.x + 5, self.y ) or 1
local note = self:glyph_at(self.x + 3, self.y) or 'C'
local transposed = self:transpose( note, octave )
local n, oct, velocity = transposed[1], transposed[4], math.floor(( vel / 16 ) * 127 )
self:notes_off(channel)
if self:neighbor(self.x, self.y, '*') then
self:notes_off(channel)
self.midi_out_device:note_on( n, velocity, channel )
self:add_note(channel, n, length, false)
end

end

return midi_out
return midi_out

0 comments on commit cdebd75

Please sign in to comment.