The MidiFox is a small Eurorack Module. It takes a MIDI-Signal via MicroUSB from a Computer and turns it into Eurorack usbale Note Value, MIDI Velocity and Gate CV.
What is an eurorack Module anyway?
Eurorack is one standard for modular synthesizers. Modular synthesizers on the other hand are synthesizers (electronic instruments) that consist of many different modules (Things that do a small part of something).
That means that in contrast to “classic” synthesizers where the signal path is predetermined by the manufacturer, in modular synthesis you can have your own signal path by chaining together modules in any way you want.
So whats the other stuff you talked about?
MIDI (short for: Musical Instrument Digital Interface) is a communication protocol that is used by electronic controllers (for example keyboards) to tell synthesizers what they have to synthesize. Commonly this is which note you pressed (corresponding to pitch information) how long your pressed it (corresponding to the so called gate) and how hard, or fast you pressed the key (corresponding to the MIDI Velocity.)
Bill of Materials
After set-up we wait in them main loop for a MIDI packet to arrive.
When one does we unpack it and put its content into three seperate bytes. One for the header, and one for each of the two data bytes. We care mainly about the MIDI Events on and off with the header 0x09 or 0x08 respectively.
First things first we set the gate, when we get a MIDI on message. The gate pin is connected to the gate ouput and gate LED, and here we need values of 0 or 5 Volts. We do that via digitalWrite setting the pin to "HIGH". And since we are using a 5 Volt Microcontroller, that initially unspecified amount is exactly the 5 Volts we need.
Next we want to build the first set of bytes for our DAC (Digital Analog Converter). The first set of two bytes is for the note value. To get these values right, and to acess them fast we are using a so called "look-up table". A look-up table is a table full of precalculated values where can just "look-up" the right value. We then need to seperate this value into two 8 bit long bytes, for this we use the bitshift command (>>) to "move" the relevant bits 8 "digits" over. These two 8 bit integers then get passed as a Vector2, which is just a form of passing two values at once.
Now we send the data to our DAC. The DAC and Microcontroller comunicate via the Serial Peripheral Interface (SPI). The spefics of that standard do not concern us at this point, but the transmison works in practice like this:First we tell the Chip to pay attention, then we send our two bytes, and lastely we tell the chip that we are done.
Now we are going to build our second set of bytes. This time this is even easier. On the incoming side we have the MIDI Velocity, which is per definition an integer value between 0 and 127. On the outgoing side we need a value between 0 and 5 Volts. But since the DAC primary function ist to convert the digital values into analog ones from 0 up to 5 Volts, we only need to push the digits we got to the front. This is because the DAC works with the most significant bit first, meaning that the most important bites are the front ones. Otherwise we would only get differences in the second or third decimal place. We then split the value into two bytes similar to before, and send them exactly as before.
¹ Funness of colors not guaranteed.