From 9430ac1f252f9cbb30a2cabf991e6d07f7a80b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ture=20P=C3=A5lsson?= <ture@turepalsson.se> Date: Tue, 17 Dec 2019 20:27:48 +0100 Subject: [PATCH] Tidy up a bit --- audio.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/audio.py b/audio.py index 0f4450e..3cb0596 100644 --- a/audio.py +++ b/audio.py @@ -23,8 +23,8 @@ def triangle(x): def xsin(x): return math.sin(2 * math.pi * x) -def A(t): - return 16384 * math.exp(-3 * t) +def A(t, level = 16384, decay_rate = 3): + return level * math.exp(-decay_rate * t) def make_frames(k0, n): f = 440 @@ -45,7 +45,6 @@ def callback(in_data, frame_count, time_info, status): current_frame += frame_count return (data, pyaudio.paContinue) -# open stream using callback (3) stream = p.open(format = pyaudio.paInt16, channels = 1, rate = frame_rate, -- GitLab