| |
- builtins.object
-
- WaveSynth
class WaveSynth(builtins.object) |
|
WaveSynth(waveform='sine', sustain=0, volume=100)
A WaveSynth generates SoundWaves representing simple tones with
adjustable waveform (sine, triangle, square, and sawtooth), decay
time, and volume. |
|
Methods defined here:
- __init__(self, waveform='sine', sustain=0, volume=100)
- Initialize self. See help(type(self)) for accurate signature.
- set_sustain(self, sustain)
- set amount of sustain
pre: sustain is "half-life" of tone in seconds
post: if sustain is 0, tones will have infinite sustain, otherwise
tones will decay with a half-life equal to sustain.
- set_volume(self, pct)
- set volume as a percentage
pre: 0 <= pct <= 100
post: generated tones will have max amplitude of pct/100
- set_waveform(self, waveform)
- set sythesizer's wave form
pre: waveform in ["sine", "square", "triangle", "sawtooth"]
post: synthesize will use the specified wave function
- synthesize(self, freq, duration)
- generate tone
pre: duration > 0
post: returns a SoundsWave with given frequency and duration (in seconds) with
waveform, sustain, and volume as previously set.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |