473,466 Members | 1,364 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Question about 'wave' module

Hello Python World!

I've been playing with the 'wave' and 'audioop' modules in the library,
and I have a question. When I tried to read a "wav" file with samples
in 32-bit float, I got the following error:

Traceback (most recent call last):
File "Play.py", line 111, in ?
playWAV(sys.argv[1])
File "Play.py", line 69, in playWAV
f = wave.open(fname,'rb')
File "D:\Python23\lib\wave.py", line 483, in open
return Wave_read(f)
File "D:\Python23\lib\wave.py", line 162, in __init__
self.initfp(f)
File "D:\Python23\lib\wave.py", line 143, in initfp
self._read_fmt_chunk(chunk)
File "D:\Python23\lib\wave.py", line 264, in _read_fmt_chunk
raise Error, 'unknown format: ' + `wFormatTag`
wave.Error: unknown format: 3

Although the documentation doesn't explicitly say so, it appears
that only 16-bit format is supported. I looked at the source code
('wave.py'), and I think my hunch is correct. On lines 245 (in
method 'readframes') and 412 (in method 'writeframesraw'), a call
is made to the array method 'byteswap' if the machine is "big-
endian", without testing to see if the samples are 16-bit or
32-bit. I don't understand how this could work without knowing
how many bytes to "swap", (ie, 2 or 4).

Has anyone on this list used these modules? Am I missing something?
BTW, I'm on version 2.3.2 for Windows. The 32-bit sound file was
created with a program called "Audacity". I believe the format of
the file is a valid wave file format, I'm able to play it with
Windows Media Player.

Thanks for your help.
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .
Jul 19 '05 #1
0 1925

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Eric Woudenberg | last post by:
Hi, I've made small changes to the Python 2.2 wave module to allow ..wav files with ulaw content to be read and written. I'm wondering how to give it back to the Python community, is this something...
2
by: andrea valle | last post by:
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",...
6
by: Xanax | last post by:
Hi all, I need to produce a sine wave and use the WaveOut APi to sound it on my sound card. I also need to compute Fast Fourier Transform to modify the Sine wave. Any ideas on where to start or...
0
by: PickwickBob3 | last post by:
When I use the MakeCall function to make an outgoing phone call. The function listens for a voice on the called phone before passing the process to the next QA control on the page. Is there a way...
4
by: vikram | last post by:
in a stereo type of wave file i want to know what is this left & right info in a wave file??? how do i read the left & right info from a .wav file to a buffer..
5
by: m.topczewski | last post by:
Hello, I'm a beginner in c++, i have to write a program that will take couple of segments from one wave file, and store them in another wave file to be played back later. Here's the code i have...
0
by: Simrat Kaur Sandhu | last post by:
hello friends can anybody tell me how to read data from a wave file.. i have writen code as ... class file { private: FILE *fp; char id; char *sound_buffer; //four bytes to hold 'RIFF' long...
1
by: homevista | last post by:
Part II: Wave file - How to read to a buffer Wave (or Wav) is the standard format for storing audio data on the PC. As software developers, we are interested in the internal structure of the file...
6
by: homevista | last post by:
PART III: Putting things together In part I we examined the modem to verify that it supported voice. If so, we took a note about the voice data format that we would use. In the second part, we...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.