Norns: scripting

norns

#57

Aha - Thanks! I hadn’t found a list that had Binary, hex and dec versions of the status byte. That helps a bunch.

I ended up using this in a test script

if data[1] == 144 and data[3] > 0 then
  note_on(data[2], data[3])
elseif data[1] == 144 and data[3] == 0  then
  note_off(data[2])
end

But your example is a bit cleaner.


#58

Great to know. Thanks!

I had been trying to get midi.send working in hello_gong so that’s where I copy/pasted that part. Although I ended up using the earthsea script to get my midi send working.

I’ve got a Livid Block grid controller and it needs to have the midi note sent back to it for the LEDs to light up. I’m guessing this would be similar for other controllers like launchpad or apc40.

FWIW here’s what I added:

local function note_on(note, vel)
   if nvoices < 6 then
     midi.send(midi_device, {144, note, vel})
     --engine.start(id, getHz(x, y-1))
     engine.start(note, getHzET(note))
     start_screen_note(note)
     nvoices = nvoices + 1
  end
end

local function note_off(note, vel)
  midi.send(midi_device, {144, note, 0})
  engine.stop(note)
  stop_screen_note(note)
  nvoices = nvoices - 1
end

midi.add = function(dev)
   print('earthsea: midi device added', dev.id, dev.name)
   dev.event = midi_event
   midi_device = dev
end

#59

metro is in next week study, but until then see playfair's init, or:

  t = metro.alloc()
  t.count = -1
  t.time = 0.5
  t.callback = function()
    print("hello!!")
  end
  t:start()

#60

@shreeswifty @babatunde – Updated my Oblique Strategies script this morning to improve the linear scroll idea I had for this (you can see it in action around the 20-second mark in the video below).

If you’re interested in checking it out, I created a public gist for the script on Github:
Oblique Strategies for Norns

Keep in mind that, while the script is fully functional, the code could definitely be improved (I’m still pretty new to Lua and coding in general)! If you have any ideas for improvements, I’m all ears.


#61

this is awesome!

PM winging your way :+1:


#62

Oh man… there’s probably something wrong with me that the first thing I thought of looking at your code was… Hmmmm - what if we could access a large number of Oblique Strategies (or other interesting data) from a mySQL database?

which led me to… http://keplerproject.github.io/luasql/


#63

joyous

I want to do Angus Maclise’s YEAR or book of Days so when you start Norns it loads what day it is

https://twitter.com/MacLiseYEAR?ref_src=twsrc^google|twcamp^serp|twgr^author

according to Angus of course :slight_smile:


#64

After figuring out midi.send last night I went ahead and tried to fully-midi enable the earthsea script so the pattern stuff would work from my Livid Block midi controller.

Here’s my work in progress. I’m not sure everything is working properly yet. Not sure how other controllers map note numbers so YMMV.

earthsea midi for Block


#65

Thanks for this example. Could you direct me to where I could find an example of a poll in a lua script? I know how to create one in the CroneEngine, just not how to access it in lua.


#66

this is a confusing example (because it’s an array of polls) but: https://github.com/monome/dust/blob/master/scripts/tehn/mlr.lua#L328

i’ll explain polls in week 5’s study


#67

I saw local TRACKS = 4 up at the top of the code and had a brief moment of excitement about more MLR tracks … is the CPU powerful enough to handle this?


#68

we’re working on it, and changing the TRACKS var will not auto-magically increase the number… there’s more plumbing beyond that


#69

Hey, it’s fathers day: if I can be a father, anything is possible.


#70

Thanks for directing me to that snippet. It helped and I have my poll working now. Thank You! Looking forward to the next few norns studies.


#71

@markeats did you manage to make any progress on this? I was considering adding the same, but so far only wanted to add a midi_to_hz function.


#72

Yep, been apart from norns for a few days but should get that integrated this week. Nearly-done version is on the musicutil branch of my fork if you’re curious in the meantime.


#73

So let’s say i’m starting a new script.

Is there a way to list available engines?


#75

typing report_engines() on the command line will show you a list.
more useful info: https://github.com/monome/norns/blob/master/readme-script.md


#76

Ok cool. Thanks for that link. But where is this function listed in the docs? I suppose I should actually read the README files, eh :slight_smile:

FWIW - i thought I looked thru all the docs http://norns.local/doc, but didn’t find it.

Also FWIW - I can’t find a bunch of the functions on the page you linked in the documentation.


#77

right. that doc is a bit out of date. i opened an issue on GH; feel free to pile observations on there.