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

1 Like


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.

1 Like


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.



Is there a way to execute run script via ssh?
(i.e. whatever magic that the Maiden ‘run script’ button does)

Working in a text editor and sftp right now and I have to reach over and click buttons everytime I want to re-load the script I’m working on. Gets tiresome after the 100th time.




  1. run matron directly instead of using the websocket wrapper, call script.load(foo) directly from the REPL.

  2. roll a little utility with readline and nanomsg to act as a local websocket endpoint.

but no, there’s no utility to make this easier at the moment. would be a nice addition.

1 Like


What @zebra said but I believe the function is norns.script.load(...) - at least that is what maiden is using.



Could I curl whatever maiden is doing?



Unfortunately no - while maiden uses HTTP for all the file I/O the REPL and the play button work by talking with matron and sc via separate web socket connections.

The play button works by sending lua code directly to matron as if one had typed it into the REPL.

You could make a web socket client to do it - it wouldn’t disrupt the other parts of the system but it is work.



Thanks! I’ll investigate that aspect further. What’s the format for that message/request?

1 Like


Does anyone have any code for selecting an IP address within the parameter menu? I have a script that is sending OSC and I’d like to be able to select the IP address it’s sending to via the parameters menu.



i don’t believe there’s a good way to do this presently. we need to create a string type for params, and then use the textentry for interfacing.

your use case is a good reason to add this.



Is there a way for me to simulate the Norns screen while I wait for the Norns itself to arrive? I have a few ideas for patches and want to get coding. Also it would be useful generally for coding at work during quiet periods.

1 Like