midi support questions

Hi there,

i am trying to use midi with Darktable and OpenStageControl on MacOS (Nul n’est parfait)

the idea is to create an interface as you probably guessed :slight_smile:

Can you please confirm :

  • the MIDI channel value can not be a value I can trust on : sending an c5 on channel 1 or on channel 2 is considered the same in Darktable ? the same shortcut
  • could you give me the correct syntax in Miscellaneous to use to specify which port I want to use ?
  • do I need to create a virtual port on macOS to see it listed ? how can I achieve this ?
nlb:darktable.app/ $ Contents/MacOS/darktable -d input                                     [21:54:03]
darktable 5.2.1
Copyright (C) 2012-2025 Johannes Hanika and other contributors.

Compile options:
  Bit depth              -> 64 bit
  Exiv2                  -> 0.28.5
  Lensfun                -> 0.3.4
  Debug                  -> DISABLED
  SSE2 optimizations     -> DISABLED
  OpenMP                 -> ENABLED
  OpenCL                 -> ENABLED
  Lua                    -> ENABLED  - API version 9.5.0
  Colord                 -> DISABLED
  gPhoto2                -> ENABLED
  OSMGpsMap              -> ENABLED  - map view is available
  GMIC                   -> ENABLED  - Compressed LUTs are supported
  GraphicsMagick         -> DISABLED
  ImageMagick            -> ENABLED
  libavif                -> ENABLED
  libheif                -> ENABLED
  libjxl                 -> ENABLED
  LibRaw                 -> ENABLED  - Version 0.22.0-Devel202502
  OpenJPEG               -> ENABLED
  OpenEXR                -> ENABLED
  WebP                   -> ENABLED

See https://www.darktable.org/resources/ for detailed documentation.
See https://github.com/darktable-org/darktable/issues/new/choose to report bugs.

     0.0010 [dt starting]
 Contents/MacOS/darktable -d input

(darktable:8526): Gtk-CRITICAL **: 21:54:29.935: gtk_window_add_accel_group: assertion 'GTK_IS_WINDOW (window)' failed
     0.4402 [input device] Input devices found:

     1.4707 [_midi_open_devices] PortMidi initialized
     1.4707 [_midi_open_devices] found midi device 'APC Key 25' via 'CoreMIDI'
     1.4707 [_midi_open_devices] opened midi device 'APC Key 25' via 'CoreMIDI' as midi0
     1.4708 [_midi_open_devices] found midi device 'APC Key 25' via 'CoreMIDI'
     1.6440 [_gamepad_open_devices] SDL initialized

Cheers

Greeman

The only use dt makes of the channel on incoming messages is that it sends back updates on the same channel. No support for multiple channels for the same port.

You’d specify part of the name (enough to make it unique) used by the portmidi library to identify the port. You disable a port by putting - in front of the name. All remaining by just putting -. By default, all ports are opened and listened to. If portmidi sees them. No idea what that requires on Mac.

thanks for your answer about the midi channel.
for the part concerning disable i think you made a typo :slight_smile: no ?

The doc says :

Darktable uses the simple cross-platform layer PortMidi to access the underlying OS API (Alsa, Core Midi, WinMM). If you are self-compiling, make sure you have included this library.

Starting darktable with the debug parameters -d input will give additional information. It should try to open up to 10 MIDI devices in the order it finds them. On the command line you might see something like this:

[midi_open_devices] opened midi device 'Arturia BeatStep' via 'MMSystem' as midi0
[midi_open_devices] opened midi device 'BCR2000' via 'MMSystem' as midi1
[midi_open_devices] opened midi device 'X-TOUCH MINI' via 'MMSystem' as midi2

Two issues can arise:

  • a device you don’t want to use might be opened anyway (and potentially cause inappropriate behavior, like starting a fireworks show prematurely – see this document); or
  • devices might appear in a different order at the next startup (for example because they are plugged into a different usb port). Since configurations are stored with the device number only, reordering would cause an incorrect layout to be picked up.

You can fix which devices to load in a specific location and which ones to skip using the configuration parameter preferences > miscellaneous > interface > order or exclude midi devices. To skip loading the BCR2000 in the above example and to fix the other two devices into the number 0 and 2 slots, you could set this config parameter to “BeatStep;dontuse;X-TOUCH;-BCR2000”. This would leave the BeatStep as device midi0, always leave midi1 unused and would not load the BCR2000 at all, but if any other devices are connected, they would appear as midi3, midi4 and so on. Adding “;-” at the end would prevent any further devices loading.

If you just specify the configuration parameter as a single minus sign “-”, no devices will be loaded at all.

now on windows11 i have to find how to launch darktable in debug mode.

I am keeping exploring see you soon !

Hi, how to disable MIDI in darktable?

I think you’d have to build from source to completely turn it off.

Oh, thats bad. On my windows laptop MIDI usage is exclusive, so when running DT, I’m not able to use an audio app in parallel.

have a look at darktable user manual - midi device support

If you just specify the configuration parameter as a single minus sign “- ”, no devices will be loaded at all.

2 Likes

I think we should make midi, tethering, Lua to be opt in options in the preference setting like we do with opencl.

That would make the preferences dialog even more complex. And the code for those subsystems would still be included, so you don’t gain all that much.

The difference with OpenCL is that the latter can cause problems for certain configurations. So far, that is not shown for tethering and lua (if they are not used). And for MIDI, the existing options might be enough.

If you really want to get rid of any of those subsystems, you can do that if you can compile darktable yourself (If I’m not mistaken, through DefineOptions.cmake).And if you go that way, there may be a few more you could disable…

you mean something like this:

sometimes a short check of existing functions (it’s also described in the cited section of the manual) helps :wink:

No. Before the GUI gets called, dt scans for drivers and devices and ports. It causes issues on Windows. I think it will be best to only initialize those subsystems on a flag. Yes you could compile without those, but most Windows users will not compile dt.

all those settings can be set in the GUI but are loaded when the darktablerc file is used to initialize darktable…

Maybe we are saying the same thing. I image like a portion of preference with checkboxes for: Enable Midi support, Enable tethering support. Default to off and if the user turn on, a message shows up, dt must be restarted for these changes to take effect.

I think we have this functionality in new multiple workspaces option.

No need to default to off on OS’s which don’t have the problem.

Could you provide more details please (exact configuration, applications using midi, sequence of steps, error conditions)?

Asking because I’ve been using Windows 10 and 11 without any problems and no issues have been reported so far. As above, if you don’t want dt to grab all midi devices, enter - in the preferences field. If devices have already been opened by other applications, dt won’t have access to them when starting. If other applications try to open devices that are already claimed by dt, then that might be an issue with those applications (but again, preventing dt from claiming them with - should solve those issues too).

This is an old one. I remember others that should be in GitHub or here in Pixls.us

My main point is that I don’t see the value in having dt do an initialization/scanning of ports/drivers for something I don’t routinely I intent to use.

when all midi devices disabled, don’t initialise portmidi by dterrahe · Pull Request #20101 · darktable-org/darktable

1 Like