# Reusing Norns scripts in Electra?

**URL:** <https://forum.electra.one/t/reusing-norns-scripts-in-electra/812>\
**Category:** Developers\
**Created:** [June 26, 2021, 1:35pm UTC](https://forum.electra.one/t/reusing-norns-scripts-in-electra/812 "2021-06-26T13:35:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![shankar](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/shankar/32/463_2.png) [@shankar](https://forum.electra.one/u/shankar)\
**Post date:** [June 26, 2021, 1:35pm UTC](https://forum.electra.one/t/reusing-norns-scripts-in-electra/812/1 "2021-06-26T13:35:20Z")

</div>

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 😛. 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?

---

<div class="post-metadata">

**Author:** ![thetechnobear](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/thetechnobear/32/134_2.png) [@thetechnobear](https://forum.electra.one/u/thetechnobear)\
**Post date:** [June 26, 2021, 3:14pm UTC](https://forum.electra.one/t/reusing-norns-scripts-in-electra/812/2 "2021-06-26T15:14:29Z")

</div>

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 😉

---

<div class="post-metadata">

**Author:** ![shankar](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/shankar/32/463_2.png) [@shankar](https://forum.electra.one/u/shankar)\
**Post date:** [June 26, 2021, 3:31pm UTC](https://forum.electra.one/t/reusing-norns-scripts-in-electra/812/3 "2021-06-26T15:31:07Z")

</div>

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

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!

---

<div class="post-metadata">

**Author:** ![martin](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/martin/32/145_2.png) [@martin](https://forum.electra.one/u/martin)\
**Post date:** [June 26, 2021, 3:40pm UTC](https://forum.electra.one/t/reusing-norns-scripts-in-electra/812/4 "2021-06-26T15:40:14Z")

</div>

> [@shankar](#):
>
> @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.

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.

---

<div class="post-metadata">

**Author:** ![shankar](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/shankar/32/463_2.png) [@shankar](https://forum.electra.one/u/shankar)\
**Post date:** [June 26, 2021, 3:43pm UTC](https://forum.electra.one/t/reusing-norns-scripts-in-electra/812/5 "2021-06-26T15:43:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![thetechnobear](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/thetechnobear/32/134_2.png) [@thetechnobear](https://forum.electra.one/u/thetechnobear)\
**Post date:** [June 26, 2021, 3:43pm UTC](https://forum.electra.one/t/reusing-norns-scripts-in-electra/812/6 "2021-06-26T15:43:32Z")

</div>

> [@shankar](#):
>
> I will take the angle of inspiration

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.

---

<div class="post-metadata">

**Author:** ![shankar](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/shankar/32/463_2.png) [@shankar](https://forum.electra.one/u/shankar)\
**Post date:** [June 26, 2021, 3:46pm UTC](https://forum.electra.one/t/reusing-norns-scripts-in-electra/812/7 "2021-06-26T15:46:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![shankar](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/shankar/32/463_2.png) [@shankar](https://forum.electra.one/u/shankar)\
**Post date:** [June 26, 2021, 5:10pm UTC](https://forum.electra.one/t/reusing-norns-scripts-in-electra/812/8 "2021-06-26T17:10:01Z")

</div>

@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?

> **[iOS developer asks: Why not make monome grid USB MIDI class compliant?](https://llllllll.co/t/ios-developer-asks-why-not-make-monome-grid-usb-midi-class-compliant/18279)**
>
> I’m having trouble finding an answer via searching… so monome grid 128 would seem a perfect match for MIDI CCs (of which there are 128). Send a MIDI CC to change the brightness of a button. Grid could send a CC to indicate a button has been pressed....

> **[Grid-usbmidi hardware bridge](https://llllllll.co/t/grid-usbmidi-hardware-bridge/18305)**
>
> @okyeron cool if you want to put something on GH i’d be happy to contribute, though i’m travelling without grid or much extra hardware until mid-january. what i’m thinking is that another kind of “elegance” can be achieved by adding a small...

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

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

---

<div class="post-metadata">

**Author:** ![thetechnobear](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/thetechnobear/32/134_2.png) [@thetechnobear](https://forum.electra.one/u/thetechnobear)\
**Post date:** [June 26, 2021, 6:19pm UTC](https://forum.electra.one/t/reusing-norns-scripts-in-electra/812/9 "2021-06-26T18:19:20Z")

</div>

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

another one for the future… so many possibilies 🙂

---

<div class="post-metadata">

**Author:** ![shankar](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/shankar/32/463_2.png) [@shankar](https://forum.electra.one/u/shankar)\
**Post date:** [June 27, 2021, 2:34am UTC](https://forum.electra.one/t/reusing-norns-scripts-in-electra/812/10 "2021-06-27T02:34:17Z")

</div>

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