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.

Aaaaa ok I’ve even re-run the update via sftp to check it … thanks!
Looking forward to the fix!

1 Like

hello :slight_smile: I’ve had norns for a few months but am only getting around to doing the studies now. I’ve run into something that has got to be user error but I can’t figure out what’s wrong.
I’m doing study 1 and I can load the script on the norns hardware but when I hit the play button in Maiden, I was initially getting a message that said File Not Found… with the name of the script. I saw that none of the other scripts had names with spaces so I renamed my study 1 script with one word instead. Now, when I click the play button in Maiden, nothing happens at all. What am I missing? Thank you in advance for helping me!

You might want to delete the file and redo. Select the file in maiden and tap the minus sign. Then create a new file, name it, ex: study1.lua. You need to be sure to add the “.lua” extension, otherwise it won’t run.

Good luck!

thanks for the quick reply! I will start fresh now and report back :slight_smile:

also, in the STUDY/ menu, there’s already a STUDY1. Is this the finished versions of the same script I’m copying from the study 1 website? thanks!

Yes, I think studies 1, 2 and 3 are included.

You can make your own folder in maiden and store your work there.

Reading through the studies in anticipation of owning a Norns. At the tail end of study 3 there’s a link to class docs which only works if you’re connected to Norns. Any reason not to have a link that works otherwise? Is this available on github? I’m happy to take a look at making the changes if that is possible.

Also, can we anticipate new studies once v2 is bedded in? The first post hints at at least two more.

1 Like

it’s here https://monome.github.io/norns/doc/