From a2fcbd523853105cfd0c9038882c4bc6ebc8d457 Mon Sep 17 00:00:00 2001 From: James Tauber Date: Mon, 15 Aug 2011 09:37:32 -0400 Subject: [PATCH] adjusted speaker sample length to allow for leading edge --- applepy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applepy.py b/applepy.py index 769671a..6d1c10f 100644 --- a/applepy.py +++ b/applepy.py @@ -261,7 +261,7 @@ class Display: class Speaker: - CPU_CYCLES_PER_SAMPLE = 70 + CPU_CYCLES_PER_SAMPLE = 60 CHECK_INTERVAL = 1000 def __init__(self): @@ -273,7 +273,7 @@ class Speaker: if self.last_toggle is not None: l = (cycle - self.last_toggle) / Speaker.CPU_CYCLES_PER_SAMPLE self.buffer.extend([0, 0.8] if self.polarity else [0, -0.8]) - self.buffer.extend(l * [0.5] if self.polarity else [-0.5]) + self.buffer.extend((l - 2) * [0.5] if self.polarity else [-0.5]) self.polarity = not self.polarity self.last_toggle = cycle