473,405 Members | 2,287 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,405 software developers and data experts.

reading wave file data

Hi,
I am trying to read wave date (the 16 bits audio words) from a wave file
using c++. I have tried using the mmsystems library. I got to the point
where I read the wave data chunk into a character array using mmioread.
This array does not make much sense to me however, I don't really understand
the format. Anyone has an idea as to how to extract the 16 bit words from
the character array returned by mmioread?

Alos, any other suggestion as to how to extract wave data (and put it
for example in an array of ints) from a wav file is appreciated

Thanks for your time
Jakub
Jul 19 '05 #1
1 9363
On Tue, 2 Sep 2003 13:56:15 -0500, "Jakub Dudek" <ja*****@yahoo.com>
wrote:
Hi,
I am trying to read wave date (the 16 bits audio words) from a wave file
using c++. I have tried using the mmsystems library. I got to the point
where I read the wave data chunk into a character array using mmioread.
This array does not make much sense to me however, I don't really understand
the format. Anyone has an idea as to how to extract the 16 bit words from
the character array returned by mmioread?
Standard C++ does not include an mmsystems library. You would be better
off posting questions related to it in a newsgroup more closely related
to the compiler or operating system which provides this library.
Alos, any other suggestion as to how to extract wave data (and put it
for example in an array of ints) from a wav file is appreciated


When I needed to do this, years ago, I just found myself a copy of the
..wav spec and wrote my own simple I/O based parser (using only standard
C++ no less). It's basically a matter of understanding the header so
that you know how many bits there are per sample, and whether it is mono
or stereo, and then you just read into your array. My job was a little
easier because I could guarantee that the waves were all in a particular
subset of the spec, but it wouldn't have been much harder to handle the
entire spectrum. It's really a pretty simple format.

--
Greg Schmidt (gr***@trawna.com)
Trawna Publications (http://www.trawna.com/)
Jul 19 '05 #2

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

Similar topics

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",...
0
by: david.kettle | last post by:
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...
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..
1
by: Nadie | last post by:
Greeting list readers, I noticed that the wave read object has an *implementation dependent* setpos(pos) method. When reading audio files, it is useful to be able to set the position to a...
4
by: Erpman | last post by:
I am trying to access the data with in a wav file. I am testing with very small files in order to keep the code simple to start with. Basically, im writing the entire wav file to a byte using a...
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...
3
by: rajasekar.karthik | last post by:
Hi Guys I need a php script which will merge two wave files as i have already done a script which will will join the two wave files and play one after the other, can anyone advice me...
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...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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...

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.