summaryrefslogtreecommitdiffstats
path: root/Lib/stdwin/Soundogram.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-09-09 03:39:21 (GMT)
committerGuido van Rossum <guido@python.org>1997-09-09 03:39:21 (GMT)
commitd7500fcbb4d0257f3bcd0c87d17ee61f3b1545e8 (patch)
treedb4a6e4835e04851df721eb4595d7172d8e05c34 /Lib/stdwin/Soundogram.py
parent045e688f6fc06c87cc93f84e42fb4767a04ba559 (diff)
downloadcpython-d7500fcbb4d0257f3bcd0c87d17ee61f3b1545e8.zip
cpython-d7500fcbb4d0257f3bcd0c87d17ee61f3b1545e8.tar.gz
cpython-d7500fcbb4d0257f3bcd0c87d17ee61f3b1545e8.tar.bz2
These directories renamed: tkinter -> lib-tk, stdwin -> lib-stdwin.
Diffstat (limited to 'Lib/stdwin/Soundogram.py')
-rwxr-xr-xLib/stdwin/Soundogram.py36
1 files changed, 0 insertions, 36 deletions
diff --git a/Lib/stdwin/Soundogram.py b/Lib/stdwin/Soundogram.py
deleted file mode 100755
index e3c797e..0000000
--- a/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