On line 960 you have this condition: if e.state > 0. So it sounds like maybe state hasn’t been set on the event in this case, and the error is complaining when you ask it to compare nil to the number 0. You could try changing line 960 to if e.state ~= nil and e.state > 0

1 Like

That made the error disappear! But pattern still won’t play back the button presses. Thank you for your help, I really appreciate it

A while ago I mentioned I was experimenting with some ways of drawing icons on the Norns display. One avenue I’ve been exploring is an ultra-simplistic bitmap tool that just draws a binary array by pixel. It’s using an 8x8 grid at the moment and just loops through the array and decides whether to draw a pixel or not. I started by just writing an table in Lua like below, and used line breaks to eyeball where the pixels would draw:

local plus = {
  0,0,0,1,1,0,0,0,
  0,0,0,1,1,0,0,0,
  0,0,0,1,1,0,0,0,
  1,1,1,1,1,1,1,1,
  1,1,1,1,1,1,1,1,
  0,0,0,1,1,0,0,0,
  0,0,0,1,1,0,0,0,
  0,0,0,1,1,0,0,0,
}


function draw_glyph(glyph, x, y)
  local px = x
  local py = y
  for i=1, 64 do
    if glyph[i] == 1 then
      screen.pixel(px, py)
      screen.level(8)
      screen.fill()
    end
    px = px + 1
    if px > (x+7) then
      px = x
      py = py + 1
    end
  end
end

I then thought it might be less cumbersome to just make a little web tool to spit out those tables with a point and click interface like this:

image

At which point I realised if it’s output from tooling it may as well just be a one line string, changing the Lua code to this:

local smiley = "0000000000100100001001000000000001000010010000100011110000000000"

function draw_glyph_from_string(glyph_string, x, y)
  local px = x
  local py = y
  for i=1, #glyph_string do
    if string.sub(glyph_string, i, i) == "1" then
      screen.pixel(px, py)
      screen.level(8)
      screen.fill()
    end
    px = px + 1
    if px > (x+7) then
      px = x
      py = py + 1
    end
  end
end

Now I put that in front of myself, I suppose the tooling could be changed to use different shades of grey. Though in my mind 1 bit icons were fine, in the style of Susan Kare which I’ve always been fond of.

My question is: Is this an efficient way of drawing? Looping through a table of pixel values? It was my understanding that while we can read bitmap images from disk it was generally efficient due to hitting the filesystem.

2 Likes

I did some similar experiments like this awhile back. I used pixel arrays like your first example.

I like your web tool to make the bitmaps. :slight_smile:

I also played around with reading 2-color bitmap files and parsing the pixel data into an array (or set of arrays). This lead to some very basic “sprites”. The only hassle here was the bitmap needed to be very specific in it’s data format or my parse would fail.

As you mentioned the current read-png function will hit the filesystem everytime so it’s not well suited for running in a loop or something.

I started a github issue for updating/expanding the png functions, but didn’t really get finished with it. The idea here would be read the file once and then display from memory.

Ahh cool, yeah I’ve been looking around for some bitmap options but similar finickyness. If it’s of use, I’ve got the time and inclination to build out this web tool to something that could be added or adjunct to maiden. Currently it’s in my maiden directory as icon.html.

1 Like

I try to increase the length per sample on scripts based on ack engine.
I’ve changed the envelope release in both ack lua and sc with no noticable difference.
Any ideas?

I’m just getting stuck into integrating arc and, as there’s not much documentation out there, I wondered if anyone has any tips that might increase my ahh to ugh ratio? Examples of scripts where it’s used would be great, I’m just reading though mangl and am slowly getting my head round it.

Also, this has just reminded me that getting electric dharma wheels going on norns would be amazing. It seemed to mess up on max, the lights eventually all stayed on, but it was a fun until that happened.

Tying both together - I got the impression that the way EDW fell to bits was due to excessive data feed, is there a best practice to keep this to a minimum to keep norns calm?

1 Like

getting input from arc is super straightforward, functionally the same as the encoders but you may want to divide the delta change by 10 to reduce sensitivity. getting the LEDs is a bit more finicky than the grid, because of circles and radians or whatever.

can’t be more specific because it’s been forever since i had time to code and i just brute forced it through trial and error referencing mangl/angl/arcify but if you want to see some more examples both of my scripts in the library category here have some arc functions!

1 Like

Yup, the data grab seems great, very close to the encoders, like you said. But the lights, yeah I’m just going to have to lean into it and get it wrong for a bit.

https://monome.org/docs/norns/script-reference/#arc

has the commands. it’s very similar to the grid.

for example:

a:all(0) -- clears all
a:led(1, 15, 10) -- turns ring #1 LED #15 to level 10
a:refresh() -- update the ring display

LEDs are numbered starting at 1 due north, clockwise up to 64

segment is indeed in radians. if you define tau like i do in https://github.com/tehn/ash/blob/master/angl.lua you can just treat positions like 0-1 where ranges wrap above/below. or you could do some math and turn it into degrees, etc. let me know where you get stuck

4 Likes

This is super helpful, it was segment/radians that was throwing me. I’m going to make a break-it copy of that script and mess with the arc redraw maths as -1*2pi + .2 clearly works but in my head there’s a big jump from 0 to something; I just need to mess with it and see how you got there.
I’m curious what the metro based refresh of arc is for? We don’t do that for grid. Is it in case someone messes with the value from the param page?
It’s really a pretty small amount of code required to get arc doing it’s thing, I can see me wanting to add this to lots of the other scripts but this raises the issue of merging my hack into their core code. Is there an accepted strategy for this? I’m willing to bet that I’m not the only one making fairly trivial customisations who will want to keep up with the updates that the authors are making.
Thanks!

1 Like

The easiest way is likely through github and forking the script. Then you just have to manage pulling/merging new updates and maintaining your changes.

1 Like

super pedantic but this actually is needed with the grid on certain scripts (loom) and is probably just generally a good idea to set up

2 Likes

Super pedantic is great for stuff like this. It’s only a few line of code, I’d be happy to include it in my future hacky scripts. It’s probably trivial but I wonder what the cpu overhead is if doing polled refresh as well as triggered. You are right that in situation where grid maps to something that could change elsewhere we can’t rely on triggered writes. Mo controllers, mo problems.
On that note, has anyone got any tips on where I should rummage around to allow midi controllers that are not on channel 1. Or, possibly just confirm that it’s not something that I ought to get into. I’ve hacked one script and now have the giddy confidence to take a swing at the os, things could get messy.

Take a look at this thread for some solutions to getting midi setup a bit more friendly.

1 Like

snake_case is a great name!

Also, that’s a really useful resource, even for earlier in the learning process, to help read other people’s code and know, with a bit more detail, what’s going on.

I was wondering if there’s a way to trigger another function at the end of a loop / clip in softcut- a little like an end of cycle trigger? I guess that you can poll position… say in the situation I wanted to loop twice on a section of the buffer then shift the entire loop bracket after the end of the second iteration - what would be best?

currently you have to poll position.

but i’ve been meaning to (re-)add a simple trigger poll on loop ends. (trigger output was available in old ugen format.) no-one had asked for it yet :slight_smile:

this wouldn’t be hard to add if someone wants to take it on.

https://github.com/monome/norns/issues/871

it’s minimal. no actual serial port traffic is produced if led state hasn’t changed

3 Likes

If you happen to be like me and keep accidentally hitting cmd+[ and cmd+] in Maiden, backing out of the page and losing your changes… First you’ll try and edit the aceeditor implementation’s key bindings, then you’ll realise an easier solution is to make an “app” out of maiden using something like https://fluidapp.com . It’s Mac only unfortunately, but it’s saved me a lot of frustration. Plus it looks a lot cleaner without the browser chrome.

1 Like

How heavy of a lift would it be to use softcut to create a short, glitchy “delay” like that found on the Drolo Stammen? I plan to begin the studies in a couple of weeks and am looking for an initial project. Wondering if this would be level 1 or level 30, so to speak.

1 Like