473,242 Members | 1,570 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,242 software developers and data experts.

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 1914

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...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.