please help I want to reading .wav file and putting ito inot the array to do some manipulations.... here is the bit of the code, I am trying to read the file called yes1.wav and putting it into the array and it returining junk...sometime cannot open the fp1 = fopen( argv[1], "rb" ) or cannot open it at all

#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
 
 
int *speechyes;
 
 
void main(char argc, char *argv[] )
{
FILE *fp1,*fp3;
 
//if ( argc != 3 )
//{
// printf("differ fileone filetwo\n");
// exit(0);
//}
fp3 = fopen("yes1.wav","w");
 
//fp1 = fopen( argv[1], "rb" );
if(!fp1 )
{
printf("Error opening file %s \n");
}
int k=0;
speechyes = new int[50000];
 
while(fread(&speechyes[k],2,1,fp3)==2)
{
     k++;
}
 
cout<<k<<endl;
for(int i=0;i<5;i++)
{
 
cout<<speechyes[i]<<endl; 
 
}
}

Recommended Answers

All 5 Replies

plz i have a project to convert wav to arrray in visual basic code can you help me please?

If you want to play a .wav file you can use mfc program in vc++
to do so
Make a project in mfc and use some of there API's like
sndPlaySound or PlaySound
The same you can put in an array if you want

i am in need to read details of the wav file....could you suggest any technique to be used in vc++...

i am in need to read details of the wav file....could you suggest any technique to be used in vc++...

1. open a pointer to a file
2. read the bytes till the end of file using fread()
3. close the pointer

1. open a pointer to a file
2. read the bytes till the end of file using fread()
3. close the pointer

I can do you one better:

1. Find a forum that discusses C++.
2. Don't append your question to a 4.5 year old thread.
3. Do some research beforehand and show some effort when posting a question.

Those tips will get better results than most of the advice floating around the interwebs.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.