norns: midi input from ext device...how many channels allowed at once?

i may have missed this in another thread but the norns docs don’t seem to discuss the answer, so…

  1. can norns recieve midi note input from multiple channels simultaneously? multiple devices?
  2. is configuration for the routing handled at system level or on a per-script basis?

i think i know #2 but want to confirm

#1 might seem obvious but all i’ve managed to find about norns midi relates to midi cc input and controlling ext gear by norns midi output

2 Likes

I’ve had a total blast with orgn controlled by a usb-connected midi keyboard, cc in ableton, a usb-connected midi controller for mapping and a connected grid. Midi notes comes only from the keyboard, but all 3 devices work at once. Does that prove yes to a)?

Edit; actually, my midi devices are all on channel 1, so maybe not…

2 Likes

Mapping physical devices to “virtual ports” 1-16 is handled at the system level, in the DEVICES > MIDI menu. Everything else is handled by the script. Scripts can send & receive on all 16 channels of all 16 devices separately, if they choose to.

(edit because there aren’t just 4 vports! have I just never scrolled down far enough…?? no, that changed last winter. OK.)

2 Likes

it is possible to use as many simultaneous devices as are supported by physical ports/hubs and by available current.

each script that responds to midi must explicitly assign a handler to each device port in order to respond to messages from that device - there’s no API call that says, “handle all CC messages from any device,” or that directly supports pattern-matching on CC number / channel / device / etc, the way that e.g. supercollider does. (such functionality could be built on top of the provided API.)

by default there is no filtering on channel number; when a script registers a midi device handler, the handler receives all messages on all channels - the message data includes the channel number - and must perform any desired filtering.

when MIDI-mapping parameters from the system menu, all devices and all channels should be available for mapping. mappings include device (vport) and channel number.

4 Likes

so many great answers!

to round out, here’s a little code snippet which should report any incoming message on any connected MIDI device (up to 16 devices) on any channel:

function init()
  midi_device = {} -- container for connected midi devices

  for i = 1,#midi.vports do -- query all ports
    midi_device[i] = midi.connect(i) -- connect each device
    midi_device[i].event = function(raw_data) -- parse incoming data
      local d = midi.to_msg(raw_data) -- a lil' helper built into norns
      print("device: "..midi_device[i].name, "type: "..d.type, "ch: "..d.ch)
    end  
  end
  
end

for more about filtering incoming MIDI messages, see long live (parts of) the 80’s.

6 Likes

thanks for all the responses!
i guess i wasn’t reading carefully enough cause i had seen the 16 device max & just wasn’t sure whether that applied to parsing channel/note data (and whether norns handles the input at the same time)

2 Likes

I realise the System > Devices parameter menu only allows the selection of one MIDI device, but is it possible for a script to access multiple MIDI devices connected to Norns at the same time? For example, a USB MIDI interface and a MIDI controller connected to another USB port.

1 Like

Yes, it happens at the script level rather than System. Cyrene is an example script, you can send different tracks to different devices.

1 Like

That’s great, thanks! I will look at Cyrene when I come to that project, in that case.

Supplementary question: is it possible to remove MIDI device selection from System > Devices, or to have a param set somewhere else change this value?

It would be nice to be able to select all MIDI devices in the same place, rather that having to select one from this menu, and one (or more) additional devices via some other mechanism.