Skip to content

Instantly share code, notes, and snippets.

@markwheeler
Last active April 4, 2019 04:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markwheeler/ca2d5fa0b09bd15db8e0b90991150ce1 to your computer and use it in GitHub Desktop.
Save markwheeler/ca2d5fa0b09bd15db8e0b90991150ce1 to your computer and use it in GitHub Desktop.
Minimal implementation of Passersby synth engine on norns.
-- Hello Passersby
-- 1.1.1 @markeats
--
-- Passersby demo script.
--
local Passersby = require "passersby/lib/passersby_engine"
local MusicUtil = require "musicutil"
engine.name = "Passersby"
local note_num
local count = 1
function init()
Passersby.add_params()
local note_metro = metro.init()
note_metro.event = function()
if count % 2 == 0 then
-- Note off
engine.noteOff(note_num)
else
-- Note on
note_num = math.random(45, 69)
engine.noteOn(note_num, MusicUtil.note_num_to_freq(note_num), 1) -- noteOn requires: id, frequency (hz), velocity (0-1)
end
count = (count + 1 - 1) % 2 + 1
end
note_metro:start(0.25)
redraw()
end
function redraw()
screen.clear()
screen.aa(1)
screen.level(15)
screen.move(5, 10)
screen.text("Hello Passersby")
screen.update()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment