Sending needs a colon instead of a dot

midi_signal:note_on(60,127)

1 Like

this is amazing

i’ll give some feedback when i have time to review and test properly

1 Like

for ppl really familiar with object oriented programming the colons thing in lua makes tons of sense, but I could see how that could get totally confusing for beginners. I wonder if this could/should be more standardised for the core library stuff. maybe that’s been brought up already.

Great stuff taking this on!

Just one small thing I noticed – I believe norns redraw is limited to 15fps (it definitely was in v1, haven’t tested in v2).

you sir, legend!!!

A post was merged into an existing topic: Norns: scripting

this is beautiful, thank you!

Oh, I’ll fix that. But I would love to see a definite answer, perhaps in a documentation somewhere?

Updated with an example of OSC receiver.

OSC

In Maiden, look at the eight example file of this tutorial.

  • Navigate to the eight example with code > tutorial > 8_osc.lua.
  • Send it to the device by clicking on the play button to the top right of the Maiden window.
  • Send osc to the device by addressing norns.local at port 10111.
  • Look at the incoming data.

To recieve the osc signal, you need to connect to the osc interface with osc.event = on_osc_event, and give it a method to get the event, like on_osc_event(path, args, from), the from parameter is an array including the ip and port.

5 Likes

could you do one on midi clock in/out? :wink: and thank you so much for taking the time to do this! :raised_hands:

I’ve just looked at the implementation, I think I can make a simple implementation for the tutorial, but it’s a bit more involved than the rest of the midi example. I’m thinking about making it its own example file. Stay tuned :slight_smile:

edit: @sno Nevermind, that was easier than I thought, I will add it to the current tutorial shortly!

5 Likes

Added a grid example(video)!

Grid

In Maiden, look at the ninth example file of this tutorial.

  • Connect a Monome grid device, and select it in SYSTEM > GRID.
  • Navigate to the ninth example with code > tutorial > 9_grid.lua.
  • Send it to the device by clicking on the play button to the top right of the Maiden window.
  • Touch a button on the grid and watch it light up on the Norns.
  • Move the light across the monome by turning the knobs on the Norns.
  • Change the brightness by pressing the buttons on the Norns.

To communicate with the grid, you need to connect to the grid with g = grid.connect(), and give it a method to get the key event, like g.key = on_grid_key. The led(x,y,brightness) method allows you to toggle LEDs.

g:all(0)
g:led(1,2,15)
g:refresh()
9 Likes

thanks for this, i’m very interested in Norns, this will get me thinking more clearly.
Cheers

amazing work, thank you so much! :pray:

@sno Fwiw I have a simple midi clock example using 2.0 syntax here

But many of the older scripts (from Norns 1.x) use the beatclock library which handles clock a bit more abstractly.

2 Likes

thanks for sharing @okyeron! I’m very new to this kind of language so the tutorials help a lot :slight_smile:

1 Like

shouldn’t this be 1.0 / 15

for 15 fps? (since metro time is in seconds, as an interval?)

shouldn’t this be 1.0 / 15

Yes! Absolutely, I’ve corrected the sources and thread.

@tehn Do you know if grid.attached() works right now? I can’t seem to be able to check if the device is connected without an error.

i’ll check that. it should and if it doesn’t it’ll be an easy fix.

quick comment on:

the language is a little misleading as the code already lives on the norns, hence isn’t “send to it”, rather the play button is just a command shortcut for script.run(...) (that’s not the exact command) to just tell the menu system to execute the script that maiden is looking at. maybe just “run the script” instead of “send it to the device” ?

At the moment, grid.attached() throws:

9_grid.lua:24: attempt to call a nil value (field 'attached')

Which I would like to communicate wether the grid is connected or not, to the user.

I will update with run the script across the tutorial.