Audio Playback¶
Note
This module requires PortAudio to be installed on your system.
- pytheory.play.sine_wave(hz, peak=4096, n_samples=44100)[source]¶
Compute N samples of a sine wave with given frequency and peak amplitude. Defaults to one second.
- pytheory.play.sawtooth_wave(hz, peak=4096, rising_ramp_width=1, n_samples=44100)[source]¶
Compute N samples of a sine wave with given frequency and peak amplitude. Defaults to one second. rising_ramp_width is the percentage of the ramp spend rising: .5 is a triangle wave with equal rising and falling times.
- pytheory.play.triangle_wave(hz, peak=4096, rising_ramp_width=0.5, n_samples=44100)[source]¶
Compute N samples of a triangle wave with given frequency and peak amplitude. Defaults to one second. rising_ramp_width is the percentage of the ramp spend rising: .5 is a triangle wave with equal rising and falling times.
- class pytheory.play.Synth(new_class_name, /, names, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum- SINE(peak=4096, n_samples=44100)¶
Compute N samples of a sine wave with given frequency and peak amplitude. Defaults to one second.
- SAW(peak=4096, rising_ramp_width=1, n_samples=44100)¶
Compute N samples of a sine wave with given frequency and peak amplitude. Defaults to one second. rising_ramp_width is the percentage of the ramp spend rising: .5 is a triangle wave with equal rising and falling times.
- TRIANGLE(peak=4096, rising_ramp_width=0.5, n_samples=44100)¶
Compute N samples of a triangle wave with given frequency and peak amplitude. Defaults to one second. rising_ramp_width is the percentage of the ramp spend rising: .5 is a triangle wave with equal rising and falling times.