Norns CC MIDI-out / feedback

Sorry, if this is a stupid question, but I tried to find an answer in the docs and the forum but without any success.

Is there a way to make norns send out CCs, when i change a parameter in Norns?

Example:

  • I have a Faderfox EC4 connected to my shields.
  • Mapped some parameters. Everything works as expected.
  • But when I change the parameter on the Shields directly the messages are not sent to my Faderfox.
  • Same goes for loading presets. The different parameter values are not reflected on my faderfox controller.

Is this even possible? Do i need to script this myself in lua?
any pointers are much appreciated.

1 Like

I had a similar thought the other day about having feedback in OSC.

1 Like

hey hey! hope all’s well!

currently, yes to both. i’ve captured this feature request which includes MIDI callback (added OSC, great idea @eigen), but for a right-now solution it’d need to be scripted.

depending on your comfort-level with scripting, this could be made into a library like Passthrough, or it could just be something you add to your favorite controls in your favorite scripts.

if you're comfortable with scripting...

i think a good starting point would be:

  • addressing your faderfox via its norns-assigned device port (see DEVICES > MIDI menu) in the script:
my_faderfox = midi.connect(x) -- replace x with the port number
  • finding the parameter you want to address, eg from awake:
  cs_PW = controlspec.new(0,100,'lin',0,50,'%')
  params:add{type="control",id="pw",controlspec=cs_PW,
    action=function(x) engine.pw(x/100) end}
  • inside of the parameter’s action, scaling the parameter value to fit between 0 and 127 to send back to your faderfox, using util.linlin(), eg:
local scaled_value = util.linlin(0,100,0,127,params:get("pw"))
  • and then sending this scaled value out to your faderfox via the built-in midi helpers, after working out what cc_number you want to address and on which midi_channel:
my_faderfox:cc(cc_number, scaled_value, midi_channel)

so, in total, that pw parameter would look like (using 14 for the cc number and 3 for channel as an example):

  cs_PW = controlspec.new(0,100,'lin',0,50,'%')
  params:add{type="control",id="pw",controlspec=cs_PW,
    action=function(x)
      engine.pw(x/100)
      local scaled_val = util.linlin(0,100,0,127,x) -- we replaced params:get("pw") because we're inside the function
      my_faderfox:cc(14,scaled_val,3)
    end}

otherwise, it’ll likely find its way into a software update! i have a midi fighter twister that also has this “callback” functionality to redraw LEDs, so if nobody else feels passionate about it, i can try taking it on :slight_smile:

4 Likes

Cool. Thanks for your answer and for logging the feature request.

I’ll give it a whirl and see, if I can make it work for the scripts, I have in mind. Pretty sure, I’m not savy enough to whip up a general interim solution.

I think I hit a roadblock here and I’m pretty sure the solution is super easy, but I can’t get my head around it. using your outlined method gives me only two callback numbers in return. 0 for the lowest input of (x) and 127 for the highest input of (x). Coming from Max, I’d say this is a problem with mixing floats and integers, but i’m clueless. Any pointers?

ah yeah, probably! none of that was tested on hardware, apologies. 0 and 127 would be the only pure integer values output – fwiw Lua doesn’t have an integer type, but your external hardware likely cares :slight_smile:

try wrapping util.linlin(0,100,0,127,x) in a util.round, to clamp output to whole number values:

local scaled_val = util.round(util.linlin(0,100,0,127,x))

here’s a simple test i just ran to verify the output data:

function init()
  cs_PW = controlspec.new(0,100,'lin',0,50,'%')
  params:add{type="control",id="pw",controlspec=cs_PW,
    action=function(x)
      local scaled_val = util.round(util.linlin(0,100,0,127,x)) -- we replaced params:get("pw") because we're inside the function
      print(x/100,scaled_val)
    end}
end

which returned these value pairs when i cranked the parameter (left is parameter value, right is the integer value):

0.51	65
0.52	66
0.53	67
0.54	69
0.55	70
0.56	71
0.57	72
0.58    74
0.59	75
0.6	    76
0.61	77
0.62	79
0.63	80
0.64	81
0.65	83
0.64	81
0.62	79
0.61	77
0.59	75
0.58	74
0.57	72
0.56	71
0.55	70
0.54	69
0.53	67
3 Likes

Oh yeah. That did the trick. Many thanks.

1 Like

rad! please do share where you end up, as i’m sure other folks would love to learn this sort of script hackin’! :slight_smile:

1 Like

Will do. It will be just a simple hack for the blippoo script, but if someone gets some use out of it, I’m happy to share this

2 Likes

Here’s the updated blippoo lua script for use with my faderfox with midi call back.
of course you need to use your own CC numbers and stuff, but hopefully this helps someone understand how midi callback works at the moment. just copy the lua file into your blippoo folder in dust/code

Thanks again @dan_derks

blippoo_midi_out.lua (8.4 KB)

9 Likes