Question about wave.py
ben at co.and.co
ben at co.and.co
Fri Apr 14 12:05:22 EDT 2000
It looks like I'm missing the point, so if somebody could enlighten me?
Read all frames of a *.wav file:
------------------------------------
import wave
w = wave.open('test.wav', rb)
frames = w.readframes(w.getnframes())
# now, we have all frames in ``frames''
# but how are we supposed to handle the individual frames?
# perhaps like this, but...
import array
frames_2 = array.array('h') # assuming 16bit mono
frames_2 = array.fromstring(frames)
print "Frame[100]: %d" % (frames_2[100],)
# ... this works, but now we have 2 copies of all frames :-(
Thanks in advance,
--
ben . de . rydt at pandora . be ------------------ your comments
http://users.pandora.be/bdr/ ------- inl. IPv6, Linux en Pandora
More information about the Python-list
mailing list