Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eriknyquist/tones
Pure-python library for generating audio tones, with support for polyphony, pitch-bending and vibrato
https://github.com/eriknyquist/tones
audio audio-synthesis beep beeps digital-signal-processing music music-composition pure-python synthesis tones
Last synced: about 2 months ago
JSON representation
Pure-python library for generating audio tones, with support for polyphony, pitch-bending and vibrato
- Host: GitHub
- URL: https://github.com/eriknyquist/tones
- Owner: eriknyquist
- License: apache-2.0
- Created: 2018-07-29T01:19:54.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-12-01T06:45:09.000Z (almost 4 years ago)
- Last Synced: 2024-07-10T13:09:18.228Z (3 months ago)
- Topics: audio, audio-synthesis, beep, beeps, digital-signal-processing, music, music-composition, pure-python, synthesis, tones
- Language: Python
- Homepage: https://tones.readthedocs.io
- Size: 35.2 KB
- Stars: 17
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
Tones
=====A pure-python module for generating simple tones as audio samples, which can
optionally be written directly to a .wav audio file. Supports pitch-bending,
vibrato, polyphony, several waveform types (sine, square, triangle,
sawtooth), and several other waveform-shaping options.Installation
============Install from the PyPi repository:
::
pip install tones
Example
=======.. code:: python
from tones import SINE_WAVE, SAWTOOTH_WAVE
from tones.mixer import Mixer# Create mixer, set sample rate and amplitude
mixer = Mixer(44100, 0.5)# Create two monophonic tracks that will play simultaneously, and set
# initial values for note attack, decay and vibrato frequency (these can
# be changed again at any time, see documentation for tones.Mixer
mixer.create_track(0, SAWTOOTH_WAVE, vibrato_frequency=7.0, vibrato_variance=30.0, attack=0.01, decay=0.1)
mixer.create_track(1, SINE_WAVE, attack=0.01, decay=0.1)# Add a 1-second tone on track 0, slide pitch from c# to f#)
mixer.add_note(0, note='c#', octave=5, duration=1.0, endnote='f#')# Add a 1-second tone on track 1, slide pitch from f# to g#)
mixer.add_note(1, note='f#', octave=5, duration=1.0, endnote='g#')# Mix all tracks into a single list of samples and write to .wav file
mixer.write_wav('tones.wav')
# Mix all tracks into a single list of samples scaled from 0.0 to 1.0, and
# return the sample list
samples = mixer.mix()Documentation
=============Full API documention is here: ``_