What does the output file sound like?
--Josh
_______________________________________________
SciPy-User mailing list
SciPy...@scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user
That's huge! Nevermind that.
Interestingly enough, I tried messing with the problem using a random
wav file I found from the internet (that plays in vlc just fine) and
got an ugly error. So, I guess I can't help you in this way :S
That said, here's what I would do: First, plot the array that results
from reading the wav file to get an idea of what it looks like. Then,
after you butterworth it up, plot the result of THAT to see what you
have. That could give you an idea as to whether the problem is in the
reading, the butterworthing, the output, or whatever.
Just my $0.02. Good luck!
--Josh
p.s:
If anyone cares about the error I got, here you go:
In [12]: a,b=wavfile.read('viacom2.wav')
Reading fmt chunk
Reading data chunk
Warning: %s chunk not understood
---------------------------------------------------------------------------
error Traceback (most recent call last)
/home/josh/<ipython console> in <module>()
/usr/lib/python2.6/site-packages/scipy/io/wavfile.pyc in read(file)
65 else:
66 print "Warning: %s chunk not understood"
---> 67 size = struct.unpack('I',fid.read(4))[0]
68 bytes = fid.read(size)
69 fid.close()
error: unpack requires a string argument of length 4
The file could be borked for all I know, and maybe this was fixed a
long time ago and my scipy package (probably stock fedora) could be a
bit stale, but the %s bit makes me think that maybe that part wasn't
completely finished? Anyways.
# Read
fs,data = read(infilename)
data = np.float64(data/32768.)
# ... process ...
# Write
write(outfilename, fs, np.int16(data*32768))
--
Christopher Brown, Ph.D.
Associate Research Professor
Department of Speech and Hearing Science
Arizona State University
http://pal.asu.edu
And it is so clever that it handles to apply a filter (with
scipy.signal.lfilter) on each of the columns of the array.
Example
In [2]: import scipy.io.wavfile as wv
In [3]: Fs,Sig = wv.read("STE-023.wav")
Warning: %s chunk not understood
Reading fmt chunk
Reading data chunk
In [4]: Fs
Out[4]: 44100
In [5]: Sig.shape, Sig.dtype
Out[5]: ((4434112, 2), dtype('int16'))
In [6]: import scipy.signal as ss
In [8]: SigFilt = ss.lfilter([1],[1, .1], Sig)
Out[8]:
array([[ 0. , 0. ],
[ 4. , -9.4],
[ 7. , -20.7],
...,
[ 0. , 0. ],
[ 0. , 0. ],
[ 0. , 0. ]])
In [9]: SigFilt.shape, SigFilt.dtype
Out[9]: ((4434112, 2), dtype('float64'))