Archive for August, 2011

Wednesday, August 24th, 2011

Programming MIDI with Scala

I’ve got a pair of Stanton SCS.3d DaScratch controllers and a Native Instruments Traktor Pro DJ software. They are connected using DaRouter software which is based on Bome Midi Translator. It runs pretty well, but there’s one small issue. Traktor has four decks, and there is no way to control more than two decks using the two DaScratches with this setup. There is “deck” button on the controller, but it is only used to change between two decks if there’s only one DaScratch. The button has no effect with a pair of controllers. I believe Stanton SCS.3m mixer would solve this, but I don’t have one.

I could buy SCS.3m mixer, but it doesn’t offer a lot of value. To be honest, I’d rather use my iPad with TouchOSC for the controls outside the DaScratches. Not owning SCS.3m mixer I’m pretty much forced to use DaRouter.¬†I could also buy a Bome Midi Translator and try to make a patch for four decks. As no-one has done it, I suppose it may be impossible to do with Bome. So, it is time to start a programming project.¬†However, even if I develop software as my job, my MIDI programming skills are dated 10 years ago. Back then I used Windows low level MIDI API with Delphi.

For DJ’ing I use MacBook, so the first option came in to my mind was to use Xcode and Objective-C, but after looking examples, it really didn’t felt my thing. It is pretty verbose, and OOP paradigm is not too interesting for me. More interesting Haskell isn’t too mature to use with Xcode yet, and the learning curve is still pretty high. So, I turned to trusty Scala running on Java Virtual Machine. After my experience with Windows API and Delphi, I immediately noticed the following advantages:

  • Comparing to Xcode, the project is not cluttered with numerous files
  • With REPL, it is very easy to prototype any code
  • Scala is very productive when enumerating lists

I can admit the following disadvantages

  • Java Virtual Machine doesn’t start too fast – although it doesn’t matter now
  • Fading support of Java on Macintosh – but it is still supported
  • Performance – the application is not too hungry for that, and the performance decrease is not actually very high
  • Java UI tools are slightly out-fashioned – let’s see if this application is getting any user interface