471,850 Members | 1,074 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Reading Wave File Using C++

Could anyone give me idea on how to read a wave and convert in into an integer array file using C++, for now I can successfullly read text file.
Oct 11 '06 #1
2 5109
9,065 Expert Mod 8TB
You will have to open the file in binary mode.

There is a small header which will give the format for the wav file (mono/stero, bits per sample, sample rate etc). After that it's just a long string of binary data that can be read in using fread
Oct 11 '06 #2
This is for example, a small code where i read array in a file. My problem is, i want to read a wave file and convert its binany form to array of integer, Please help....

#include <iostream>
#include <fstream>
using namespace std;

int i(0), array_index(0);
int *p1 = new int[BUFSIZ];
ifstream readfile;

void Read_File(){
while(!readfile.eof()) {
readfile >> p1[array_index];

for(i = 0; i < array_index; i++){
cout<<" "<<p1[i];

int main(int argc, char* argv[]){
delete[] p1;
Oct 13 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by david.kettle | last post: by
1 post views Thread by Jakub Dudek | last post: by
4 posts views Thread by vikram | last post: by
1 post views Thread by Nadie | last post: by
3 posts views Thread by VenuGopal | last post: by
4 posts views Thread by Erpman | last post: by
5 posts views Thread by m.topczewski | last post: by
reply views Thread by YellowAndGreen | last post: by

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.