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.

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

Reply via email to