Photo by Craig Whitehead on Unsplash

monome norns, supercollider and lua — part 1

norns is ___

kid_sputnik
5 min readSep 23, 2018

--

Norns is the latest device from the geniuses at monome, created for us musicians that love to code as much as we love to make sounds. Inside this wonderfully minimal box is a full-fledged Linux based computer that makes sounds with Supercollider and lets us build apps with Lua. I have to admit, both Supercollider and Lua have long been on my list of languages and tools that I want to learn but haven’t gotten around to, so getting norns has turned into a crash course in both. It’s still early in my adventure, but I thought I would share what I’ve found so far.

Supercollider

Supercollider is a programming language and a set of tools for creating sounds with code. If you squint your eyes just right, Supercollider starts to look and feel just a little bit like the programming language Ruby. But Supercollider is very much it’s own thing with it’s own (strange?) syntax, and coming from traditional programming languages it might take some time to get used to. As a beginner in any language, my first instinct is to find some tutorials and start hacking away. One such tutorial that I found is this one from composerprogrammer.com. Fairly quickly in I came across a little demo script that showcases the Gendy1 and Resonz objects to make some beautiful filtered noise sounds, with the mouse X and Y coordinates mapped to parameters. What a fantastic starting point for our norns studies!

If you have the Supercollider application running on your computer you can paste this code as-is, run it and hear sound. To get this on our norns will require a more work.

Supercollider on the norns

In order to connect our computer to the norns, we need to connect our computer’s WiFi to the norns’ WiFi hotsop. Once that is done, we can run ssh to get in the device. ssh (which stands for Secure Socket Shell) is a tool for one computer to connect to another using the command line terminal, and is extremely common when connecting to Linux servers and devices. To connect, we need to open a command line terminal and run:

ssh we:sleep@172.24.1.1

This command will connect to our norns device using the user name we. When prompted, use the password sleep.

In order to get our Supercollider scripts into the norns as a new sound engine, we need to create a file in the folder dust/lib/sc. We will call ours Engine_GendyTutorial.sc. Now, one thing you will realize right away is, editing our code is not going to be very fun at the command line. We can use tools like vi or emacs, but I prefer to use something a little bit friendlier. What I’m using instead is Visual Studio Code, which is a pretty amazing free text editor from Microsoft. Once you get this installed, you can go into the Extensions tab and search for ssh fs, which is a neat extension that lets us connect to a remote folder using ssh and work with it like it’s on our computer. After you install the extension, go to View > Command Palette, search for ssh and select Create a SSH FS configuration and create a configuration that looks like this:

{ 
"label": "Norns",
"root": "/home/we",
"host": "172.24.1.1",
"port": 22,
"username": "we",
"password": true,
"name": "norns"
}

Once you connect, you should see our norns code inside the device listed on the file explorer. Exciting! Once you open up a Supercollider .sc file you might feel a bit sad because VS Code doesn’t know what these files are and everything is just black and white. At the time of writing this there are no Supercollider extensions for VS Code, but I found that going to the bottom right of the screen and selecting Ruby as the language will make most Supercollider code look halfway decent.

One thing to remember with norns is that, we can’t just copy and paste random Supercollider code from the internet and expect it to work as-is. Norns wants it’s Supercollider classes to inherit from something CroneEngine, which gives us hooks to wire up inputs and outputs and parameters to make them accessible by the norns device and our Lua code. Luckily, monome has this nice Gist with a simple audio in/out pass thru example that we can start with and hack our own code in. So, we can copy this into our Engine_GendyTutorial.sc file as a start, and then we modify it so we end up with this:

You can see we added some var parameters for our x, y and fill parameters, and hooked some up to the norns via the addCommand function.

Once we have our Supercollider code ready, the next thing we want to do is make sure it actually works. From our ssh terminal we opened earlier, and run /usr/bin/sclang. If all goes well, you should see some output about code being compiled, and eventually some error that an OSC port is already in use. Or, if our code isn’t right, you should see a compilation error with some helpful information about which lines are causing the error and some error message that should describe what needs to be fixed. Either way, to get out of Supercollider press ctrl + d.

Once our code looks good, we need to restart norns. To do that, run the following commands:

cd norns
./stop.sh
./start.sh

Lua and Maiden

Now that we have our new engine, we need to create a new script to run it on our norns. The first step is to open up the Maiden editor, which we can do right from a web browser by navigating to http://norns.local/maiden/ (make sure you are connected to the WiFi hotspot!). Once we are connected, try making a new folder in the scripts area for your own scripts (I named mine after my Github user name daniel-bytes). Inside the folder, create a new script and name it something (maybe gendy-tutorial.lua). Now it’s time to create our script, which will load up our new engine and assign our three norns knobs to main volume and our x and y parameters.

One we have our code in place, save it and click the Run Script button on the right hand side. Hopefully we should now hear some haunting noises, with our encoders controlling volume and filter settings.

--

--