aboutsummaryrefslogtreecommitdiff
path: root/rhodes.lua
blob: ab2a49f8e66dc390650205628a8ccb5ec5578bce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
-- midi fm rhodes
--
-- key 2: play a C4

engine.name = "Rhodes"

local MusicUtil = require "musicutil"

function redraw()
  screen.clear()
  screen.move(64, 32)
  screen.text_center("rhodes.")
  screen.update()
end

function init ()
  redraw()
  m = midi.connect(1)
  m.event = function (a)
    b = midi.to_msg(a)
    if b.type == "note_on" then
      engine.note_on(b.note, b.vel or 60)
    elseif b.type == "note_off" then
      engine.note_off(b.note)
    end
  end
end

function key (n, x)
  if n == 2 and x == 1 then
    engine.note_on(60, 50)
  elseif n == 2 and x == 0 then
    engine.note_off(60)
  end
end

-- Local Variables:
-- compile-command: "make upload"
-- End: