The 80s were the golden age of synthesizers in pop music. Hugely complicated setups that spared no expense were the norm, with synths capable of recreating anything from pianos and guitars to percussion, strings, and brass. These types of setups aren’t strictly necessary if you’re looking to make music, though, especially in the modern age of accessible microcontrollers. This synthesizer from [Folkert] with MIDI capabilities, for example, creates catchy tunes with only a handful of parts.
This tiny synth is built around an ESP32 and works by generating PWM signals normally meant for LEDs. In this case, the PWM signals are sent through a rudimentary amplifier and then on to an audio output device. That could be a small speaker, an audio jack to another amplifier, or a capture device.
The synth’s eight channels use up most of the ESP32’s I/O and provide a sound that’s reminiscent of the eight-bit video game era. The total parts count for this build is shockingly small with only a handful of resistors, the ESP, an optocoupler, and a few jacks.
For those wishing to experiment with synthesizers, a build like this is attractive because it’s likely that all the parts needed are already sitting around in a drawer somewhere with possibly the exception of the 5 pin DIN jacks needed for MIDI capabilities. Either way, [Folkert] has made all of the schematics available on the project page along with some sample mp3 files. For those looking to use parts from old video game systems sitting in their parts drawer, though, take a look at this synthesizer built out of a Sega Genesis.
Please use the ESP32’s DAC. My ears are still hurting from Chiquitita.
That would be too straight-forward for my liking :-)
I actually like the sound texture, gives the synth some personality.
It gave my eardrums some texture.
That made me chuckle, such a beautiful deadpan response lol
This circuit is basically the second half of a Class D amplifier. A low loss LC filter on the output would reduce the ultrasonic distortion. Relying on the input filtering may save a few components, but isn’t a good way to handle the ultrasonic noise from the PWM.
Also, if this is directly driving a speaker or headphones, the ultrasonic distortion is even worse.
I’m in violent agreement with you! I had good luck with a simple Sallen-Key filter for this purpose: https://hackaday.io/project/184848/log/205013-sallen-key-low-pass-filter-with-single-bjt-emitter-follower
While that is very good circuit, a simple, 2 component, capacitor and inductor filter would better fit the “theme” of this design.
Filtering helps a lot with PWM when the PWM frequency is much higher than the fundamental source frequency and a number of harmonics, until the amplitude of the higher order harmonic is so low that it doesn’t require filtering antway.
This is because a filters performance is measured in dB per octave or dB per decade and when there is a large difference between the fundamental frequency and the PWM frequency then there are many octaves available for filter to have an effect on the PWM but not the original signal.
That however is not the case here.This isn’t even technically PWM. The fundamental(s) themselves are square waves.
So if you use a slope filter like a low pass filter then it is going to have a different effect on the lower frequencies than the higher frequencies.
The lower frequencies will loose a small part of their higher harmonics but would remain mostly the same bright harsh sound you get from a square wave.
The higher frequencies will have most of their harmonics completely truncated and the shape of the fundamental square wave would start to round off giving a softer cleaner tone.
This isn’t really a desirable effect.
To soften the tone of the output across the full octave range of the output equally you need to change the shape of the wave without dependence on it’s frequency.
An op-amp integrator will do this and two stages would be best. each stage can be remixed with the original to adjust it’s effect as desired.
Here is why you only need two stages (though you may be satisfied with one stage) –
A fully integrated square wave becomes a triangle wave (not saw).
A fully integrated triangle wave becomes a sine wave.
A fully integrated sine wave becomes a square wave.
I’m sure this isn’t the most you can do with an ESP32. if you search for “function generator with ESP32”, you’ll find that it can already output sinewaves and trianglewaves. Maybe with enough memory and CPU time you could do a synth that can output arbitrary signals on par with for example the gameboy, or even better.
You can make it sound “better” and do away with the standard resistors just by getting a length of nichrome wire then folding and twisting it into a tree like structure where the branches connect to your digital outputs and the trunk connects to ground at one end and signal out at the other. It is effectively a DIY resistor ladder and you can give it whatever bit depth you like.
Look again at the circuit. It’s not a resistor ladder, it’s an 8 input mixer. Overall, the design forms a very simple, 8 note, polyphonic synth.
Since the PWM channels are being used to directly generate the outputs, this makes sense.
Of course, it is possible to do all the generation and mixing in software, then output via the ESP32’s DAC – or even via a single PWM channel, but then you are trading a lot more software complexity to gain a little more less hardware complexity.
I think this design achieves it’s theme very well. The only improvement I might make would be to add a capacitor and and inductor for a simple LC, low pass filter on the output. Or even just a capacitor if driving a speaker coil (the speaker’s coil is an inductor) directly.
Channel mixing in code is not complex, for one it would be replacing all of the PWM code. Any hooo it seems that somebody missed the point, you don’t need a DAC or even resistors.
Someone did this with an ATTiny85 seven years ago, fitting everything into a MIDI connector. Also sounds better.
https://mitxela.com/projects/midi_on_the_attiny
That project is generating only square waves.
By using high frequency PWM, this project could generate any wave form. This project is basically a sample player. It uses the PWM channels as DACs. What’s lacking in this design is a low pass filter on the output
it’s not the same since it’s only one channel.
DId this on a IMSA Aliar 8800 computer based on the Intel 8080 using the interupt enable ouput pin back in the later 70’s sound just like that but a simple low pass filter will take the edge of it. Neat Project
Nice sounding ESP32 synth without the R2R ladder https://www.youtube.com/watch?v=0gjmHtSexF4