parse midi messages with ALSA sequencer API, and output SPI message to MCP4921 DAC for controlling an analog synthesizer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1.3 KiB

midi_to_cv

parse midi messages with ALSA sequencer API, and output SPI message to
MCP4921 DAC for controlling an analog synthesizer

tested hardware:
raspberry pi Model B or libre computer AML-S905X-CC
(other linux boards with spidev drivers should also work, but the GPIO
pins may be different)
MCP4921 12-bit DAC

NOTE: you'll need to use aconnect or similar to send MIDI messages from a
device to this program. eg)
$ aconnect -l
$ aconnect 128:0 64:0

useful resources:
MIDI:
http://fundamental-code.com/midi/
https://www.alsa-project.org/alsa-doc/alsa-lib/group___sequencer.html
https://soundprogramming.net/file-formats/midi-note-frequencies/

SPI:
https://forums.raspberrypi.com/viewtopic.php?t=304828#p1856388
https://www.kernel.org/doc/html/latest/spi/spidev.html
https://hub.libre.computer/t/how-to-enable-spi-on-aml-s905x-cc-le-potato/285

MCP4921 datasheet:
https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/DataSheets/22248a.pdf


TODO: gate on/off controls, can just use hardware GPIO in digital mode
TODO: add README with wiring instructions for SPI to DAC

TODO: DAC voltage stepping
if we use DAC input 4080 = 5V, then we can do steps of 1/12V on exactly the
correct DAC value. Would then need to set Vref to
DAC: 5V = 4080 / 4095 * Vref, Vref ~= 5.0184