[Tutor] wave.readframes() (or conversion?)

andrea valle andrea.valle at unito.it
Thu Sep 23 12:42:00 CEST 2004


Hi to all,
I'm using wave module with success. I'm writing data to wave file. 
Typically I create a list of values (data) and pass it to 
.writeframes(data) methods.

a = wave.open("/test.wav", "w")
a.writeframes([32000, 0])

This sets the first sample to 32000 and the 2nd to 0

But when I use the .readframes() method I don't know exactly what  
values I extract from the open wave.

 >>> a = wave.open("/test.wav", "r")
 >>> a.readframes(1)
'\x00\x00'

How do I convert it to an integer? I'd like to have it like 32000 or 0, 
so to make some maths on it.

Thanks a lot

-a-

Andrea Valle
Laboratorio multimediale "G. Quazza"
Facoltà di Scienze della Formazione
Università degli Studi di Torino
andrea.valle at unito.it


More information about the Tutor mailing list