I tried loading a different script, but after renaming the renamed script always gives the repeated error.

I’m trying study 1 tonight and running into this when starting with the section on the key function:

lua: /home/we/norns/lua/paramset.lua:177: attempt to index a nil value (field '?')
stack traceback:
	/home/we/norns/lua/paramset.lua:177: in function 'paramset.t'
	/home/we/norns/lua/menu.lua:690: in field 'key'
	/home/we/norns/lua/menu.lua:144: in function </home/we/norns/lua/menu.lua:121>

Is this due to the syntax change mentioned earlier or am I doing something wrong?

does the script still work? i believe this is a harmless error message from the param system (which i’ll fix in the next release)

No, the script is odd. I also tried loading Study 1 from the Study folder and also pressing key 2 takes me back to the script browser as if I didn’t load it. Other scripts seem to load and work normally.

I did a little more testing, loading other scripts as well from maiden. The odd thing is that when I go back to my test script, the error I get for an encoder shows the path for the last script I ran:

lua: /home/we/norns/lua/paramset.lua:166: attempt to index a nil value (local 'param')
stack traceback:
/home/we/norns/lua/paramset.lua:166: in function 'paramset.delta'
/home/we/dust/scripts/mhetrick/easygrain.lua:113: in function 'encoders.callback'
/home/we/norns/lua/encoders.lua:56: in function 'encoders.process'

The script I was running to test was this:

-- many tomorrows
-- norns study 1

engine.name = "TestSine"

function init()
  engine.hz(100)
  print("the end and the beginning they are the same.")
end

function key(n,z)
  print("key " .. n .. " == " .. z)
end

function enc(n,d)
  print("encoder " .. n .. " == " .. d)
end

Looking at the developer tools, I see a 404 error for http://norns.local/maiden/snippets/text.js which makes me believe there is something wrong with maiden maybe?

My suspicion is that it may actually be normal behavior - unfortunately I don’t have a device handy to check. I believe @ppqq had enabled some support for snippets in the editor, my guess is it’s looking snippet text which may not have been added to the build or was intended to be provided by an enterprising individual.

1 Like

what’s happening is there was a ā€œfeatureā€ added to lockout PLAY screen for scripts not defining redraw() which is of course a bug for study 1.

the ā€œfeatureā€ has been removed, so the next update will have study 1 working fine. in the meantime you can define a blank function for redraw and it’ll work as expected.

1 Like

Thanks, that fixes it!

confirmed. not great though and definitely something to track down…

I’m working my way through study 3 - got to this point - but cannot get a peep out of this code …. lower half is matrons response. Any ideas?

-- from norns study 3
-- quck script that creates a simple ascending strum pattern

engine.name = "PolyPerc"

function init()
  print("my init")
  strum = metro.alloc(note, 0.05, 8)
end

function key(n,z)
  print("my key")
  if n == 1 then
    strum:stop()
    root = 40 + math.random(12) * 2
    engine.hz(midi_to_hz(root))
    strum:start()
  end
end

function note(stage)
  print("my note")
  engine.hz(midi_to_hz(root + stage * 5))
end

function midi_to_hz(note)
  print("my midi to hz")
  return (440 / 32) * (2 ^ ((note - 9) / 12))
end
norns.script.load("deeda/dutils9_strum")
# script load
# cleanup
# script clear
# script run
loading engine: PolyPerc
<ok>
Engine.register_commands; count: 6
___ engine commands ___
amp	 	f
cutoff	 	f
gain	 	f
hz	 	f
pw	 	f
release	 	f
___ polls ___
amp_in_l
amp_in_r
amp_out_l
amp_out_r
cpu_avg
cpu_peak
pitch_in_l
pitch_in_r
tape_play_pos
tape_rec_dur
# script init
my init
READING PMAP

actually - I noticed that when I dragged the above script into the reply box, it looked ok correctly indented etc. but once entered the indentations are lost - what’s the trick here?

enclosure your post in triple backticks (```)

ie

```
this
```

i edited your post, check it out.

will investigate your script shortly

1 Like

Many thanks T - I know you guys are busy - so when you can, is super fine with me :smiley:

Ah! 1st mistake I see is the double quotes around the engine name.
Changed to single quotes - still no sounds. Matron details the same

Above ā€˜strum’ code problem SOLVED. I’ve now got this working - but by a slightly fortuitous route. I’ve got into the habit of adding in a print statements, often with in a function, as an aid to debugging. Originally, not only was I not getting any sound - but I only saw ā€˜init’ function working and nothing else. Eventually, as a trial I added this at the end of the script.

function redraw()
screen.clear(0)
screen.text(ā€œstrumā€)
screen.update()
end

Then my debugging prints appeared along with the strums. Hooray! Removing all the debugging prints made, as expected, no difference - it still worked. Removing this small function once again produced silence.

there’s an unfortunate bug that was originally thought of as a feature in the current build. scripts without a redraw() function get locked into MENU mode, so there’s no way to trigger key/encoder input.

you’re correct that the solution is to define redraw but this bug will be solved in the forthcoming update. thanks for your patience and nice work discovering this

quick fix: add the line to your script

redraw = function() end

2 Likes

Would be good to add this to the documentation for studies. Issued PR. Unless of course the forthcoming update is imminent!

update is forthcoming. i’d prefer for defining redraw to not be required, and the change has been made to follow.

2 Likes

No worries! Just took a little time to track down the issue here as I was working through the studies.

Was working with study 2 (Patterning) and it seems that the init function doesn’t work.

The init() as it is gives me this in maiden:

lua: /home/we/dust/scripts/jonnybutler/patterning.lua:25: attempt to perform arithmetic on a nil value (global 'number')

stack traceback:

/home/we/dust/scripts/jonnybutler/patterning.lua:25: in function 'encoders.callback'

/home/we/norns/lua/encoders.lua:56: in function 'encoders.process'

But if I put the 2 variables outside a function at the top of the script, all seems well:

color = 3
number = 84

EDIT: Disregard. Must have had my levels too low.

Study 5 question:

I’m getting no changing values coming from the very first port polling snippet at the beginning of the study. It only reports " in > 0.00 " in a running stream on the maiden display.

I do have bars in the audio in meter.

What could the matter be?

study 1 question…

just started please help the noob :slight_smile:

I’m stuck on the key pressing. When I add key function to the script:

function key(n,z)
print("key " … n … " == " … z)
end

Save and re-run I get this message on the key pressed on Norns:

lua: /home/we/norns/lua/paramset.lua:177: attempt to index a nil value (field ā€˜?’)

stack traceback:

/home/we/norns/lua/paramset.lua:177: in function ā€˜paramset.t’

/home/we/norns/lua/menu.lua:690: in function ā€˜fileselect.key_restore’

/home/we/norns/lua/menu.lua:144: in function </home/we/norns/lua/menu.lua:121>

Not sure where the problem, anybody can help? Thanks!

It’s a bug in study 1. Will be fixed in the coming update. A work around is detailed below.