   
   switch type
     when 144 # Note on
-      console.log note
+      state.toSet = note
+      state.moveNext = 2
     when 128 # Note off
       ;
 


state =
  activeLine: 0

updateViz = ->
  viz.draw(canvas)

  switch
    when keyCode is 8
      state.toSet = 255
      state.moveNext = 1
    when keyCode is 32
      state.moveNext = 1
    when keyCode is 38
      state.activeLine -= 1
    when keyCode is 40
      state.activeLine += 1
    when keyCode is 46
      state.toSet = null
      state.moveNext = 1
    when 48 <= keyCode <= 57
      state.toSet = keyCode - 48 + 4 * 12
      state.moveNext = 1
, false

document.addEventListener "mousedown", (e) ->
