real time FM synthesizer

jkn jkn_gg at nicorp.f9.co.uk
Wed Apr 13 04:41:20 EDT 2016


Hi Irmen

On Wednesday, April 13, 2016 at 12:22:25 AM UTC+1, Irmen de Jong wrote:
> It seems that Python is fast enough [1] to create a real time FM music synthesizer
> (think Yamaha DX-7). I made one that you can see here:
>   https://github.com/irmen/synthesizer
> 
> The synthesizer can create various waveforms (sine, sawtooth, pulse etc.) and lets you
> modify them in various ways. You can apply FM (frequency modulation), PWM (pulse-width
> modulation), volume envelopes, vibrato, and reverb/echo. It is primarily based around
> oscillators that are represented as generator functions in the code.
> A GUI is provided that gives access to most of the features interactively, and lets you
> play a tune with your created FM instrument on a piano keyboard.
> 
> You will need Python 3.x and pyaudio to be able to hear sound, and matplotlib if you
> want to see graphical diagrams of generated waveforms.
> 
> I can't create nice music myself but this was a fun project to build and to learn how FM
> synthesizers work internally :)
> 
> 
> 
> Irmen
> 
> 
> [1]: meaning it can generate and play fairly complex waveforms based on multiple
> oscillators and filters in real time in one 44.1 kHz audio channel. That is on a 3.2 ghz
> machine.  With enough oscillator/filters combined however it starts to stutter and
> cannot do it anymore in real time. However you can still generate those waveforms and
> save them to a .wav on disk to play afterwards.  The code only uses one CPU core though
> so maybe there's room for improvement.

This looks fantastic - I am sure I can have a lot of fun with this. Thanks for publicising.

    Regards
    Jon N



More information about the Python-list mailing list