As stated in a previous post, I got myself a monome norns.
Just to recap, it’s a programmable instrument for which anyone can make small apps (scripts) in Lua.
After playing a bit with it, I was struck by the similarities it shared with another platform.
PICO-8 is a fantasy console, a software platform allowing anyone to make small games (carts) in (you guessed it) Lua.
It can be seen as an homage to the homebrew programming scene during the home computer era (late 70s / early 80s), when people used to share small games written in BASIC1.
So both PICO-8 and norns revolves around the idea of a community sharing small apps. The main difference is that one targets video games while the other focuses on music.
They both have rather limited capabilities and APIs, but this is by design: from constraints creativity flourishes.
One particular phenomenon that emerged with PICO-8 are tweetcarts, people posting demos of code fitting in a single tweet.
These show that you don’t need a super fancy graphical lib to do some impressive stuff, not too dissimilar to the demoscene.
To be honest, I follow a few profiscient tweetcart creators2 and now a fair amount of my twitter feed is populated by those.
The graphical libs
PICO-8 and norns graphical libs are pretty close to each other.
|palette||16 colors (+16 secret)||16 grey gradients|
|shapes||point, line, circle, rectangle||point, line, arc, curve, circle|
It became apparent to me that with a rather minimal adaptation layer, I could run tweetcarts on norns.
Hopefully this could help the people from one community be inspired by the work provided by a like-minded other.
People could quickly steal animation ideas from tweetcart codes, remix them to their liking into their interactive music-making scripts.
In practice it took a bit more effort than I expected.
One mildly complex aspect was the conversion of PICO-8 color palette to norns’ greyscale values.
It would have been pretty straightforward if the indexes of the color palette could not be readdressed at run time (
palt) with some special range of values to access a secrete palette of colors.
In addition to its own graphical API, PICO-8 also provides its own set of core functions that behave differently from the default Lua ones.
I got stuck on trying to replicate its
atan2 function, and eventually stole the implementation from @benjamin_soule’s PAT Shooter that predated its introduction in the API.
I was also missing the table manipulation functions (
del). That’s when I discovered picolove, another adaptation layer project allowing to run PICO-8 games under the LÖVE game framework. So I mostly copy-pasted those with minor tweaks to accomodate norns’ handling of memory.
Another limitation was norns’ API inability to do the
pget functionality (get value of drawn pixel).
Thankfully, Sam (@csboling) got inspired by the idea and came up with the
screen.peek function. They even came as far as to document the whole process, so kudos to them.
Finally, I managed to get something working against most tweetcarts I was throwing at it:
You can see its norns.community page and discuss about it on its lines thread.
The example at the top of the article comes from this tweetcart by @Alexis_Lessard.
The project comes bundled with a few others:
confetti.lua (original tweetcart by @von_rostock).
manga_effect.lua (original tweetcart by @kadoyan).
tree.lua (original tweetcart by @Alexis_Lessard).
pumpkin.lua (original tweetcart by @von_rostock).
cube.lua (original code by @neauoire of 100 rabbits).
Tagged #music, #monome.