Hello list,

I am trying to draw a graphical representation of a soundfile (a.k.a. waveform) 
onto a Canvas,
however I am not sure where to start.
I have used the SnackCanvas before (http://www.speech.kth.se/snack) and it is 
pretty cool,
however for several reasons I don't want to use the Snack package anymore and I 
wonder how
to achieve something like Snack's create_waveform() method in plain Tkinter.

Just in case you don't know exactly what I am talking about, a short 
description of what
SnackCanvas.create_waveform() does:

When called first on a soundfile, this file is scanned for peak values (which 
takes a while, on my box here
about 70 seconds for a 30 minute wav-file);
the information gained herein is then stored in a so called "shape file" (a 
binary file of unknown format,
which is about 600 kB for a 30 minute wav-file) which makes it very fast to 
load the waveform again later on (about one second).

The item returned by create_waveform() can then be treated like any other 
Canvas item;
especially cool features are, that with camvas.itemconfigure(item, height=...) 
you can stretch
the waveform vertically, and with canvas.itemconfigure(item, 
pixelspersecond=...) you can
"zoom" into the waveform horizontally, which is both pretty fast, too.

Now, trying to get something similar without Snack, I found there are several 
ways to scan the soundfile,
of which the most promising seems to me the audioop.maxpp() method. I tried to 
store the
information I get from audioop.maxpp() in a reasonable amount of time and ended 
with a 700 kB
text file filled with integer values, and there I am stuck.

Does anyone have an idea, if it is possible to put this information together to 
a usable Canvas item,
and if yes, where to go (polygon? image?).
Any ideas are much appreciated.

Thanks in advance.

Michael
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to