Monday, August 25, 2014

Polyphonic MIDI on a single channel to Monophonic MIDI on separate channels

UPDATE! 9/19/14  I'm working on a new version of the sketch for this project which uses the midi library.

It's been a while.  Since my last post, I've taken two C++ programming classes and hopefully it will show in my coding.  I've been working on several projects over that past few months but all of them have been big and though they have working prototypes, they remain unfinished.

I'm working on a simple MIDI controller that works like a flute/guitar.  The left hand does the fingering to select a root note and the right hand can "pluck" variations of that root.

combinations of buttons on the headstock choose a root note.  for example, when no buttons are depressed, the root note is "E".  When only the first button is depressed, the root note is "G".  The arcade style buttons on the body actually trigger a note to play.  The yellow button will play the root note.  The red button will play one step down from the root.  

In addition to my MIDI controller, I've been working on a Robot Drummer.  This project has entailed building a MIDI to Solenoid "brain" and the actual solenoid drumming mechanisms.  I chose to design a simple bracket which screws on to quick clamps that I bought at Harbor Freight.  This project also has a working prototype but I am continually finding things that need to be changed/updated. 

I have a nice video of this in action

So, I've been working a lot with MIDI lately.

My modular has a pretty simple 4 channel MIDI2CV DAC.  I've been wanting to build a new one that could handle polyphonic messages and thus allow my modular to be more polyphonic.  Instead of building a whole new MIDI2CV DAC, I thought, as a start, I'd build a little MIDI box that could take incoming polyphonic MIDI and distribute it to a selected number of channels as monophonic MIDI messages.  Here is what I came up with.

so, below is all the code needed for the distributor box.  because the Arduino IDE doesn't allow you to define a class in a sketch, I had to write my own header/library files.  I decided against the MIDI library because I couldn't really understand all the implementation.  You can copy and paste the code into text edit or whatever but you need to save the files as charlesMIDI.h and charlesMIDI.ccp,  then in the Arduino IDE,  past the main sketch into the main coding window and then under the menu labeled "sketch" you can select "add file", then choose charlesMIDI.h and charlesMIDI.ccp.


This PCB is different from ones I've done in the passed because I decided to etch the TOP copper instead of the BOTTOM.  Normally, components go through the board and and soldered onto the bottom.  I decided I wanted components and the copper on the same side.  this is why the numbers in PCB image bellow are backwards.

 I did a few alterations after I created the PCB.  The JP1 in the bottom right corner of the schematic should be collected to the other leg of the priority switch.  the diode near the power hook up(bottom left) is a 5v zener diode for power protection.  the optocoupler chip is a 6n137.  that's just about everything.

Because I have access to a laser cutter, that's how I made the box.  I'm not really sure how to post a vector file on my blog so if you are interested in the box, I can send it to you.  there is no label for mono-mode because it was an after thought.

Here is a little demo of it working.  It's a little bit ridiculous, the size of the box and circuit board I created for this project, but the whole project was a bit of a prototype for other projects in which viewing the circuit board is the focus of the device.

Well,  that's all for now folks.