Reusing Norns scripts in Electra?

It started with me looking for a drum sequencer like Polyend Seq, where I get access to multiple tracks at the same time. Since I didn’t have more kidneys to sell, I could digest the thought of spending 1000 bucks on a new sequencer :stuck_out_tongue:. I looked around for alternatives and the only things I could find were Deluge (same kidney problem) or touchscreen driven sequencers in MPC or the like. And then it dawned on me that I do have two fantastic Electra touchscreens and that I have already written a sequencer prototype in Electra.

At the same time, I remembered Norns + grid. As I started looking into Norns, I realized that it is all coded in Lua! Hence, this topic. Before me deepdiving into Norns scripts, I wanted to throw the question out to my fellow Lua practitioners here: do you see it reasonably easy/useful to convert/reuse/recycle the many Norns scripts that are out there for use with Electra Lua firmware?

unfortunately, this is unlikely to be practical…

whilst Norns does use Lua for the UI aspects, things like the Grid/Midi integration is done in C++ (which makes callback into the lua process), the same is true of its graphics api (lua → c++).
also at the moment, the lua graphics capablities on the electa one are limited… im sure this will change, but at the moment - graphics would be very limited.

finally, even if we had these capabilities - a sequencer on norns will be based on an api, that is not present on the Electra One so this would have to be ‘emulated’

none of this is suppose to be ‘negative’, rather that the lua implementation on electra one is at an early stage, and also to point out that something being compatible across platforms needs more than the same programming language.

where does this leave us? is norns useful to us?
well, Id say it might be useful for inspiration perhaps, and it may be that some parts of of the code could be re-used, perhaps with re-writes - but really it’ll very much depend on the paricular norns script.

also please bare in mind, the Norns is based on a CM3 , basically a Raspberry PI - so that has more memory and cpu resources than the Electra One (which I think is based off a STM32F4 ?)

that said… the STM chip is more than capable for a sequencer, in fact many sequencers (Squarp Pyramid) use it, also not being based on Linux means its real time performance is likely to be better than Norns.

so the future is bright… just we are at early days - thats why you haven’t seen anything from me just yet :wink:

1 Like

Amazingly insightful as usual! I was transported to one of those lines forum threads where I am used to reading your posts :smiley:.

Yes, I was beginning to realize some of these points as I was reading more into the Norns ecosystem. I don’t have a norns yet, but I do have a teletype where I have done a couple of implementations over scanner_darkly’s multipass.

I will take the angle of inspiration since I am contemplating building a multitrack sequencer and I could look at the ui/ux and corresponding Lua code for some of the sequencer scripts out there.

@martin, I am going to request a couple of simple UI additions to Electra Lua component object (like background color support) which will help immensely in defining an expressive UI with just a rectangle component.

Early days, but exciting future! Looking forward to something awesome from you of course!

1 Like

Perfect. Just an update. I am currently busy with making sure that the Lua Extensions are running smoothly on the controller firmware. I am also refactoring the firmware to make it ready for the next bigger steps. Once it is done, the standalone Lua will get the attention again.

3 Likes

Makes sense! I will need more time to build my prototype as well. So, until that time, I am perfectly fine just using the border color which already is available.

I often do this… I think its nice to reinterpret things with your own ‘take’.

also, you can be ‘inspired’ at a technical level too…
I often look at code, and see how others implement things (e.g. data structures they use), and whilst I may not use thier code - it might influence how I go about implmenting somthing.

1 Like

Yes, both of this makes sense. I remember spending a lot of time with teletype and ansible code as well as the simulator code while I was building over multipass and so many decisions made in those base code was really helpful for me to make my choices.

1 Like

@thetechnobear, you will probably have a quick answer for this. Is it foolhardy to think about a monome grid talking to Electra one via Electra’s USB host port?

These two threads and your contribution there made me think it would be a good idea to pick your brains here :slight_smile:.

In the second thread, tehn says:
"main issue i see is finding a uC with both a host and device port (not sure this exists). a solution would be a avr8/etc as USB host getting FTDI in/out (connected to grid/arc) and then communicate with main stm32+lua+usbdevice via spi/etc. ".

Looking at STM + lua + usbdevice, I am like, wait, is it possible to write Lua to consume serial over USB from grid and use it as an extension of Electra? A hardware 128 * 8 grid controlled by Electra, functioning as a multitrack sequencer will be :star_struck:.

to connect a monome grid to electra one would need some low level support.
basically its using primitive serial protocol over USB, so it basically needs its own USB driver.

so really thats something that can only be done by @martin in the firmware
(I suspect alot of the needed code exists, but its still not a trivial piece of development)

on the flip side, I think its of ‘limited use’ where electra one is ‘midi controller’ but for sure, once we start getting into standalone apps, then i guess more interesting.
(that said, how many monome grid owners these days dont own a norns or norns shield :wink: )

another one for the future… so many possibilies :slight_smile:

1 Like

gotcha, that helps. Makes sense that the Lua script will expect a driver and cannot deal with basic serial over USB. I am one of those grid owners without norns shield because I envisioned my grid to be used with my own application on top of multipass, but that app is in a half-baked stage still :slight_smile:.

1 Like