The easiest way is probably to use ssh and a command-line editor on norns itself or sshfs to mount norn’s filesystem locally and use your local editor of choice.

Otherwise you should be on the right track to build an update, which is the process to create an update like https://github.com/monome/norns/releases/tag/180603
If you want to go this route the easiest option is probably to check how the linked update works and go from there. It contains a simple shell script that copies the relevant parts to the correct location.

[edit] Tbh I don’t think using updates is the way to go for local development and there’s also the potential of messing up “real” future updates

this requires disassembling norns, right? i’m okay with just copying the update file via usb.

i looked at the update file but that didn’t help figuring out how to create one. if i just overwrite the matron
part, and leave the rest as is, would that work? or do i need to do a full setup?

sorry, i’m feeling completely dumb with this and multiple repos. is there a document that describes a full set up or should i just go over each repo and set it up as described? i’m really only interested in making changes to matron at this point.

@scanner_darkly yes, the multiple repo’s become confusing for sure.

the “build update” instructions are really for building big pulic updates. if you’re just doing development:

  • turn on wifi
  • ssh we@norns.local (or ip address) pw:sleep
  • now you’re in
  • cd norns, mess with code. ./waf to compile.
  • ./stop.sh to stop crone/matron. ./start.sh to start crone/matron

for a lightweight REPL w/o maiden while working on matron:

  • ./crone.sh > /dev/null &
  • build/matron/matron

matron can then be quit with ctrl-c and restarted after a recompile.

let me know if anything is confusing and i can clarify. this is certainly a nice way to develop though, incredibly immediate.

7 Likes

thanks brian - yeah, this is exactly what i was looking for (even better actually, not having to go through the update process). will give it a try! @ppqq also graciously reached out with some great info. i’ll document how things go for other windows folks.

3 Likes

First: it has been really fun watching everyone digging into norns and sharing your experiments and insights. Thanks for that. :slight_smile:

I’m wondering if anyone has identified an existing way to send serial data over USB from lua? I know there was some talk about this being possible prior to launch, but I haven’t found examples nor have I found anything that looked promising in the various projects from a support perspective.

(Full admission, my exploration of the source was cursory at best. I haven’t been brave enough nor had the time to really get my hands dirty … yet. I’ve mainly been focusing on playing with lua. Apologies if I’m missing something obvious.)

Thx!

The details for how maiden connects to matron and crone are outlined in the repl connection section of the README for the web app source directory.

To summarize, one must:

  • Start a ws-wrapper wrapped instance of both matron and crone (this is what the matron.sh and crone.sh scripts do respectively)
  • Start the the maiden http backend (see the start.sh script in the maiden repo)
  • Point a web browser at http://localhost:5000/ (assuming one is running everything locally)

What happens when the maiden app runs in the browser is that it turns around and loads the repl-endpoints.json file to discover the host/ip addr and port numbers for matron and crone. The browser app then directly connects to the ws-wrapper wrapped processes (the repl does not go through the http backend).

Hopefully that clears up how the repl handshake is done.

haven’t really tried this, but if you just want to send strings you should be able to use the standard io library:

f = io.open("/dev/tty...", "w")
f:write("beep boop")
f:flush()

(there’s fancier options with the posix library. again i haven’t really attempted this.)

reading is a little trickier cause you have to set up a coroutine or something if you don’t want to stall the main loop. depending on what you want to do it might make sense to add another “driver” on the C side for whatever your device protocol is.

which leads to the other complication: on norns we currently attempt to open all tty devices with libmonome. so that’s not ideal.

1 Like

is the kernel image link broken?

bear:tmp kodiak$ wget https://monome.nyc3.digitaloceanspaces.com/kernel-4.9.59-rt52-0.0.4.tar.gz
--2018-06-07 13:51:46--  https://monome.nyc3.digitaloceanspaces.com/kernel-4.9.59-rt52-0.0.4.tar.gz
Resolving monome.nyc3.digitaloceanspaces.com... 162.243.189.2
Connecting to monome.nyc3.digitaloceanspaces.com|162.243.189.2|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2018-06-07 13:51:47 ERROR 403: Forbidden.

I can get kernel-4.9.59-rt52-0.0.3.tar.gz, just not 0.0.4, and would prefer the latest version

if possible could someone post the config.txt, thats what im really interested in :slight_smile:

that’s an old kernel. i’ll get the newest one posted.

or you can build the newest: https://github.com/monome/linux

also FYI we no longer use RT. so a vanilla raspbian-lite should do ok (we mostly made optimizations for boot speed)

1 Like

in the current kernel we also have preemption enabled and hopefully 1000hz timers will follow too.

2 Likes

can i confirm, your not getting xruns on any of the current apps shipped?
im seeing a few on earthsea on a straight pi, so thats what i was looking to optimise.
(with a similar jack configuration)

EDIT:
ok, for now Im building a kernel with preemption, performance governor (default) , 1000hz timer on 4.14 kernel
will see how that goes, once its built…
thanks for the info.

so at the moment we’re not explicitly supporting (say) executing arbitrary sclang code on norns.
norns Engines are sclang classes, and editing one means recompiling sclang class lib.

why we did it this way is, i dunno, a little subtle and a little arbitrary.

  • one simple reason is performance. sclang classes are compiled into bytecode and if you are doing a lot of computations in sclang, this is significantly more efficient.

  • another is that it just seems (to me) that using classes is good practice, will help enforce some consistency, and makes for tidier code and more/easier code reuse.

anyways, after saying all that, and without debating the merits of classes vs global environment - the structure of an Engine is quite open:

an engine defines “commands,” which are OSC messages that it can receive , and “polls” which are (currently) single values that it can transmit (either sporadically or periodically.) polls and commands are automatically exposed in lua scripts - the former as functions in the engine table, the latter as Poll objects.

“commands” can be OSC messages in any format (well, excluding binary blobs.) so at one extreme, an engine could accept arbitrary strings and attempt to evaluate them as sclang expressions (play them as sctweet-like JIT synthdefs, for example.)

less extremely, there are of course many approaches to making a structured but flexible modular environment in a sclang class. @jah’s ack engine is one approach. (i think a very good one worth extending.)

7 Likes

26 posts were merged into an existing topic: Norns: help

[moved this from the “help” thread since it seems relevant. sorry for fumbles with mod tools]

earlier you said why don’t i do that in SC

what i meant was to respond to the line of questioning like, (and i’m paraphrasing / interpolating) “i have X years of experience in SC, i have all these patches i wanna port, whats the easiest way?”

well. you make a subclass of CroneEngine, this can execute any sclang code you want. [*]

your (non-interactive) lua script could be as simple as
(myscript.lua)

engine.name = 'MyEngine'

that’s it. running the script from the norns menu will run .free on any running engine and .alloc on a new Engine_MyEngine. i’m mentioning this in response to the (again mostly hypothetical) query like: “hey, i don’t want to do all my sequencing, control mapping, tuning, &c, basically musical logic, in lua. sounds like a pain.” and you don’t technically have to. but at minumum you probably want to have some things in Engine_MyEngine.alloc like

(in Engine_MyEngine.sc)

this.addCommand("foo", "f", { 
  arg val = msg[1]; // get the single float argument
  // ... set a control bus, set a variable, do whatever you want
});

so that you can e.g. control it from the norns hardware UI

function init () state = 0 end -- initialize a state variable

-- map encoder to change state variable and send it to the engine
enc = function(n, d) 
  if n == 1 then 
    state = state + d
    engine.foo(state)
  end
end

and of course we kind of think that the more control you can hand over to lua, the better. makes it easier for other nornians to adapt.

but yea - go ahead, make an engine that collects a bunch of sctweets and turns them on and off. maybe with some extra control parameters. sounds great

[*] the exception, on norns hardware, is graphics / GUI

6 Likes

i think i follow you but what does this mean

i want to have encoders do math and stuff is that a no-no?
or am i missing something?
I want to play around a bit and learn the lua stuff and simple random jukeboxers are usually a way to learn file handling reading from a folder parsing strings and what not i hope that i am not too off base

sorry about the context switching. your original question was “is all of sclang available.” to which my response is “yes, and sc3-plugins,” with the (probably obvious) qualification that you can’t use SC graphics or UI classes. those rely on graphics frameworks (Qt, etc) that don’t exist on the norns system.

we don’t have a way to draw to the norns screen directly from SC. (we could add it, but it would break the norns menu. we’d want to add additional glue for lua to hand-off screen control to the engine, and take it back in menu mode. maybe this is a good idea, maybe not, i’m open to opinions but again, tend to think we should try to use the lua side for UI and compositional logic, even if we’re really used to sclang.)

we also don’t have a way to read encoder and key movements directly in SC. here i’d really like to draw a hard line, and keep enc/key handlers hardcoded through matron, so the norns menu can make appropriate use of them (saving and restoring callbacks.) if you want to just directly send encoder deltas and key states to an SC engine, you can do so:

(Engine_MyEngine.sc)

Engine_MyEngine : CroneEngine { 
  alloc {
    this.addCommand(\enc, "ii", { 
      var which = msg[1];
      var delta = msg[2];
      do_something_with_encoder_movement(which, delta);  
   }
}

(msyscript.lua)

engine.name = 'MyEngine'

enc = function(n, d) engine.enc(n, d) end

in the lua script, enc is a special global variable, and the menu system will save and restore callbacks defined this way when toggling in and out of menu mode.

(and similar for keys)

so: “having encoders do math and stuff” - of course, its necessary to perform computations in response to encoder movements. we’ve built out some methods for mapping controls in lua that closely parallel ControlSpec and related sclang classes, and can be easily plumbed into the “parameter” and “parameter set” abstractions in lua.

we’ll will continue to build this out as well, and i imagine some useful abstractions could be broken out like long-presses and momentary mode toggles.

i tend to think this is the best place to do all your musical parameter logic, and engines should accept “raw” values like frequency.

but other options are available and not a big deal.

re: jukeboxers, files:
i tried to show a simple example of loading a file this with my silly sample-flapper script. for a more sophisticated approach see mlr or playfair scripts - the former uses the SoftCut engine and the latter uses the Ack engine. they tie a little deeper into some path-handling abstractions and also store sample paths as script parameters.

in both cases, lua side doesn’t actually load sound files, it just sends paths to the engines. (the engines have load commands accepting sound file paths.) matron does link libsndfile just so you can query soundfile durations from lua.

3 Likes

right
that’s what i was thinking
and again so much of this Ezra if we had a 5 minute conversation i coudl stop bothering you but thanks for being so patient with the ka-zillion questions, sincerely.

That’s why i thought maybe a coffee/code/chat could be cool so we could share some ideas and walk away with a more firm direction of what can and cannot be done and what might be a goose chase or a rabbit hole — i am sure you know what i mean

TY

yes totally
if we’re gonna do a discourse tomorrow/sun maybe that will be a good opportunity
lmk so i can plan my days a bit

I bet ya’ll get together to talk about Norns development and a really cool DnD game breaks out.

3 Likes

Wizard is about to die…