====== Eurorack MIDI-CV module ====== ---- dataentry project ---- status_: active oneline: a Teensy-based module to convert USB MIDI input to Eurorack CV and gate signals ---- Accept MIDI input and output Eurorack-compatible CV signals. This project is based around the Teensy platform, as it has a high clock rate and built-in USB MIDI support. ===== Design ===== The module will have 4 CV/gate outs, each of which can be non-exclusively mapped by the user to selected channels. For example, outputs 1 and 2 can both be mapped to MIDI channel 4. ==== Teensy ==== We selected the Teensy platform for its small size, high I/O pin count, and built-in USB MIDI support. The [[https://www.pjrc.com/teensy/td_midi.html|Teensy MIDI library docs]] recommend using callback functions to handle each MIDI event type. For ''NoteOn'' and ''NoteOff'' messages, the callbacks require three parameters: ''channel'', ''note'', and ''velocity'', each a single byte. When a ''NoteOn'' even is received, we scale the note value to the DAC range, write the scaled value to the correct DAC channel(s), and set the gate pin high. On a ''NoteOff'' event, we write 0 to the DAC channel(s) and pull the gate pin low. Internally, we will represent channel mappings as a four-element array of single bytes. This both reduces storage requirements and simplifies channel reassignments (since we don't have to prevent the user from assigning multiple channels to the same output). Since there are only four channels, a series of cascaded ''if''s will determine which output channels receive events. ==== Eurorack voltages ==== Eurorack voltages are generally 10 Vpp, typically 0--10 V for unipolar signals and -5--5 V for bipolar signals. 0--5 V should be sufficient for pitch CV, as that range will grant a 5-octave spread. Gate signals will need to be higher. A gain of around 3 is required to bring the microcontroller's 3.3 V logic up to a usable level. An even better idea would be to use a comparator (with a threshold of 2 V or so) to drive the gate outputs to 10 V. The VCV docs contain a section on [[https://vcvrack.com/manual/VoltageStandards#Pitch-and-Frequencies|converting between frequencies and voltages]] in the 1 V/Oct standard; the basic formula is $f=f_0\cdot 2^V\implies V=\log_2\left(\frac{f}{f_0}\right)$, where $f_0$ is the reference frequency. This should default to C4, or 261.6256 Hz. [[https://newt.phys.unsw.edu.au/jw/notes.html|This page]] includes information on converting note names to frequencies to MIDI notes. Special attention must be paid to the power header. Since we're working with unipolar voltages, we should only need the +12 V line. **Be sure to clearly identify the -12 V side!** {{ https://division-6.com/media/featured-eurorack-power.gif }} ==== DAC ==== **The DAC's reference value should be hardcoded in the firmware as a constant** for note scaling. For an $n$-bit DAC, $V_{ref}=2^n-1$ (e.g., the max value of a 12-bit DAC can be received by writing 4095 to the device). Unfortunately, all the quad DACs I've seen are SMD. ==== User interface ==== ===== Prototyping ===== * Teensy * [[https://www.adafruit.com/product/4470|MCP4728 breakout]] ===== Resources ===== * [[https://github.com/pichenettes/eurorack]]: design files for Mutable Instruments modules; the schematics for [[https://pichenettes.github.io/mutable-instruments-documentation/modules/branches/downloads/branches_v40.pdf|Branches]] and [[https://pichenettes.github.io/mutable-instruments-documentation/modules/yarns/downloads/yarns_v03.pdf|Yarns]] are particularly illustrative for this project * [[https://playground.arduino.cc/Main/InterfacingWithHardware/#ui]] * [[https://code.google.com/archive/p/m2tklib/]] * [[https://github.com/Spirik/GEM]] * [[https://github.com/olikraus/U8g2_Arduino]] {{tag>eurorack electronics midi}}