So I finally decided to try making a synthesizer...

...still very much a work in progress.

· 4 min read
So I finally decided to try making a synthesizer...

In a Spring/Summer of continuing pandemic hermiting, with my cannabis growing on pause for the summer (too hot indoors for growing), I have continued my microcontroller pursuits. Apologies for the lack of update here in some time. While much of my previous experimentation and development with microcontrollers has been through ESPHome and the Arduino IDE for home automation purposes, I've found the former limiting and the latter buggy on my non-AVR hardware. I've become more and more interested in resurrecting my C and C++ skills from the dead and tackling native development on my ESP32 and ARM Cortex dev boards.

Alongside some dabbling in CircuitPython recently, I dove into C and C++ development again some months ago with both ESP-IDF (via Visual Studio Code) for the ESP32 chips and MbedOS for the ARM chips. It occured to me only in recent months that, for all my dabbling in circuitry in parallel to being a musician, I hadn't yet attempted to build so much as an oscillator nevermind an instrument. I needed to correct this.

While I could go the analogue route, and certainly may in future, I'm not too fussed about the whole analogue vs. digital debate, and what I have are a bunch of microcontroller development boards at my disposal alongside a desire to fully explore their ins and outs. The Raspberry Pi is certainly a strong candidate for implementation of a synthesizer, and it's been done multiple times over (most notably with Zynthian). Being a Linux distribution, Raspberry Pi OS is very powerful, and a wide range of hardware addon boards ("pi hats") are available both on the market and to build.

While cool, I found myself more interested in seeing what I could do closer to the bare metal with the ESP32 boards I'd previously relegated to Internet-of-Things status. As it happens, the ESP32 has not just one but two on-chip 8-bit Digital-to-Analogue converters (DACs) and the capability to directly interface an external DAC through the Philips I²S protocol. Further, there have been some projects using the ESP32 (through Arduino code). I'm particularly interested in Marcel License's amazing work shown here:

My work is being done in the official Espressif ESP32 SDK (aka: ESP-IDF) rather than the Arduino IDE both in order to properly learn the SDK and to avoid inefficient abstractions. I'm trying to avoid referencing Marcel's code, much as I enjoy the outcome. It'll take me longer this way, but I think I'll learn a lot more in the process than if I were to just borrow from his codebase. I also suspect using a different SDK will yield somewhat different results, which is desirable – if I wanted to perfectly replicate his sound I'd just build and flash his code directly to my boards.

In terms of what features may be desirable for me, truly the sky's the limit; once I have the basics built, there's the possibility of building this synth to perfectly accentuate or complement my musical approaches. I have the following features in mind as desirable outcomes:

  • Small, portable, usb-powered – I'd like this to be a device I can put in my pocket, plug into my laptop or a midi controller, and just go.
  • Midi feature-loaded – similar to the Squarp Hermod, I'd like to leverage the microcontroller not only to turn the midi input into note signals but to be able to insert filters and create midi effects. Particularly, I want there to be many arpeggiator modes, a quantizer and chord mode (similar to Harmonaig), a note filter mode, a harmony mode. There's also potential for this device to be a midi looper, but we'll see how I feel about that later on.
  • Absolutely must end up being compatible with my breath controller. It needn't be the initial state, but so few of my hardware synths will simply allow me to plug in the breath controller and go. This is possibly the most desirable piece, and may in the end necessitate a second project if the direction on this one changes.
  • Polyphonic - I'm still wrapping my head around how this is achieved on a shoestring, but if Marcel can do it I can figure it out I'm sure.
  • Able to be integrated with Eurorack, driven by a DAW, or just plugged right into a midi keyboard.
  • Inexpensive – as synths go, I really want this to be affordable and easy to build on a budget. Light on soldering with no components built specific to this project. Ideally possible for <$100. I also want it to be easily built with substituted parts given the chip shortage and distribution difficulties right now. Fortunately, the ESP32 is easily obtained anywhere in the world, unlike the Raspberry Pi availability right now. I will also make the code open source (MIT or Creative Commons licenses probably).

As of right now, I have the ESP32 able to play a single, continuous note to any of 4 different waveforms to either of its two 8-bit DACs. #nofilter (and also #nomidi #noenvelope #noportamento lol). Starting today I'll be experimenting with external DACs. While I love the 8-bit sound (and this could end up being a chiptune powerhouse), I really want to see what it's capable of at 16 bit stereo or higher resolution).

Taking measurements from the synth via my Digilent Analog Discovery 2

While I haven't yet implemented midi, I'm planning ahead - my C structs should be compatible with how midi expects notes to work, and should be compatible both with mono and polyphonic aftertouch. I've ironed out most of the bugs on how to play waveforms though. I started my work based on the Wave Generator Example provided with ESP-IDF and spent the past few days refactoring it to allow for dynamic frequency and waveform changes as well as multiple oscillators (one per DAC for now).

More to come. For now let me leave you with a photo of the current iteration hooked up to my eurorack.

Related Articles

ESP32 and Home Assistant
· 11 min read
Grow Tent Automation Plans
· 4 min read