norns.el (Emacs ❤️ norns)

norns.el

for once not a norns script (nor a mod) but an Emacs package to interact w/ norns.

icon

norns & Emacs are certainly my 2 favorite platforms (i do love uxn and PICO-8 as well but have yet to explore those as much).

the intersection of norns authors and Emacs users is certainly pretty thin but hey, there’s at least me!

Requirements

Emacs, one or several norns to interact with.

Documentation

everything is in the README, but basically one can:

  • spawn maiden and SuperCollider REPLs as any other shell (w/ history, prompt… thanks comint)
  • launch currently visited script
  • highlight some lua / sc-lang and evaluate it (like Ctrl-Enter in the maiden’s web editor)
  • be prompted for the list of scripts and choose one to launch

the code is intended to be used for norns accessed through TRAMP but should work for Emacs installed onto norns directly (untested).

also, if you ever happen to have several norns instances to play with, they can all be accessed concurrently and separately (state is namespaced by hostname).

all this in pure elisp w/ standard deps (no external binary needed).

Download

not yet submitted to MELPA, so for now installation is either manual of w/ quelpa.

34 Likes

Nice. I usually run Emacs straight on norns (because every good synth runs Emacs), and will check it out. Maiden REPL has been giving me trouble, namely segfaults.

Cheers.

2 Likes

how did you interact w/ maiden REPL? through a term-mode buffer + the curses binary (maiden-repl)?

this package takes a more direct approach: it communicates directly through websockets (as does the web interface to maiden).

Yeah ssh to norns and also have a console access on the OLED screen, and maiden-repl. The web interface has been more fun. This might change the rules of engagement :slight_smile:

1 Like

Dang. Amazing! Maybe just the thing I need to learn some emacs.

1 Like

Woohoo! Fellow Emacs user here.

Have wanted to get a REPL setup going for Crow in that text editor. Since Crow also uses Websockets, I’ll definitely be taking a gander at your code.

Good work!

2 Likes

Spooky because I logged on for the first time in a while with Emacs on the brain! I started switching back to it a month or so ago and once I’ve got all my work stuff moved over this is right at the top of my fun time todo list!

3 Likes

If I want to get started on using emacs instead of VS Code and nano, what would be a good place to start? Both in regards to emacs versions (templates or dot files, as I understand) but also beginner resources.

Sorry for OT, but want to be on your club :grinning:

2 Likes

well, first of all learning Emacs is a journey. it’s way more than an editor but a platform for creating text-based apps.

you don’t simply open Emacs and have a working editor right off the bat…

haha, no, you have to make it your own!

don’t expect to get into Emacs without learning elisp (it’s “configuration” language, which is a full-fledged scheme-like lisp).

i personally started w/ “vanilla” Emacs (blank configuration) and tweaked it progressively along the years but have heard that prelude provides a good starting experience.

it’s not much harder than learning lua + norns scripting imho, but familiarity w/ any lisp dialect sure helps.

for elisp, this is the best learning material i’ve found:

for general usage, i guess youtube tutorials might be better suited.

6 Likes

just pushed some code.

we now have sc REPL support (+ a few bugfixes).

2 Likes

added norns-restart (whole norns stack) and norns-reboot (OS) helpers.

;restart inside a running maiden-repl also works, and aggressively binds to maiden to get lua startup logs.

Just a comment and not a suggestion/distraction from going through Maiden, but my setup for messing with the SuperCollider engine has been simply from the normal scel.el. I haven’t got the handshake super smoothed out, but works fine. It involves increasing maxLogins, a Server.connect and reassigning s. Then livecoding with SynthDefs and Pattern may commence.

That’d a different use case though, if I understand correctly. You are describing connecting to the norns scsynth server from a separate instance of the sclang interpreter on your machine.

When you use the norns websockets you can interact directly with the norns SC classes and engines in the norns sclang, which is useful for engine development.

Yes that’s right, hence “just a comment” about Emacs ⇆ SuperCollider on norns.

added 2 new things:

  • pretty print variable at point with command norns-maiden-inspect-symbol
  • toggle keys & encoders remotely (through OSC)

please note that you’d have to make (temporarily) your var global in order to pretty print it.
it dynamically injects inspect.lua to pretty print even nested data structures.

2 Likes

the package is now on MELPA, so easier to install.

also did various fixes (notably ;restart under a REPL restarts only this REPL instead of everything).

2 Likes

Loading with use-package or load-library gives me a “Specified time is not representable” from

Please don’t hesitate to ask if I could help with something eg. info, triage or testing.

1 Like

alright, really quick test then.

does evaluating this elisp (e.g. in your *scratch*buffer) throw an error?

(encode-time '(0 0 0 1 1 1900 nil nil t))


EDIT: didn’t spot that it was the exact line Emacs was complaining about in your photo.

arf, i spotted that the standard osc package (which i only depend on as a “bonus” for triggering buttons / encoders remotely) does some unholy stuff (negative unix timestamps).

it works on my x86_64 Linux station but i had to fork the lib in my Windows install, and it appears ARM builds don’t like that either.

guess i’ll remove the dep and submit a bug report (which is cumbersome for Emacs “standard” packages IIRC).


EDIT2: done :heavy_check_mark:

@xmacex you may have to delete the ~/.emacs.d/elpa/norns-<version> folder to remove the error and force package.el to refetch the package at startup.

3 Likes

Thanks, that worked and norns.el now loads on Emacs on the device. The (encode-time) indeed was the issue, that same ELisp statement works fine on my Emacs on Android under Termux. Strange!

This is very cool :cactus:


With sequins and lattice and on-device Emacs and MIDI cc this is a bunch of fun.

Riser note stuck on Digitone since yesterday, everything else is sequins+lattice driving OP-Z as a sampler with tight looping envelopes as a kind of a wavetable synth.

2 Likes