MIDI OUT for vintage Korg CX-3

if your analog organ does not have a MIDI output - you're gonna have way to much keyboards on stage!

If your analog organ does not have a MIDI output – you’re gonna have way too much keyboards on stage!

Motivation

The Korg CX-3 is one of the most popular and best sounding Hammond C3 clones. (I am talking about the vintage version from the 70s, not the digital reissue) I consider myself lucky to own one because it’s great for playing the 70s hard rock cover songs that I do with my band.

Since the CX-3 was born in the late seventies it does not have a MIDI output like most other keyboards nowadays … which is a great pity because the touch and feel of the keyboard is amazing! So I was wondering if I could teach my compact organ some MIDI, e.g. adding a real MIDI output to my beloved analog organ baby. This plan was accomplished with an Atmel ATTiny 2313 microcontroller.

Theory

I was wondering if it was possible to get this job done without soldering wires to each key contact because that would make my organ a mess. So I crawled the web for information and found myself gazing at the following page with awe:

http://robert.weathergreen.com/bx3/

Thank you Robert Weathergreen for maintaining this website, it is !exactly! what I was looking for. Apart from mere schematics there are sketches of the PCB and even theory of operation/service manuals.

In the “theory of operation” section I found this graph here:

key readout process description, well documented, Korg-guys!

Korg CX-3 key readout process sketch

So I learned that there are two ICs (SM-304A) inside the organ that are directly connected to the keys and do nothing else than repeatedly generating a serial data stream (with a length of 65 bit) that tells me which keys are pressed and which are not. The corresponding output signal line is called “D” for data in the block diagram. These shift register ICs are receiving control signals, i.e. a clock signal “T” and some kind of reset signal “U” that marks the beginning of the sequence (bit 1).

If we could somehow eavesdrop on these three signals that would give us all the information we need to generate our MIDI signal.

The Hack

First we have to find the desired signal lines in the schematic:

The schematic of the CX-3 tone generator section. The points where we want to tap into the signal lines are marked with colored arrows.

The schematic of the CX-3 tone generator section. The points where we want to tap into the signal lines are marked with coloured arrows.

An there they are, T, D and U according to the labels in the schematic symbols for the shift register ICs. You can see that there are three NPN transistors (Q1, Q2 and Q3) functioning as emitter followers. Q1 and Q2 seem to buffer the U and the T signal coming from the control unit before they are distributed to both shift registers. Q3 buffers the D signal coming out of the second shift register. So I would propose to tap into the signal lines right at the emitters of these three transistors in order to capture a strong and stable signal whilst interfering as little as possible with the organ electronics. Thanks to robert.weathergreen.com we even have a map at hand to locate the transistors on the organ’s main PCB.

CX-3 Main PCB

I’ve marked the emitters of the transistors which have to be tapped. [Edit (July 27, 2014) added GND and VCC(+12V) tap marks]

100_2226

… for those having trouble to find the transistors on the actual PCB

Now we just solder wires to the emitters of the buffer transistors plus a wire for ground connection. You probably can steal some +12V as well to power your microcontroller through a 5V fixed voltage regulator. For example, there are +12V at the collector of Q3. I used an external power supply though, because I already installed a supply for my tube overdrive modification. Don’t power the microcontroller board with the +12V from the main PCB if there should be strange noises.

Electronics

Question: How do we feed the signals into the microcontroller? If you look at the signals on an oscilloscope you realize that they are not very TTL compatible, in fact the logical HIs are approx. +12V.  So we need to convert them to TTL. Therefore we employ the (HEF)4049 or 74HC4049 IC. (NOT the 74HCT4049, because it has TTL input) The 4049 is a hex CMOS inverter with the nice property that the input voltage can be higher than it’s supply voltage. That makes it suitable for high to low logic level conversion. Consequently the signal is logically inverted, but that is not a serious problem as the microcontroller can invert it back in software.

Here’s the schematic of the microcontroller board I designed for this project:

And a nice picture of the actual board:

100_2232

And the place I permanently installed it:

100_2233

I first had the signal lines going out the other way; i.e., from under the right side of the PCB. That was not such a good idea, because the rapidly changing high level signals induced some noticeable humming sounds into the sound-generating section of the organ. The way it is installed now, the modification disturbs the organ not the slightest bit.

Software

So what does the microcontroller do to generate the MIDI data?

For each rising edge of the T signal the logic state at the D pin is read and stored at a certain position in an array in the microcontroller’s memory. The position naturally corresponds to the number of the timing pulse of the T signal, which in turn corresponds to the number of the keyboard key that the D signal is telling us about at this very moment. When the U signal displays a falling edge the array index is reset to zero, if not the array index is continuously incremented and we overwrite the same memory with a digital “snapshot” of the whole current keys pressed/not pressed situation.

Let’s say the program is dealing with the status of key #20 at the moment. Before the new key state is written to the memory, it is compared with the old state from the previous “round”. If the memory says “0” and the new state is “1”, then it is clear, that the key has been pressed in the meanwhile. So let’s generate a MIDI message that contains this information and send it via the UART, previously configured to a baud rate of 31250 baud (THE MIDI baud rate specification). A MIDI message for a note on event of key #20 consists of three bytes:

byte 1: 0x90 (shown as hex): “I announce you the beginning of a note on event on channel 0”

byte 2: 20 (shown as integer): “It’s about key #20”

byte 3: 64 (shown as integer): “The key was struck down with a velocity value of 64” (possible values are 0-127, an organ keyboard has no velocity sensitivity)

If the memory says “1” and the new state is “0” then the key has been released and a similar MIDI signal is generated. But it now begins with “0x80″ which means “I announce you the beginning of a note off event on channel 0”. There is a velocity information, too, but it does not really matter. I just send a zero.

For a detailed howto about MIDI and AVR microcontrollers see “MIDI and the AVR” on avrfreaks.com.

 

EDIT: I recently tried to recompile the firmware after doing some minor changes. This led to unpleasant behaviour (freezing of notes, glitchy sounds), because the microcontroller lost sync with the input signal. I suppose it is because I use a different (newer) version of gcc-avr now, which compiles the code differently so the timing is different. Sadly I heavily rely on the timing of the original machine code. I know this sucks. But hey, the original hex file in the firmware zip-file still works!

Download

Microcontroller code/hex files and PCB layout can be found here:

Project on Github

or download .zip file

 

 

15 responses to “MIDI OUT for vintage Korg CX-3

  1. I love my CX3. Mine is also running through a Behringer mixer right now, the other input being a virtual piano (iGrandPiano on my iOs device) controlled by an old 61-key midi keyboard. I agree that midi out is pretty much required these days!

  2. Would you be able to build a kit for this? I have a korg bx3 1980, which should be the same electronically. I’m in Dallas, TX and the only keyboard repair shop here (audio electronics) may not be able to do this mod without an actual kit. I could PayPal you for the service.
    (I’m also sending a duplicate email)

  3. nice! that’s rad you added midi to the cx3. i’m wondering how hard it would be to put a sustain pedal jack on my cx3. any ideas about how to do something like that? either way that robert weathergreen’s site you linked to is awesome, great place to start for sure. thanks for sharing!

  4. Hi Michael
    We are using a Kerswell SP54-8 at our church in Toronto and Tim our organist would like to add his Korg CX-3 as a second keyboard. We are interested in your midi adapter as the possible connection. Have you done further work on your midi out box. Would you possibly have a parts list in addition to your details on github? Is the Marcus who sent you a response Marcus Marr of Peterborough? He sold us the Kerswell.
    I will be interested in any response you have time for.
    Dave

    • Hi. I don’t know either Marcus 🙂 Sorry. It’s been a long while since I did this project. Don’t have the correct version of my PCB design software installed. But it is only very few components. I advise you to just look at the schematic and make a list of the approximately 6 components yourself. Regards, Micha

    • David, Marcus Elia here. I’ve been following this thread for some time because I’ve always been interested in midi-fying the Korg. I didn’t realize Dad was now thinking about it too! 🙂 my next step, which I’ll share with him directly, would be asking Phoenix about adding a midi board to the organ… They do this all the time, and with older keyboards than this!
      Thanks to all who have contributed ideas here, and to Michael for hosting the discussion!

      • Marcus
        I did not realize who I was copying here. I wholeheartedly agree with Phoenix adding another keyboard using similar technology to the Kersweil sampling technique. I fear the use of the old Korg synthesizing technology would we a horrible step back in organ sound reproduction. Please ask your Dad for my phone and email. You have added a new breath of life to possibilities.
        Dave

  5. Hi Marcus,
    nice project. I own a Viscount OP 6. I think it´ll work with this kind of furniture too.It`s nearly a Korg BX3 clone. One question: Is it possible to adjust the Midi output channel? It could be useful for two manuals.
    Greets
    Martin

  6. Hi Michael,
    that`s a great project. I think it works also in my Viscount OP6. It´s nearly a Korg BX3 clone. One question: Is it possible to adjust the Midi output Channel ?
    Greetz
    Martin

    • Hi. It is possible to change the MIDI output channel in the code. But please acknowledge my EDIT note: EDIT: I recently tried to recompile the firmware after doing some minor changes. This led to unpleasant behaviour (freezing of notes, glitchy sounds), because the microcontroller lost sync with the input signal. I suppose it is because I use a different (newer) version of gcc-avr now, which compiles the code differently so the timing is different. Sadly I heavily rely on the timing of the original machine code. I know this sucks. But hey, the original hex file in the firmware zip-file still works!

  7. Very interesting project. I have an Orla X50 clonewheel that used the same circuitry as the old korgs.
    Thanks for the information 😊

  8. Moin,

    nice site, just found it after midifying my own CX3 with a Dr.Böhm MIDI2001, a 6809-based Hardware for SM304/305 organs, making MIDI In/Out/Through possible. Yes, the CX3 may even be played via MIDI 😉
    I changed the original software to enable MIDI I/O channel switching, program change (1 – 122) and MIDI volume at MIDI out.
    @acidbourbon:
    Timing problems may be fixed by adjusting SM304/305 internal timing:

    Change R5 on Korg KLM244 (main PCB), higher values will slow down, lower values speed up. Using a 1MOhm trimmer may even solve Your timing problems forever.
    I slowed down T-frequency of my CX3 to just below 40kHz (R5 = 820kOhms), as 6809@8MHz clock was not fast enough to sync while listening at MIDI in at the same time. It is still fast enough for my playing though 😉

    • Hi, thanks for the remark. I guess I won’t open my CX-3 anytime soon, but it is very good to have this kind of information underneath my post 🙂
      Schönen Abend noch! Gruß, Micha

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.