Monday, June 22, 2015

Receiving MIDI Time Codes over USB with the Teensy

Due to a request of a reader of my blog, I elaborated on my extensions for the Teensy 3.x usb_midi library by adding support for callback functions to receive MIDI Time Code (MTC) messages. To fully understand the code, I recommend also reading my post for generating the MTC.

Briefly, the library files where we need to add the missing functions are located (on Mac OS X) in Contents/Java/hardware/teensy/avr/cores/teensy3/. This folder can be found by right-clicking on your Arduino application and then selecting Show Package Contents from the drop down menu.

You can either download the modified files from my GitHub repository and copy them to above folder, or you can modify the files yourself by following the following simple instructions:

Open usb_midi.h and search for "#ifdef __cplusplus". Add the following code one line above that:

Now search for "private:" and add this code right before it:

You are almost done. Save and close the file, and open usb_midi.c instead. Search for "// Maximum number of transmit packets to ..." and add this line above:

As a last step, search for "return 0; } #endif // F_CPU" (they might be distributed over multiple lines) and add these lines of code before the "return 0;"

And voilá, you can now receive MTC messages over USB and evaluate them with callback functions.
Your callback function will receive the MTC as a word parameter. An example sketch showing how to do the decoding is included in the repository...

Tuesday, June 16, 2015

Monotribe fun

Opinions about the Monotribe are quite controversial. While many like the sound this little device can produce, its lack of midi, 2nd oscillator, etc, are considered a huge draw back by others. Flanked by the Monotron series on the low budget end and with the Volca series having more functionality, the Monotribe appears obsolete and can be tough to integrate into your workflow. However, I got an offer for one that I could not decline - and I love the little thing. Its sound is (except being prone for clicks on note on and off events) raw analog and rich, while not missing a certain level of aggressiveness either.

Further, many of the points of criticism can be readily addressed by slight hardware modifications. These are largely facilitated by labelled soldering pads that Korg graciously put on the pcb. In addition, Midi functionality can be added without the necessity of physically changing the Monotribe, by using a serial connector present in the device and by using Midi commands and messages that are already integrated in all the official firmware releases. Consequently, several commercially available Midi kits from third-parties are at hand, however, these are often overpriced, considering only costs for materials, and many modifications can be implemented with only few and simple steps for a fraction of the price of a kit.

In this context, a modification scene has formed around the Monotribe with a plethora of mods being well described and published online. This information is often dispersed among several sources and I will summarise some of them here while implementing them in my own Monotribe,

Since I would like to have both, Midi DIN connections as well as over USB, I decided to use the Teensy microprocessor again to manage all communication and serve as a bridge between Monotribe, DIN and USB. This approach has also the advantage that there will be quite some processing power available for additional modifications of the synthesizer...

My first implementation is quite crude and demonstrates only basic capabilities: while the Teensy already takes care of the USB Midi communication I further added a small OLED display and a joystick. The display, so far, shows which note is currently played, either through Midi or on the Monotribe's ribbon keyboard, indicates the active drum sounds with icons (not shown in the picture), and visualises the position of the joystick - which in turn controlles LFO frequency and range.