aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
Diffstat (limited to 'example')
-rw-r--r--example/example.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/example/example.lua b/example/example.lua
index 3b989d2..73841c6 100644
--- a/example/example.lua
+++ b/example/example.lua
@@ -1,5 +1,7 @@
-- An example script for norns-etc
-- Load this file in emacs and M-x compile to upload.
+local MusicUtil = require "musicutil"
+engine.name = "PolyPerc"
function redraw()
screen.clear()
@@ -11,6 +13,19 @@ end
function init()
redraw()
+ -- random note output, just to emphasize the point
+ local note = math.random(60, 90)
+ engine.hz(MusicUtil.note_num_to_freq(note))
+ local m = midi.connect(2)
+ local c = metro.init()
+ c.time = 0.5
+ c.event = function ()
+ c:stop()
+ metro.free(c.id)
+ m:note_off(note, 10)
+ end
+ m:note_on(note, 20)
+ c:start()
end
-- This needs to be at the end so that it doesn't conflict with the