Norns: full sc development method in maiden

Created on 7 Jul 2018  路  10Comments  路  Source: monome/norns

@catfact posted the following on lines. I don't see an open issue here. Feel free to close this if I missed a duplicate:

-put new engines in dust/lib/sc.
-use a text editor, not maiden.
-restart the norns when you make changes (we鈥檙e working on better tooling for this, slowly)

Right now, the SC development process is slow and fragile. It requires the use of a separate editor along with frequent restarts when testing out ideas.

Additionally, many users who are pulling dust changes early are experiencing "error: AUDIO ENGINE" due to instances of bad copies and duplicate files with the same engine name.

Most helpful comment

you can recompile the SC class library from there or from lua.
how does this work?

in SC: thisProcess.recompile. the Crone class has startup methods that perform the correct server configuration, handshake with matron, other things.

audio_restart() does the same thing.

test on a proper norns, to verify this is working

it works for me.

I found if I did s.reboot, matron did not reconnect properly (should this work?)

no, it will skip the handshake and will not work.

All 10 comments

sc development has been a secondary focus and we'll get to it.

right now my suggested method is to ssh into the machine with a few terminals. use vim/emacs/whatever to edit your .sc files and then use the scripts to reboot the software. i'd suggest manually running crone.sh (for text output) and matron.sh.

FYI, the sclang REPL in maiden does work, and you can recompile the SC class library from there or from lua.

the only thing missing is editor support for the SC files themselves.

you can recompile the SC class library from there or from lua.

how does this work?

I found if I did s.reboot, matron did not reconnect properly (should this work?)

if i did restart_audio() , this caused my (push2) display to not work correctly.
(this could be a bug of mine, but perhaps someone can test on a proper norns, to verify this is working)


so i ended up restarting matron in each occasion above....

this led me to wonder, perhaps a 'shell console' / REPL might be useful for maiden.
(could be useful for all sorts of quick tasks...)

also perhaps maiden, could have a SC/matron status, and reboot option, a bit like scide has for the scsynth (in the toolbar). this might help users who are not confident with command line, if norns appears to 'get stuck', they could attempt a quick sc/matron reboot - rather than a hardware shutdown.

(similarly like scide, it could be extended to have a status info like cpu load)

you can recompile the SC class library from there or from lua.
how does this work?

in SC: thisProcess.recompile. the Crone class has startup methods that perform the correct server configuration, handshake with matron, other things.

audio_restart() does the same thing.

test on a proper norns, to verify this is working

it works for me.

I found if I did s.reboot, matron did not reconnect properly (should this work?)

no, it will skip the handshake and will not work.

test on a proper norns, to verify this is working
it works for me.

ok, so did a bit more testing...

and i can say it does work 'sometimes' for me too ;)

but sometimes cairo will throw an assertion.

matron: ../../../../src/cairo-pattern.c:1125: cairo_pattern_destroy: Assertion `CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&pattern->ref_count)' failed.

(note/hint : its not always the same cairo assertion )

Ive not traced the exact error, but I think its an issue cause by two things updating the screen (in different threads)
(my assumption is cairo is not thread safe, hence you get into an invalid state)

what i think happens is:

not only is restart_audio() asking crone to recompile, but it also is going thru the startup procedure and so doing hello_start.

the issue is:
while hello is doing the animation, the current lua script is actually still running,
so if the script does screen updates, you are getting updates being done by hello (in a separate thread, rather than the event thread) , whilst the script is also updating the screen in the event thread.

(it wont always crash, as it depends on 'unlucky' timing, but depending on how much updating the scripts doing, will depend on the likelihood)

I think the solution is, that restart_audio should be stopping any active script, and then restart it after 'hello' is completed...

it might as well do this, as the audio/metros dont appear to be running after restart_audio anyway - even when it doesn't crash, you still have to restart the script yourself.

ok good point - yes, restart_audio() also runs the startup animation and waits for handshake from crone. yes, its a mistake to do this with a script running; use script.clear() to stop first.

restart_audio() is a C function, not the place to do script lifecycle management. audio.restart() is lua module wrapper where more lua stuff could go.

the use case isn't totally clear to me. a full soft-restart of the system should perhaps also reset the LVM state or maybe just relaunch the matron process. audio_restart() is mostly for convenience while working on engines. it might not be really necessary.

also, it might be an idea to run the hello animation/sync thru the event loop, rather than in a separate thread -that way we know also know all screen access is thru the event loop/thread.

ok, this is getting way off topic. new issue to address cairo's thread safety.
https://github.com/monome/norns/issues/466

i believe install.sh in ~/norns/sc also needs to be invoked to after new .sc files containing engine classes are added.

this is now possible with ;restart within maiden

Was this page helpful?
0 / 5 - 0 ratings

Related issues

catfact picture catfact  路  13Comments

okyeron picture okyeron  路  10Comments

synthetiv picture synthetiv  路  6Comments

pq picture pq  路  7Comments

catfact picture catfact  路  7Comments