This has 2 operating modes and a test mode, that just displays the MIDI note number on the screen.
Mode 1 - Single channel CV/Velocity- This outputs 1 volt per octave and velocity with a gate output. It allows for 'rollover' so if the next key is pressed, the gate stays on but the voltage output changes, release the new key the gate goes off and the previous key does nothing.
Mode 2 - Dual channel CV/Velocity - This outputs 2 channels, there's a 2 byte array that the note is stored in once pressed, if a second key is pressed it goes to the next slot, triggering a second gate and second CV output - useful for a dual oscillaltor synth.
The MIDI note is calculated into a DAC value by the microcontroller, and goes to an MCP4922 SPI dual DAC, 12 bit resolution so more range than trying to filter PWM, which would be 8 bit
8 bit 0 to 255, 12 bit 0 to 4096.. big difference.
At this point we only have 0 to 5 volts, so an op-amp amplifies it by 1.62 giving a 0-7 volt output, I use a TL084, with one being an amp and one a voltage follower to buffer the output.