Hacking Maschine - how it all started

The demo setup
I've been a Maschine user for almost two years now, and it's well integrated in my usual setup. Since a few months, though, I've been more and more involved into modular synthesis, and the amount of eurorack modules in my case has been slowly but constantly growing.
I've built oscillators, filters, LFOs, VCAs, a bucket brigade delay unit, yet there was something very important missing: I needed an hardware sequencer!

Of course I was already having fun with a CVPal and my laptop, but somehow it felt weird having to use a mouse to shape my sequences, when all the sounds were created and processed on my modular synthesizer.

Then I decided that it was time to build a simple CV/gate sequencer: I took inspiration from some nice and interesting open source projects (MIDIAlf with CV board and Sonic Potions LXR, to name a couple) and put together some prototypes using breadboards and Arduino.
That was a lot of fun, but... wait a second!  Did I really want to build a dedicated hardware control surface from the ground up? Of course it would have been great and rewarding, but would have required quite some time, and I wanted to be rather focused on the sequencing engine and the software features (well... who knows, if the next Berlin winter is long enough I might also spend time designing some hardware).

Anyways. All of a sudden that Maschine MK2 laying on my desk started to look even sexier... loads of buttons, RGB leds, endless knobs and two 256x64 monochrome displays! But how to use it? No, I wasn' t going to tear it apart and cannibalize some pieces, I had to find a less "intrusive" solution.
What about trying to reverse the communication protocol in order to be able to use the original hardware with a whole new application logic? Maybe even wihout connecting it to a computer? That' s how it all started...

Now, here' s step by step what I did:

  • Logged the communication between Maschine MK2 hardware and the software using USBLyzer (you can see a piece of the log in the picture above)
  • Started sorting and filtering the messages, and identified three different output reports and one input report (at this point I missed the input report carrying the knobs/buttons status... this report is only sent when you actually press a button or turn a knob)
  • Wrote some quick and dirty test code, using HIDAPI, which eventually turned into a handy command line utility - I might share the source code once it's a little bit cleaned up
  • At this point I was able to send messages from my computer to the Maschine MK2 hardware directly, but I had to reverse the mapping between bytes in the messages and their corresponding functionality on the device: this was the most cumbersome and boring part...
  • It also took me a while to understand how to send data to the displays, I couldn' t find a message long enough among the output reports I already logged. A single message should have been 2049 bytes long ( assuming 1bit per pixel and including the message ID), so there must have been some kind of chunking mechanism.
  • Yay! I found a bunch of 267 bytes long messages, with a similar "header" part and [most likely] a 256-bytes payload. This lead me to the conclusion that each display is expecting 8 chunks, every chunk consisting of either 8 rows or 32 columns, depending on how the displays are handling the data.
  • After some experiments, I found out that chunking occurs on a row basis, so each display is expecting 8 chunks, each one containing 8 rows
  • Started writing a C++ library for parsing input reports and creating output reports
  • Wrote a simple graphic library (again, the open source community offers many sources of inspiration: Adafruit GFX,  Arduino TVOut...) to draw pixels, bitmaps, primitives and font-based text on the displays
  • Wrote a small php script to convert png images into the format expected by the displays, as a C array

Ok, but what happened then?

I needed a "demo" application, to develop the library and identify potential design flaws, but I also wanted to have some fun, so starting right away to develop my custom sequencer application was not really an option.
I have to go back to one year ago, when, together with a friend of mine, I bought a couple of SN76477 chips and the SN-Voice PCB designed by Scott Stites/Thomas Henry. Later this year Synthcube re-released a wonderful eurorack panel, which I also bought.

Why am I talking about the SN76477 now? Well... some of you might remember about Space Invaders, and this chip was the original sound engine of the first version of the game that came out in 1978.
Now: I have a eurorack module with an old sound chip and a library which allows me to communicate with a Maschine MK2. What's missing? Right, SPACE INVADERS! 
There are many implementation laying around, and I picked up the one released together with the Hackvision Arduino firmware, refactored it a bit, in order to use two 256x64 displays and read the input from Maschine MK2.

Finally I remembered about an Arduino Due I bought, which was gathering dust on a shelf since a few months, and after a quick investigation on the Arduino website found out that it could be used as a USB host!
At this point I replaced the HIDAPI layer with USBHost, refactored a little bit the API of my library, and finally I was playing Space Invaders on my Maschine MK2 using an Arduino Due, without the need to connect the controller to a computer anymore.

The very last step was the CV/gate interface: in the last weeks I ve been working on an Arduino shield (you'll hear more about it in the next months) which provides 2 12-bit CV outs with configurable offset, 2 gate outs and 2 gate inputs, so I just hooked up the prototype to my Arduino Due, added some more code and had some fun playing the game and my eurorack synthesizer at the same time :)

What's so special about this demo? Well, it might seem just a nerdy exercise, but the good news is that using the library I designed (which will be released very soon) you will be able to transform your Maschine MK2 into something completely different: a hardware step sequencer, a synthesizer, or even a class compliant audio device (ever heard of hiduino?).

Here's a short video (many thanks to Mickael Le Goff for this wonderful eye candy!):

 



And this is the hardware I used for the demo:
  • Maschine MK2
  • Arduino Due + Euroduino shield
  • Sonic Potions LXR with CV/Gate board (receiving clock input from Arduino)


And the eurorack modules:

  • SN-Voice
  • Turing Machine (receiving clock input from LXR)
  • RYO Optodist
  • Befaco Crush Delay
  • L1 Tube VCA
  • Frequency Central System X Envelope
  • Frequency Central Wave Runner
  • Erica Polivoks VCF
  • Steffensen Oscillarp
  • shaduzLABS 808K


The game runs completely on Arduino Due with ChibiOS, and sends, through the Euroduino shield:

  • a clock output, which is used to sync the LXR drum machine and the Turing Machine sequencer to the game speed. The Turing Machine sequencer sends a CV output to the Oscillarp, generating the bass loop, while the LXR generates the drum loop
  • a CV output, which controls the pitch of the SN-voice module. This module generates all the sounds like explosions, mystery ship alarm, etc.
  • a gate output, connected to the System X Envelope, which shapes the amplitude of the SN-voice output



Oh, and this is one of the early CV/gate sequencer prototypes I mentioned at the beginning of the article (sorry, this time the video is a bit shacky...)



The library will be released in the next weeks, stay tuned ;)
comments powered by Disqus