Skip to content

Instantly share code, notes, and snippets.

@dndrks
Created Aug 21, 2022
Embed
What would you like to do?
(5) sequins
-- nc03 snippet: replace the jumble with sequins!
sc_fn = include 'lib/sc_helpers'
sc_prm = include 'lib/sc_params' -- param-based controls over softcut
lfo = require 'lfo' -- parameter-based lfo library
s = require 'sequins' -- https://monome.org/docs/norns/reference/lib/sequins
function init()
-- always keep this in the init, just in case the files haven't been migrated:
sc_fn.move_samples_into_audio()
sc_prm.init() -- build the PARAMETERS UI entries for all 6 softcut voices
-- kits: 'default-1', 'default-2', 'fltr-amod-eq', 'fm-lite', 'heavy', 'mods-1', 'mods-2', 'verb-long', 'verb-short'
sc_fn.load_kit('default-2')
-- not just a random jumble anymore!
play_seq = {}
-- we'll set up a 'play_seq' for each voice and fill each with 1's (trigger) and 0's (no trigger):
-- (note that each voice's sequins can have their own length, which makes for nice rhythmic interplay)
play_seq[1] = s{1,0,0,0,0,0,1,0,0,0,0,0,0,0}
play_seq[2] = s{0,1,0,0,0,0,1,1,0,0}
play_seq[3] = s{0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0}
play_seq[4] = s{1,0,1,0,0,1,0,1,0,0}
play_seq[5] = s{1,0,0,0,1,0,0,0}
play_seq[6] = s{0,0,1,0,0,0,0,1,0}
end
function start_song()
song = clock.run(
function()
while true do
clock.sync(1/4) -- we'll just cycle through each sequence at 1/16th notes
for i = 1,#play_seq do
local step_value = play_seq[i]()
if step_value == 1 then
sc_fn.play_slice(i,1)
end
end
end
end
)
end
function stop_song()
clock.cancel(song)
song = nil
for i = 1,#play_seq do
play_seq[i]:reset()
end
end
-- add some key interactions!
function key(n,z)
if n == 3 and z == 1 then
if song == nil then
start_song()
else
stop_song()
end
elseif n == 2 then
if z == 1 then -- when k2 is held:
for i = 1,#play_seq do
play_seq[i]:step(math.random(2,10)) -- each sequins step size changes randomly
end
else -- when k2 is released
for i = 1,#play_seq do
play_seq[i]:step(1) -- each sequins step size returns to default (1)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment