Monday, January 25, 2016

Mopho Morphosis



I was lucky to get the DSI Mopho desktop version for a very good price, and admittedly I like this little thing a lot. However, like with everything, there is room for improvement -  so let's improve it a bit...

Note: The tweaks work equally well for the Mopho keyboard



1. Cleaner sound

Depending on the oscillator and filter settings, the Mopho's sonic capacity can be quite - unclean. As Synthbuilder well explains in his post on Gearslutz, this is because the DAC's reference voltage is generated from the, quite noisy, 12V rail. While all oscillator waveforms are equally affected,  this noise is most audible on the pulse wave. To test the practical implications on your own Mopho, completely open the filter and turn the resonance to zero. Also make sure that any modulations (envelopes, LFOs, etc) are turned off and no sub oscillator is active. Turn one oscillator off, and the other to Pulse 50. Instead of a clean pulsewave, it will sound somewhat dirty. Increase the puslewidth, and the dirtiness increases. At Pulse99, when you actually should hear nothing, the noise will be very dominant.

Before (Top) / After (Bottom): Pulse50 - Pulse 60 - Pulse70 -Pulse80 - Pulse90 - Pulse99

Luckily there is an easy fix. Since the noise from the 12V rail goes unfiltered to the DAC, filtering it is enough to clean the sound. A simple 10 µF tantalum capacitor soldered across resistor R52 (next to U12, the DAC) does the trick. Tantalum capacitors are polarised, and the negative pin should be soldered towards the front of the unit as indicated in the picture:




Afterwards, all oscillators will be absolutely clean. Thanks again to Synthbuilder for figuring this out.!




2. USB

Depending on the situation, sometimes I prefer DIN IN/OUT for MIDI communication, sometimes I would go for USB. Unfortunately the Mopho does not offer a USB port, but also this can be changed.

A quick look at the synth's innards reveals a 6N137 - an optocoupler that is regularly used to isolate circuits for MIDI INs. Its location close to the MIDI DIN sockets supports the this usage also in the Mopho, and a quick look at the 6N137's data sheet tells us that the incoming MIDI signal is passed out at pin 6. Meaning: we can easily hijack the circuit here by implement a bidirectional MIDI THRU "port". However, our THRU will not get a physical connection to the outside world, but with a Teensy µprocessor. As the Teensy offers multiple serial lines, TX1 (pink cable) can be used to infuse our own commands into the Mopho,  RX1 (also pink cable) can listen to all incoming MIDI IN messages (let's be aware of everything that is going on in there), and RX2 (blue cable) can sneak on all commands leaving at the MIDI OUT (I do not  eally care about sending things to the Mopho's MIDI OUT, so we'll skip connecting TX2 to that).  Right in front of the DIN sockets is a row of headers from the display connection. The right-most is GND and the one next to it is a 5V rail which we can use to power the Teensy:




Best to use is the Teensy 3.1/3.2, as their pins tolerate the 5V of the Mopho's MIDI implementation. Since I only had an Teensy LC lying around (and the LC comes for half the price - however, its pins are strictly 3.3V) I had to shift the voltage levels down/up. 2N7000 transistors are cheap, abundant, and perfectly suitable for that purpose. As a bonus, they can be used to shift levels both up and down. Together with two 10K resistors, the basic circuit to shift voltage levels between 5V and 3.3V looks as following:




As the MIDI specifications suggest on page 3, we additionally pass the signals for and from our "THRU" port through two logic gates before inducing then into the 6N137. I used a 74HC14N hex inverter for that purpose, and used two of its channels for RX1 and two for TX1. To stabilise the power supply to the hex inverter, we further add a 100nF decoupling capacitor to its GND and Vcc pins. RX2 can be more or less (less because we still need the level shifter) directly connected to the Teensy, like any other receiving MIDI device. An additional optocoupler is not necessary here, since we are anyway connected to the Mopho's GND and 5V, and therefore do not need to isolate our circuit.






However, we need to isolate everything from the power lines on the USB cable, and we do this by cutting the connection between the two tiny Vusb square pads on the back side of the Teensy LC. After assembling everything on a prototyping pub, the final circuit looks like this:






The observant reader will notice two additional resistors, as well well as three cables connecting to the right side of the board - which brings us to...



3. Clock and Note Indicators

I change my setup a lot, and not always does everything work immediately. While troubleshooting, it would be nice to know if the Mopho currently does not receive any MIDI messages, or if the sound path is interrupted. Since we already hijack the MIDI connection, we can easily add several status LEDs as well. I implemented two LEDs, one that displays the clock in 8th note divisions, and one that indicates if a note is currently played. Both are visible in the title image of my post, in the black circles in the upper left corner. The LED for the clock signal is connected via a 220 Ohm resistor with pin 8 of the Teensy, the note LED via a similar resistor with pin 7. I wrote the corresponding software in a way, so that is requests a dump of all global parameters on startup, and by this knows if an internal or external clock will be used, and on which MIDI channel the Mopho listens for notes. Similarly, if either parameter is changed on the Mopho, the Teensy is aware of that by analysing the NRPN messages through RX2 on the MIDI OUT. For everything to work, make sure to upload the firmware (which you find here) to the Teensy as described here, and happily use the USB or DIN ports as you please :)

DSI Software Editor with Mopho connected by USB



4. Optical Polishing

After modifying so much, I thought it would be nice if we also optically improve the Mopho a little bit. I did so by adding dark wooden sides that nicely complement the yellow color:..





Saturday, January 16, 2016

Klockwerk - A MIDI clock generator



A small addition to my MDMA project: a MIDI clock generator

The firmware consists of just a couple of lines of code, and definitely isn't something that has not been done before. I still thought it is worth sharing, as I measured the precision and accuracy of this clock with the firmware running on the low-cost version of the Teensy development platform (of course the code also runs on an Arduino/Genuino). Considering that, even at 300 bpm, there is a timeframe of about 8 µsec between two clock signals, we are very good with both precision and accuracy, being in a range of lower than 0.05 µsec.

Again, we have MIDI over USB functionality out of the box, without any soldering required. DIN connections are also supported, and can be added with a cheap, and easy to implement, small circuit.

The code can be download from my GitHub repository, and is installed using these detailed instructions...

Feel free to expand it :)


Tuesday, January 12, 2016

Kaoss Update: solder-free solution for enhanced MIDI DIN control




Wow, I am blown away by the receptions I receive for my Kaossilator / Kaoss Pad MIDI mod.

As a thank you, I want to throw a small goodie in the ring:

A solder-free version of the DIN mod. If you can spare USB connectivity, there is a very easy solution to play your Kaossilator Pro(+) or Kaoss Pad 3(+) with standard Note On/Off messages generated by any keyboard, sequencer, DAW, etc.

Naturally, this is also the most expensive solution, but we speak about being expensive in the range of less than 20,- Euro/Dollar here. All you need are two devices (if you look for third-party clones, less than 10,- each): an Arduino/Genuino (Uno, Leonardo, or any compatible clone) and a MIDI shield.

Sorry, to be precise, you'll need these two devices, a USB cable and an internet connection (the fact that you read this, tells me you are on the right track):


  1. Put the Arduino and the MIDI shield together
  2. Get the Arduino IDE from here and install it
  3. Get the MIDI library from here and install it (described here)
  4. Get the Kontroller firmware from here
  5. Open the firmware in the Arduino IDE and edit the features listed in the beginning of the file
  6. Use the USB cable to connect the Arduino to your computer
  7. Choose your Arduino board and its connected USB port in the Tools menu of the IDE 
  8. Press the Upload button
  9. Happy Kaoss on your gig!

Monday, January 4, 2016

Play the Kaossilator and Kaoss Pad with any Din MIDI equipment



Due to popular demand after my post about how to Play the Korg Kaossilator Pro(+) and the Kaoss Pad (+) with standard MIDI controllers (solder-free tweak), here is an update of the tweak that adds the option to use DIN connections (alone and in any DIN-USB mix).

To quickly summarise my initial problem: the Korg Kaoss devices are designed to be played via their touch pads. Accordingly, the MIDI implementation is tailored around corresponding commands. In practice: MIDI controllers send a note on command to play a tone, while the Kaoss devices expect a control change # 74 (to signal that the touch pad was pressed), and then control changes # 12 and # 13 (to define the X and Y coordinates on the pad) to make a sound. This is a very consequent design choice, however, I frequently struggle to hit exact notes which would be very beneficial at times.

After already posting a way to circumvent this problem by making a small device that translates all USB MIDI messages for the Kaoss devices, this idea is elaborated by adding MIDI DINs here. While this greatly improves the usability for computer-free life performances, unfortunately it cannot be implemented without assembling a small electronic circuit. However, this circuit is particularly simple, very cheap, and comprehensive instructions are posted here.

After adding the DINs in hardware, get the latest Kontroller firmware and change the following parameters in the beginning of Kontroller.ino with the Arduino IDE:

  • USB on/off
  • DIN on/off
  • MIDI channel
  • enable/disable modulation of the X-axis (the note's pitch) by your keyboard's pitch wheel
  • enable/disable notes velocity to define the Y-axis (often a filter or delay)
  • enable/disable a control change # (which can be freely chosen) to define the Y-axis
  • enable/disable aftertouch to modify the Y-axis value
  • enable/disable indication of played notes on the built-in LED of the Teensy (Why not?)

For DIN connectivity, the MIDI library needs to be installed. Connect your Teensy board and, in the Tools menu, select Board: "Teensy LC""Teensy 3.1" or "Teensy 3.2" with USB type: "MIDI". Then press Upload in the Sketch menu.


The Kontroller firmware is now under the umbrella of my MDMA project.

Update: a solder-free DIN solution without USB connectivity


Sunday, January 3, 2016

MIDIfication

My projects are regularly based on the Teensy and Arduino/Genuino development platforms. While the former natively supports MIDI over USB, I often have the need for DIN support. The following instructions connect DIN input and outputs to you Teensy (all) and Arduino (Zero, Uno, Due, Mega, Leonardo, Yun, Nano, Micro, Mini) boards.

The circuit in general is very simple and can be soldered by beginners as well. For testing purposes, a prototyping board can also be used:




MIDI Out

Connecting a DIN output to the Teensy is straight forward. Although the Teensy runs at 3.3V, while the MIDI standard specifies 5V operation, virtually all MIDI devices function with a 3.3V connection without any problem. To have DIN MIDI output, connect pin 2 of the output DIN to ground (Teensy pin GND), pin 4 through a 220 Ohm resistor to 3.3V (on the Teensy), and pin 5 gets connected to the Teensy's TX (Teensy pin 1):

  • MIDI OUT pin 2 - Teensy GND
  • MIDI OUT pin 4 - 220 Ohm resistor - Teensy 3.3V
  • MIDI OUT pin 5 - Teensy pin 1 (TX)


MIDI In

The DIN input is a bit more elaborate. Here, we isolate our circuit from the circuit of the MIDI partner (which itself will be isolated from all input, that is why our output can be so simple). We do this with an opto-isolator, and a good one for this purpose is the 6N137 for its sharp transient signals and 3.3V suitability. Also it is cheap and available from numerous manufacturers.  Pin 4 of the input DIN is connected through a 220 Ohm resistor to pin 2 of the 6N137 (the spot marks pin 1, we use the one directly next to that), and DIN pin 5 goes to 6N137 pin 3. Similarly, pin 5 on the 6N137 is connected to the GND pin on the Teensy. Pin 6 goes to RX (pin 0) on the Teensy, and 8 on the 6N137 goes to 3.3V as well as RX (the latter through a 5.6 kOhm resistor). If you want to be extra secure, you can stabilise the 6N137s power lines by putting a 100n capacitor (ceramic is fine) between them (pin 5 and pin 8) as close to the chip as possible. To further protect your circuit from reverse polarity (someone swapping + and - on the MIDI cable), add a 1N4148 diode between pin 2 and 3 of the 6N137. While the orientation of all resistors and capacitors used here does not matter, the diode has to be put in a specific direction: the side with the solid black line points to pin 2:

  • MIDI IN pin 4 - 220 Ohm resistor - 6N137 pin 2
  • MIDI IN pin 5 - 6N137 pin 3
  • 6N137 pin 2 - 1N4148 diode - 6N137 pin 3 (the black bar on the diode points to pin 2)
  • 6N137 pin 5 - Teensy GND
  • 6N137 pin 6 - Teensy pin 0 (RX)
  • 6N137 pin 8 - Teensy 3.3V
  • 6N137 pin 8 - 5.6K resistor - Teensy pin 0 (RX)
  • 6N137 pin 5 - 100nF capacitor - 6N137 pin 8

Software

The standard Arduino MIDI library can be used to access the DINs. Actually, please use the standard MIDI library. The one that comes with the Teensyduino environment is based on a much older version and will not function correctly with my code (it is initialised differently).

If you start from scratch on a Mac (it is basically the same in Windows, but I happen to have a Mac):
  • Get the Arduino IDE from here and install it
  • Get the MIDI library from here and install it (described here)
  • Get the software you want to install from my GiHub repository
  • Open the firmware in the Arduino IDE and edit the features listed in the beginning of the file
  • Use the USB cable to connect the Arduino to your computer
  • Choose your Arduino board and its connected USB port in the Tools menu of the IDE
  • Press the Upload button
  • Voilà

Prototyping

In the above picture, the connections are as following (always from left to right): top left - DIN input pins 5, 4; bottom left - DIN output pins 2, 4, 5; bottom right - Teensy pins 1, 0. Also don't forget to connect + to 3.3V on the Teensy, and - to GND. For the interested among you, the schematics are the following: