Re: wave.readframes() (or conversion?)
From: Tim Roberts (timr_at_probo.com)
Date: 09/28/04
- Next message: Tim Roberts: "Wiki on Python and Web Programming?"
- Previous message: Dan Perl: "Re: False exceptions?" (was Re: theme of the week: tools"
- In reply to: Tim Roberts: "Re: wave.readframes() (or conversion?)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 27 Sep 2004 23:29:21 -0700
Tim Roberts <timr@probo.com> wrote:
>andrea valle <andrea.valle@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
>>.writeframes(data) methods.
>>
>>a = wave.open("/test.wav", "w")
>>a.writeframes([32000, 0])
>
>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@probo.com Providenza & Boekelheide, Inc.
- Next message: Tim Roberts: "Wiki on Python and Web Programming?"
- Previous message: Dan Perl: "Re: False exceptions?" (was Re: theme of the week: tools"
- In reply to: Tim Roberts: "Re: wave.readframes() (or conversion?)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]