Ah, glad to hear you’ve got it working with a Block - that was one of the devices that prompted my question. My usage of it is particularly weird though, as I’m (a) sending custom-ish MIDI data from the block, packed into CC messages and unpacked in sclang, and (b) sclang is sending output amplitude back to the block at ~30hz for display.

Ok wow - that’s super weird. :grimacing:

FWIW - the Block just shows up as a regular midi device without any configuration

amidi -l
Dir Device    Name 
IO  hw:1,0,0  block MIDI 1
IO  hw:1,0,1  block MIDI 2

Regarding the use of supernova instead of scsynth, in case someone has some experiences with it/wants to try it out please let us know here https://github.com/monome/norns/issues/435

building (with some caveats) and basic running seems to work fine, now to try if running it with real code works :slight_smile:

4 Likes

can I ask a basic question…

if you want tight synchronisation, is lua/matron the best place?
the audio clock is in sc, which your communicating with via OSC, and you also have a poll loop, which can block (depend on user activity)

so whilst from a user point of view I see lua being easy to interface too,
Id be concerned mid-term, if you follow that route, that complaints of timing issues could become rife as the platform develops.

audio clock is not really useful on the scripting level. more useful clock should be able to sync to one of several sources (midi, internal metronome, ableton link, etc.) and provide facilities to trigger callbacks at intervals specified with relative mul/div ratios (relative to the sync source ofc). this should be done on the c/matron level i think.

1 Like

ok, some of this is better in the dev topic ( e.g. when audio clock becomes associated with midi timestamp)

but I do think we are being simplistic here…

users will want sample accurate timing , e.g imagine triggering a kick, you cant have the transient a few samples ‘here or there’

so my point was simple, where is the master clock?
the poll loop, if its potentially delayed by user scripts, is not an accurate time as it can be delayed… similarly OSC from SC is not deterministic, it can be delayed.

so sure, you say the audio clock is not ‘useful’, so what is your master clock?

to create divs/mults from a stable clock is easy, doing it from something that fluctuates potentially compounds the error…

also midi clock is interesting, you are running midi devices, which might be a clock master, in a separate thread, which report to the event loop, with no timing …. how is that deterministic?

if you want sample accurate kickcdrums in SC, there are two options:

  1. schedule them in SC

  2. send timestamped OSC from lua. (with latency.)

as you are surely aware from using PD extensively, sample accurate timing is simply not necessary for many musical applications. even 1ms is often fine. the norns event loop is far more accurate than the message loop in PD/max, and probably at least as accurate as the sample clock.

you’re right, callbacks in the user script can block the event loop. i don’t see a simple solution to this given that lua is single-threaded. i have some specific suggestions about how to improve the event queue, but they are not simple (e.g. there shouldn’t be any locks or memory allocations:) https://github.com/monome/norns/issues/144. i would certainly welcome more specific suggestions or any contributions towards implementing improvements.

but from what i’ve seen so far, implementing things like multi-threaded lua, and/or a lockfree and allocation-free event queue, are perfect examples of premature optimization: complex and error-prone engineering tasks that set out to solve a problem that is currently totally hypothetical. so the real first step would be showing me some quantified results of system usage where stalls in the event queue have perceivable timing effects in a real application.

user scripts simply shouldn’t do heavy processing on callbacks in “realtime.” if common sense is applied, then e.g. firing events in lua from midi clock, through the event loop, is totally fine - execution time for each callback should be under a microsecond or something. (the UDP layer is a far more serious source of timing indeterminacy than the event loop, which is why we should consider timestamping everything, or having a runtime option for “timestamped” versus “immediate” on a given engine command - this has been discussed on GH and you can see some stuff in the code too. it is the old “jitter v latency” tradeoff for which there is no actual right answer.)

i think what @artfwo means is that it doesn’t seem reasonable to try to build a system out of executing lua code (with a shared, singlethreaded VM) in response to events on the audio clock. as you have also pointed out.

rant

i think you are casting this as a simple question when it isn’t. musical time in computers doesn’t have a single standard of perfection. its not sample accuracy - you can’t “really” play 127bpm music at a sample rate of 48khz. we did not set about to make a perfect system from whole cloth. we made a scripting layer on supercollider that has some UI glue.

it is also convenient for many applications to use the scripting layer for timing and sequencing logic, and i can make strong claims that it’s also entirely functional and pragmatic. we added a timing and events system that is definitely not perfect but has the enormous benefit of being easy to understand.

going deeper for specialized purposes (like subsample timing on an audio output - which SC supports) should be handled on the SC or ugen development level.

none of this means we should not have simple mechanisms for selecting “control-rate” clock sources in norns scripts.

TL / DR:

if “tight” means “computed on the audio thread using the sample clock” - obviously not. you want to do everything with UGens in that case. compose an engine that will suit your needs and accept appropriate commands. maybe wrap SuperDirt if it meets your criteria.

[mod: moved to development]

8 Likes

Executing engine commands in clock callbacks is not going to cause serious timing issues or block the event loop for too long. I’ve been doing that with pymonome for quite a while.

Even with kick drums it’s gonna be mostly okay as long as they’re synced to the same clock as other pieces in the composition.

Fluctuating sync sources are okay as well, the clock has to readjust div/mul timers constantly.

I imagine that clocking will be an issue in the coming age of Crow, when triggers/gates originating from norns make their way into a modular setting, and vice versa.

sorry for the zombie bump, i am just getting caught up. if this is still an issue - waf doesn’t affect lua scripts at all. everything in lua is loaded at runtime. waf builds c/c++ stuff like matron and ugens.

i only meant that: it is quite easy, by editing stuff in norns/lua/, to put the norns unit in an “unbootable” state where, for example, the menu doesn’t work. this is basically why it’s in a separate git repo. this is no big deal as long as you can connect with screen or ssh, and restart everything. by starting matron explicitly on the command line you can see lua errors - this is the case even if things are too broken for maiden to work.

3 Likes

I was finally bitten by the globals last night. I was working on a script and I created an array called metro. Hoo boy, norns did not like that. The error text was not useful so it took a bit of hunting to figure out what happened. I had to replace the offending variable, resave the script, and then reboot norns to fix it.

One quick solution for the globals issue would be to add the globals to matron’s syntax highlighting. They could be a bright red to quickly show that they are not available variable names.

3 Likes

solution is nearly complete: switching scheme to reset the LVM on new script loads which will make everything much more predictable: https://github.com/monome/norns/issues/425


we’re finding that this thread is actually counter-productive as we’re having to be very redundant with discussions on github (via issues) and there’s a bit of data-loss as a forum thread is a poor model for making software.

i’m going to close this thread and would like to forward all conversation regarding core development over to github: https://github.com/monome/norns/issues

please do not hesitate to create new issues and comment on the list we’re trying to tackle.

9 Likes

returned from travel. following up with the community developer discussion—

let’s use the development category alongside git issues for norns development issues/proposals/projects

posting to this mega-thread is fine, but i’d generally encourage starting new topics for best topic track-ability.

thank you all for hanging in there while we figure out best practices.

8 Likes

Prototyping a multi-effects UI!

60 Likes

:raised_hands:t4::raised_hands:t4::raised_hands:t4::raised_hands:t4::raised_hands:t4::raised_hands:t4::raised_hands:t4::raised_hands:t4::raised_hands:t4::raised_hands:t4::raised_hands:t4::raised_hands:t4::raised_hands:t4::raised_hands:t4::raised_hands:t4::raised_hands:t4::raised_hands:t4::raised_hands:t4::raised_hands:t4::raised_hands:t4::raised_hands:t4:

3 Likes

I’ve been thinking about making a pedal board script! Great minds I guess :slight_smile:

4 Likes

What is this?

  • I’m working on Arc support for norns and made a clock script to test it. (I copied the idea from the clARCk maxpat)
  • what you see is my DIY arc-clone/encoder box which uses a small OLED for LED info instead of led rings

Anyone out there wanna test some bleeding edge norns software with arc support? :laughing:

10 Likes

yes. obvs :smiley: please pm me! <3

2 Likes