0

Running tweetcarts on norns

 3 years ago
source link: https://www.eigenbahn.com/2021/05/25/norns-pico8-tweetcarts
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Running tweetcarts on norns

May 25, 2021

norns_p8_ghosts

monome norns

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

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.

PICO-8nornsscreen size128x128128x64palette16 colors (+16 secret)16 grey gradientsshapespoint, line, circle, rectanglepoint, line, arc, curve, circle3D supportnono

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.

p8

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 (pal, 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 (foreach, all, add and 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.

Examples

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).

norns_p8_confetti

manga_effect.lua (original tweetcart by @kadoyan).

norns_p8_manga-effect

tree.lua (original tweetcart by @Alexis_Lessard).

norns_p8_tree

pumpkin.lua (original tweetcart by @von_rostock).

norns_p8_pumpkin

cube.lua (original code by @neauoire of 100 rabbits).

norns_p8_cube

Notes

Tagged #music, #monome.



About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK