wave.readframes() (or conversion?)
timr at probo.com
Tue Sep 28 08:29:21 CEST 2004
Tim Roberts <timr at probo.com> wrote:
>andrea valle <andrea.valle at unito.it> wrote:
>>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
>>a = wave.open("/test.wav", "w")
>What version of Python are you using?? On my Win32 Python 2.3, writeframes
>accepts only strings, and only after you have set the frame rate, sample
>size, and number of channels.
For those who may be following this at home, Andrea and I had a private
e-mail exchange during which we discovered why HE was able to pass a list
of integers to wave.writeframes, while I got an error saying that it had to
be a string.
Turns out he's using a Mac, which is big-endian. On big-endian systems,
wave.writeframes passes its first parameter to array.array, calls byteswap,
and uses array.tofile to write it out. array.array accepts a list.
- Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-list