mirror of
https://github.com/kennethreitz/pytheory.git
synced 2026-06-05 23:00:20 +00:00
cleanup
This commit is contained in:
+3
-3
@@ -11,9 +11,6 @@ from .tones import Tone
|
||||
SAMPLE_RATE = 44_100
|
||||
SAMPLE_PEAK = 4_096
|
||||
|
||||
pygame.mixer.pre_init(SAMPLE_RATE, -16, 1)
|
||||
pygame.mixer.init()
|
||||
|
||||
def sine_wave(hz, peak=SAMPLE_PEAK, n_samples=SAMPLE_RATE):
|
||||
"""Compute N samples of a sine wave with given frequency and peak amplitude.
|
||||
Defaults to one second.
|
||||
@@ -51,6 +48,9 @@ class Synth(Enum):
|
||||
|
||||
def play(tone_or_chord, temperament='equal', synth=Synth.SINE, t=1_000):
|
||||
|
||||
pygame.mixer.pre_init(SAMPLE_RATE, -16, 1)
|
||||
pygame.mixer.init()
|
||||
|
||||
if isinstance(tone_or_chord, Tone):
|
||||
chord = [synth(tone_or_chord.pitch(temperament=temperament, symbolic=True))]
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user