Norns: scripting



Any one else get a constant tone coming out of their Norns when loading the Kria Midi script? Also wondering what I need to do to get mp_ack to send midi out.


pretty sure that’s because it has this at the start = "TestSine"

i think you could comment that out and be just fine.
(I guess I should probably test that advice, but can’t do that for a bit)


That took care of it! Thanks


Oops sorry (& 20 characters)


Can anyone point me to a technique or example of slewing values? I’m thinking in midi space especially slewing cc values over time. :pray:


I’m trying to stop a MIDI loop with a keypress and restart the loop with the same keypress. The following function does stop the loop, but each successive keypress simply advances one note at a time from the point where it stopped.

k_pos = 0

function key(n,z)
if n == 3 then
if k_pos == 0 then
k_pos= 1
elseif k_pos == 1 then
k_pos = 0

How should this be handled? Thanks.


The key function gets called on both press and release. It sounds like you just need to filter out the release.

so, instead of if n == 3 then you could do if n == 3 and z == 1 then


Bingo! Thanks, Justmat


metro questions!

I’d like to make a delay() or wait() function but not real sure what to do.

As an example - On a specific user interaction I’d like to have a function fire x amount of times with a 1 second interval. So with Arduino (that I know pretty well) I could just use a delay(1000). Here on norns I need a metro, but this seems different than doing a callback function every tick of the metro.


yes, you’ll have to indeed create a metronome and stop it after X runs (see count parameter to metro.init). or create a bunch of oneshot metros running one after another. there’s no delay() as such because it will block the lua interpreter from doing other work (handling messages, etc.).

i’m currently working on a clock module that uses coroutines for concurrent wait operations and it will provide a more intuitive way to do the above.


FWIW - I tried this but was getting -1 for count so I must’ve been doing something wrong. I’ll have to look at that again.

I ended up making my own counter in the metro callback and then stopping the metro as you suggest. I wasn’t sure at first if it was OK to stop the metro from within the callback, but that seems to work just fine.