Virtual analog synthesizer for Python
Branch: master
Clone or download
Latest commit 64dcef6 Dec 2, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs Fix installation of dependencies Nov 27, 2017
example Add Writer class to write wav file Oct 2, 2017
synthesizer
test Fix tests Oct 2, 2017
.gitignore Add package files Oct 1, 2017
.travis.yml
CHANGELOG.md 0.1.4 Dec 2, 2017
LICENSE
README.md Update README.md Nov 27, 2017
requirements.txt Add Synthesizer and Player classes Oct 1, 2017
setup.cfg Add package files Oct 1, 2017
setup.py 0.1.4 Dec 2, 2017

README.md

Python synthesizer Build Status Documentation Status

  • Virtual analog synthesizer.

Installation

$ pip install synthesizer

Install dependencies

Ubuntu

$ apt install portaudio19-dev
$ pip install pyaudio

macOS

$ brew install portaudio
$ pip install pyaudio

Basic usage

Play 440Hz sine wave

>>> from synthesizer import Player, Synthesizer, Waveform


>>> player = Player()
>>> player.open_stream()
>>> synthesizer = Synthesizer(osc1_waveform=Waveform.sine, osc1_volume=1.0, use_osc2=False)
# Play A4
>>> player.play_wave(synthesizer.generate_constant_wave(440.0, 3.0))

Play chord

# Play C major
>>> chord = [261.626,  329.628, 391.996]
>>> player.play_wave(synthesizer.generate_chord(chord, 3.0))

Specify audio device

>>> player.enumerate_device()
# index: 00, name: "Built-in Microphone", rate: 44100
# index: 01, name: "Built-in Output", rate: 44100
# index: 02, name: "UA-25EX 44.1kHz", rate: 44100
>>> player.open_stream(device_name="UA-25EX")

Write wav file

>>> from synthesizer import Writer
>>> writer = Writer()

>>> chord = [261.626,  329.628, 391.996]
>>> wave = synthesizer.generate_chord(chord, 3.0)
>>> writer.write_wave("path/to/your.wav", wave)

Supported OS

  • macOS Sierra
  • Ubuntu 16.04

Supported versions

  • Python 2.7
  • Python 3.4 and above

Author

License

  • GPL v3 License

Links