summaryrefslogtreecommitdiffstats
path: root/Lib/lib-stdwin/Soundogram.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-05-08 17:25:17 (GMT)
committerGuido van Rossum <guido@python.org>2000-05-08 17:25:17 (GMT)
commit813008e506def2e19fdb44a55f9e91e749bc1869 (patch)
tree08d56a938b5136f26b0a7875cff094ac2791b9f1 /Lib/lib-stdwin/Soundogram.py
parente298c3018cf5613aa3d8af4a5cc5652f1659f12b (diff)
downloadcpython-813008e506def2e19fdb44a55f9e91e749bc1869.zip
cpython-813008e506def2e19fdb44a55f9e91e749bc1869.tar.gz
cpython-813008e506def2e19fdb44a55f9e91e749bc1869.tar.bz2
Deleting all stdwin library modules.
Diffstat (limited to 'Lib/lib-stdwin/Soundogram.py')
-rw-r--r--Lib/lib-stdwin/Soundogram.py36
1 files changed, 0 insertions, 36 deletions
diff --git a/Lib/lib-stdwin/Soundogram.py b/Lib/lib-stdwin/Soundogram.py
deleted file mode 100644
index e3c797e..0000000
--- a/Lib/lib-stdwin/Soundogram.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# Module 'Soundogram'
-
-import audio
-from Histogram import Histogram
-
-class Soundogram(Histogram):
- #
- def define(self, win, chunk):
- width, height = corner = win.getwinsize()
- bounds = (0, 0), corner
- self.chunk = chunk
- self.step = (len(chunk)-1)/(width/2+1) + 1
- ydata = _make_ydata(chunk, self.step)
- return Histogram.define(self, (win, bounds, ydata, (0, 128)))
- #
- def setchunk(self, chunk):
- self.chunk = chunk
- self.recompute()
- #
- def recompute(self):
- (left, top), (right, bottom) = self.bounds
- width = right - left
- self.step = (len(chunk)-1)/width + 1
- ydata = _make_ydata(chunk, self.step)
- self.setdata(ydata, (0, 128))
- #
-
-
-def _make_ydata(chunk, step):
- ydata = []
- for i in range(0, len(chunk), step):
- piece = audio.chr2num(chunk[i:i+step])
- mi, ma = min(piece), max(piece)
- y = max(abs(mi), abs(ma))
- ydata.append(y)
- return ydata