[sdiy] Fwd: real time FM synthesizer

Dale Marvin dmarv at dop.com
Wed Apr 13 03:26:57 CEST 2016


This is a cross post from the python (programming language) list.
Thought some might enjoy it.

Dale

-------- Forwarded Message --------
Subject: real time FM synthesizer
Date: Wed, 13 Apr 2016 01:22:15 +0200
From: Irmen de Jong <irmen.NOSPAM at xs4all.nl>
To: python-list at python.org
Newsgroups: comp.lang.python

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-widthmodulation), 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.

-- 
https://mail.python.org/mailman/listinfo/python-list






More information about the Synth-diy mailing list