Simple Python struct issue

Carlo DiCelico carlo.dicelico at
Fri Oct 2 18:07:47 CEST 2009

I saw an article on O'Reilly about using NumPy and Dislin to analyze
and visualize WAV files. It's a really fantastic article but was a
little out of date. I updated the script to work with the newer
modules &etc but am still having trouble getting it working.

The line

temp[i,:] = array(struct.unpack("%dB"%(fft_length), tempb),Float) -

always returns the same error: "Traceback (most recent call last):
  File "", line 31, in <module>
   temp[i,:] = array(struct.unpack("%dB"%(fft_length),tempb),float) -
struct.error: unpack requires a string argument of length 256" when I
do python test.wav 256

I'm sure it's probably something simple but I just can't see what it

Here's the original code:


More information about the Python-list mailing list