Midi Controller for Darktable

Not sure if this is of any use but as it’s opensource some of the code might help. MIDI2LR by rsjaffe

You joke, but this honestly almost sounds like it might be a fun project. Maybe not specifcally midi-controller, but something fun! Heck, we might even get @andabata to walk us through one for a macro focusing rail… :smiley:

I deny the existence of it :stuck_out_tongue:

1 Like

@naturalblue:
Under the hood it will store controller mappings in text files, yes, but for configuring there will be a GUI. I haven’t thought about details too much yet.

About that MIDI2LR thing, I had a look at the MIDI protocol a while ago and it’s trivial to parse, so I don’t think I will need any foreign code. I might peek into GIMP’s at most. :slight_smile: The only thing I don’t know yet is how to get to the Midi interface on OSX. But eventually we will figure that out, too.

@patdavid:
Once the parts for tinkering are here I will definitely do posts on every bit of progress I make. Even if it’s just a breadboard proof-of-concept thing at first.

And since Midi has a back channel It shouldn’t be too hard to add slider movement. :wink:

4 Likes

@paperdigits,

I use a Wacom tablet and in Gimp its very hard for me to set the sliders for example from the brushsize, or transparency.
The two speeds to adjust the sliders are somewhat irritating.
With a knob or a slider it would be much easier to adjust (at least that is what I am hoping for).

1 Like

@Tobias

Thanks I didnt know that. :slight_smile:
Maybe when Kdenlive will support Midi, then I buy a Korg or so…

The Korg arrived. More updates once I played with it.

7 Likes

Btw. does anyone know if it is it possible to use an Android device + app as midi controler?

It’s funny how me, that wasn’t that interested in this, now I’m starting to want one of these :smiley:

2 Likes

First find: It is a class compliant USB-Midi device, so it works out of the box on Linux. I’d advice to connect it to a Windows or OSX computer once and, using the configuration tool from Korg, set the LED mode of the keys to external so that you can control the lights from the computer.

Speaking about config tool, running Windows in a VM and using the config tool in there allowed me to use Wireshark to sniff the USB traffic and all the config seems to be using Midi commands. So it should be possible to write a config tool for Linux. But that’s another project for later.

2 Likes

Yes, there are several android apps that send midi commands.

Do you have names, or a link?

http://humatic.de/htools/touchdaw/

I have a korg nanopad and some other midi devices I use on Linux all the time. You typically have two ways of reading the midi messages: through Jack patch bay, or via Alsa midi. I prefer Alsa, since Jack can be too complicated. Use a midi monitor program to read the midi messages if all the events (knobs and buttons), and then it’s easier to map out the midi controls to other functions. I like the dead simple “midimon” program for that: MidiMon download | SourceForge.net

Here you can find the corresponding MIDI manual which, if I understand it correct, shows e.g. the command needed to set the LED mode to external.

@chris:
Oh, that is great. thanks for finding that! :smile:

@Isaac:
I am using the Alsa sequencer now. At first I thought about using Alsa RawMIDI but then thought that maybe some people like to route Midi around. :slight_smile:
I might eventually also support reading from the MIDI device directly to support systems without Alsa like GIMP does, where I stole most of my code from. The downside of that is a bad user experience as they wouldn’t be able to pick the used device by name but would have to manually enter a device filename. And it would be impossible to reliably re-connect to the last used device. So I guess for now I will depend on Alsa.
For playing with MIDI outside of my own code I have used amidi to send and receive data, kmidimon for when I wanted a GUI and aconnect for manually routing and inspecting routes.

1 Like

Yes, I think Alsa is the right approach. It generally works well for midi, and allows flexibility. Plus, it’s already functional for midi routing in several open source projects, so there is some code out there. The only downside is for minimal and other systems that don’t have it already. The way gimp does it works, but has some serious limitations…

Quick update:

  • The Arduino arrived today, I soldered header pins and got it blinking, more to come once the other parts get delivered.
  • Using Alsa to talk to the Korg works great and I added that code to my local darktable build. The big task will be to add an abstraction layer in darktable that allows different means of interaction, namely keyboard shortcuts and MIDI commands, to trigger things. And I also have to incorporate setting precise values for sliders and similar things. Oh, and having data flow back to set LEDs on the Korg according to a state in dt is needed, too. I have some ideas about the implementation already, but it will take a while.
  • Thanks to the MIDI specs of the Korg linked by @chris I was able to write some code to get the settings from the device. Next I will write code for the other direction (uploading settings) and eventually get a tool to change the configuration without the need of the Windows program provided by Korg.

In case anyone wants to play with MIDI devices on Linux you should have a look at two alsa tools: amidi to receive and send MIDI data and aconnect to route MIDI data around. Specs will have almost everything needed besides that.

4 Likes

Yes, of course! (I guess houz likes jokes, because of his nice April fools ;-))

The Korg is so cheap that an Arduino based MIDI device would be more for fun. There are tutorials around how to make them, but you need some programming skills I’m lacking off. Blindly following these tutorials would not help me to understand what’s going on.

Thank’s @houz for your hard work on darktable and this topic!

1 Like

@houz Not sure if this is any good to you. I found it when i was looking for details on my midi controller.
http://linux-sound.org/bcedit-unofficial/
It is graphical and is on linux-sound so there might be source code you code use for the graphical configuration frontend.