diff options
author | gretchen <gretchen@gnar.cool> | 2019-11-18 18:29:34 -0800 |
---|---|---|
committer | gretchen <gretchen@gnar.cool> | 2019-11-18 18:29:34 -0800 |
commit | f8dffe603a9573e80ff0efdc118b26d13fda5b3a (patch) | |
tree | eaa07add07962bfdbbf5a52031f3f5046798cf2b /example | |
parent | 778f93df8a04aa5203c2ed74422a34e98f2d62f2 (diff) | |
download | norns-etc-f8dffe603a9573e80ff0efdc118b26d13fda5b3a.tar.gz norns-etc-f8dffe603a9573e80ff0efdc118b26d13fda5b3a.zip |
Play a random note in the example.
Diffstat (limited to 'example')
-rw-r--r-- | example/example.lua | 15 |
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 |