Custom FM Synth with STM32F031

Hi All,

Couple of months ago I shared my first synth project with Atmel Xmega + onboard DAC in this “[1]”: thread. Oliver’s comments are more than helpful.

I recently moved to a separate environment and tried to implement the Oliver’s ideas on a new project. I used possibly one of the cheapest and smallest I2S and DMA supported STM chips, namely STM32F031. I used this “[2]”: readymade design for the microcontroller breakout board. For the DAC, I choose WM8524. It is also very cheap and low pin count device. I created custom PCB design for this which I’ll share the details later.

At this stage, synth is playable but every parameter is hard-coded which needs to be changed. You can find the sound sample from this “[3]”: link. I used Reaper as DAW and I played the necessary .midi file in that. Then I used ‘hairless-midi’ “[4]”: project for forwarding midi messages to the microcontroller over serial port. Finally I recorded the DAC output directly over external cheap Creative sound card line input.

I’m planning to put a proper analog filter at the output stage as well but haven’t done it yet. Also, microcontroller and the DAC sits on their separate breakout PCBs, I’m going to put them on a single card if everything works out OK.

Source repository:



hi kehribar - good work, the soundcloud example sounds really nice and mellow. Is that without any filter at all?

btw to post, e.g.,
as a hotlink, use quotes and a colon - so type this without the * at each end…


EDIT oh hang on a minute, it took the *'s away. oh well that’s how to stop something hot linking then :slight_smile:

Hi John,

There is only first order (just R-C) lowpass filter at the output of the DAC chip and nothing else.

Also, thanks for the tip. I fixed the formatting and added two images of the setup. :slight_smile:


Hallo Ihsan

Congratulations Its very nice synth project and good sound examples.
Your FM sound ist great, but I can hear little noise in your exampels. Its an recording problem ? How is the intern resultion for the calculation of a sound.

In my Synth project workes an ATxmega prozessor with 32MHz and 12Bit DAC with 8Bit resolution. The dac-noise is old-school :wink:
My sound engine works with an 40KHz timer task without DMA.

Greetings from germany. Rolf

Hi Rolf,

Thanks for the kind words.

Noise is probably caused by the low-quality recording hardware. In this new recording I put 2nd key analog sallen key filter at the DAC outputs and also slightly filtered the recording in the software afterwards. Moreover, I added stereo panning to the synth by having two LFO signals modulating the output with different phase counter offsets. You can check the GitHub for the software update.

All calculations are done with 16bit resolution for each voice and later added without loss of resolution thanks to 24bit DAC.


Yes… nice. The stereo sound is better.

Hi All,

Another update, another sound sample.

I plugged my NP-11 keyboard’s MIDI output to the synth and tried to play it myself rather than using it as a 'hardware VSTi". I’m not truly happy with the final patch and I’m nowhere near a good keyboard player but I’m sharing the sample as is.

In order to be able to play this as an instrument, I had to handle the ‘running status’ in the MIDI receiver code. I also added a second LFO to modulate the signal phase at a constant frequency with its own separate envelope to enrich to sound. Also system adjusts the maximum modulation depth and sound level based on the note’s key volume level.

You can find the latest prototype setup in the attached picture. I annotated the parts of the system.

You can check the GitHub repo for the updated firmware.

Sound sample:


nice. does it do harsh/gritty FM as well?

Hi All,

I’ve published details about this project in a blog post on my website.

In terms of sound synthesis, there is not much news but I created a custom PCB for the whole system and I tried to explain the hardware part.

@bendy_john Can you give me an example of such sound? :slight_smile:


maybe like this at about 11-15sec in

Your work is looking pretty nice and also your FM sound is great.
I think a little noise is there. May be it is a recording problem ?
What is the intern resolution for the calculation of a sound.

A little hard to tell…can parameters be controlled via MIDI?
And where’s the ‘buy’ button?