Building the MIDI sequencer with the Raspberry Pi Pico was a great learning experience and a chance to learn the details and features of the Pico microcontroller.
I thought it would really cool to combine the sequencer with a sound source other than my Reface DX or other MIDI synths, so I embarked on building a Pico based synthesizer. After searching for different ideas, I found a few open source software emulations of the fabled DX7. One in particular that caught my eye was a program called DEXED. It is open source and written in C/C++ which made it an attractive candidate to attempt a port to the Pico. I had no idea if the Pico would be fast enough to run the software but decided build a prototype and give it a try.
So with a minimal number of parts, the Pico Pi, a 12 bit DAC, a MIDI in circuit, a 2-digit 7segment LED and BCD driver, a active low pass filter, I built the circuit and proceeded to port DEXED to the Pico. The point of this project was to see if Pico could run DEXED. I wasn’t too worried about sound quality as long as it was “good enough”.
Well, to my surprise, I was able to get it to work. In fact, I ported the original DX7 ROM into the code and am able to confirm that it indeed sounds like the original DX7! I guess it would be more accurate to call what I created a TF1 clone (one of the modules in the TX816), since the DX7 has a keyboard, touch panel, etc and the TX7 also has and LCD screen with some buttons. The 7segment LED and BCD driver isn’t necessary to make the prototype function correctly but it made it easier to figure out which patch was selected.
However, the prototype isn’t without problems. First, it’s really noisy. It has a low pass filter, but it has a lot of noise and hum. This has a lot to do with the cheap DAC I chose as well as the fact I used the same power source for both digital and analog power references! Of course, this can be remedied with a better design and additional parts but my goal was just to see if the Pico could run a port of DEXED. I figure I can work on cleaning up the audio quality later once I proved that microcontroller could run DEXED.
But the other limitation and probably the biggest problem with the prototype is that the Pico can only handle 2 voice polyphony and that’s after overclocking the Pico to 290Mhz. I have a few ideas on how to fix this.
– Optimize DEXED. I admit I don’t understand the code well enough to try and make it run more efficiently. It might work great on a modern core i7 but the ARM core M0 processor in the Pico even overclocked at 290Mhz cannot cope. But DEXED looks like it already has a lot of optimizations by using trigonometric lookup tables but it does have some 64-bit math and a logarithmic math. However, I am doubtful optimizing those bits would amount to a significant amount of additional polyphony.
– Try to use the second core of the Pico. Since the Pico is a dual core processor, it might be possible to double the polyphony by leveraging the second core on the device. But even so, that would still only amount to 4 voice polyphony. I know that writing low level multi-core code can be tricky so this might be a lot of effort for not a lot of gain.
– Try a different microcontroller with more horsepower. I’ve been looking into the ESP32 whose specs look like it might be sufficient to run DEXED and get 8 voice polyphony or even more.