ndi-mod: share the norns screen over a network

ndi-mod

a norns mod to share the screen in near-real-time via the NDI streaming video protocol.


(acrostic in OBS)


(takt in OBS with Color Correction/Color Add)

image
(awake on iOS NDI Monitor)

image
(nydl in OBS with Color Correction/Color Add)

why?

Show us your screens! There are lots of ways to do it, from downward-facing cameras to mirrors to VNC to norns.online. This strategy offers a different set of ease-of-use/efficiency/integration tradeoffs that might be interesting to folks projecting, livestreaming, or recording a norns-based performance alongside other video sources.

Earlier related discussions:

why ndi / why not ndi?

NDI is fast, and includes zeroconf-based discovery of stream sources. Many popular streaming and video art tools support discovering and receiving NDI streams, including OBS Studio*, Resolume, Max/MSP/Jitter*, and Touch Designer.

(* requires a plugin)

In NDI’s standard latency mode, a 30fps stream over a local wi-fi network is about a frame behind the norns screen. So far, in informal testing with a Pi CM3+ factory norns, using this mod appears to increase the CPU load by just 1-2%. When using clients like OBS that support NDI’s optional low-latency mode, the network update can be practically simultaneous with the norns screen update.

One disadvantage of NDI is that it’s not a completely open, unencumbered standard (but it is at least royalty-free.)

Alternatives to NDI include RTMP, HLS, or SRT; those may be better for certain purposes and the general structure of this mod could be adapted to other protocols.

requirements

  • norns 220321
  • wi-fi
  • one or more devices to receive the NDI stream

installing and activating

  1. From the maiden console, enter:
    ;install https://github.com/Dewb/ndi-mod/releases/download/latest/ndi-mod.zip
    
  2. In the norns menu, navigate to to SYSTEM > MODS, scroll to NDI-MOD, and turn enc 3
    clockwise to add a + next to the mod name. Hit button 2 to back out, and select
    SYSTEM > RESTART to relaunch with the mod loaded.

This will add about 3MB of files to ~/dust/code/ndi-mod. To uninstall everything, disable the mod by reversing the above process, then SYSTEM > RESTART again. Then, go to the maiden library, scroll to ndi-mod in the installed section, and click remove.

documentation

how does this work?

At startup the mod hooks screen.update() and hands the buffer from the Cairo surface to the NDI library, which will encode it and broadcast it from a separate thread. Heavily indebted to @ngwese’s norns-event-demo sample app for illustrating how to incorporate C code into a Lua mod.

Thanks very much to @infinitedigits, @radioedit, and @fourhoarder for beta testing. And of course shout out to @infinitedigits for advancing the screen sharing story with the very cool norns.online.

warnings/caveats

  • This came together pretty quickly, it’s been tested thoroughly on a couple different systems but there still may be gremlins.
  • This mod may conflict with other mods that hook screen.update().
  • Scripts that use offscreen cairo surfaces may produce unexpected results. As of version 0.2, this mod behaves with scripts that create offscreen images. You can even share offscreen images as secondary NDI streams!
  • Known issues/future thoughts on GitHub.
66 Likes

NDI? This is insane haha. So cool! Never imagined this would be possible.

4 Likes

I’d be super interested in being able to set this up and run it headless and I know a few others will be too. maybe we just need to run NDI manually from SSH the first time?

2 Likes

Yep, without access to a screen you’d need to ssh in once and modify ~/dust/data/system.mods to enable the mod, but in theory that should work.

EDIT 6/21: this is now compatible with scripts that use offscreen image drawing, thanks to some feedback from @ngwese. You can also share offscreen images as additional NDI streams of arbitrary size:

3 Likes

So cool. VJs and AV performers rejoice!

7 Likes

This is amazing! Norns display feedback loops!!!

6 Likes

So cool. Thanks :metal:t3:

12 Likes

NDI into OBS then use Virtual Camera as a source in Hydra :cold_face:

11 Likes

Thank you so much for this - works great.

I have just installed ndi2jack on my rpi - it includes jack-to-ndi. (I changed the ndi2jack and jack2ndi services to run as “we” user, and start after “norns-jack.service”)

and patch from the commandline:

Edit: changes below, got crone working by using a 2 input channel USB interface, instead of one with only 1 input.


jack_connect crone:output_1 NDI_send:input0
jack_connect crone:output_2 NDI_send:input1

jack_lsp -c
system:capture_1
   crone:input_1
system:capture_2
   crone:input_2
system:playback_1
   crone:output_1
system:playback_2
   crone:output_2
crone:input_1
   system:capture_1
crone:input_2
   system:capture_2
crone:input_3
   softcut:output_1
crone:input_4
   softcut:output_2
crone:input_5
crone:input_6
crone:output_1
   system:playback_1
   NDI_send:input0
crone:output_2
   system:playback_2
   NDI_send:input1
crone:output_3
   softcut:input_1
crone:output_4
   softcut:input_2
crone:output_5
   SuperCollider:in_1
crone:output_6
   SuperCollider:in_2
softcut:input_1
   crone:output_3
   SuperCollider:out_1
softcut:input_2
   crone:output_4
   SuperCollider:out_2
softcut:output_1
   crone:input_3
softcut:output_2
   crone:input_4
SuperCollider:in_1
   crone:output_5
SuperCollider:in_2
   crone:output_6
SuperCollider:out_1
   softcut:input_1
SuperCollider:out_2
   softcut:input_2
NDI_send:input0
   crone:output_1
NDI_send:input1
   crone:output_2

So now I have audio too (other than the connected usb device), streaming over NDI to an extra NDI monitor listening to the “Stream”.

image

Just have to figure out how to make the jack connections from a norns script. novice to norns for sure.

A fix to the os.execute memory allocation error in Maiden-REPL
Fixing Maiden-REPL:"(cannot allocate memory)" · Issue #1596 · monome/norns · GitHub

6 Likes

Pardon the deviation from strict on-topicness! Can anyone identify the script that appears in the second image (with the cyan/magenta colors called “image.jpg”) of the original post? Many thanks!

i’m pretty sure it’s the elektron style sequencer takt

That’s correct! A while back I added captions crediting the scripts/authors to GitHub but neglected to update here as well, I’ll fix that.

1 Like

20 characters of thanks!

1 Like