944,209 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 11053
  • C RSS
Apr 22nd, 2006
0

RE: reading .wav file and putting ito inot the array

Expand Post »
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

  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <string.h>
  4. using namespace std;
  5.  
  6.  
  7. int *speechyes;
  8.  
  9.  
  10. void main(char argc, char *argv[] )
  11. {
  12. FILE *fp1,*fp3;
  13.  
  14. //if ( argc != 3 )
  15. //{
  16. // printf("differ fileone filetwo\n");
  17. // exit(0);
  18. //}
  19. fp3 = fopen("yes1.wav","w");
  20.  
  21. //fp1 = fopen( argv[1], "rb" );
  22. if(!fp1 )
  23. {
  24. printf("Error opening file %s \n");
  25. }
  26. int k=0;
  27. speechyes = new int[50000];
  28.  
  29. while(fread(&speechyes[k],2,1,fp3)==2)
  30. {
  31. k++;
  32. }
  33.  
  34. cout<<k<<endl;
  35. for(int i=0;i<5;i++)
  36. {
  37.  
  38. cout<<speechyes[i]<<endl;
  39.  
  40. }
  41. }
Last edited by Dave Sinkula; Apr 23rd, 2006 at 5:36 pm.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
neo2nate is offline Offline
2 posts
since Apr 2006
Oct 27th, 2009
0
Re: RE: reading .wav file and putting ito inot the array
plz i have a project to convert wav to arrray in visual basic code can you help me please?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
blue noah is offline Offline
1 posts
since Oct 2009
Oct 27th, 2009
0
Re: RE: reading .wav file and putting ito inot the array
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
Reputation Points: 34
Solved Threads: 2
Light Poster
ankur_ is offline Offline
38 posts
since Oct 2009
Dec 4th, 2010
0
Re: RE: reading .wav file and putting ito inot the array
i am in need to read details of the wav file....could you suggest any technique to be used in vc++...
Reputation Points: 7
Solved Threads: 1
Newbie Poster
ranjani jai is offline Offline
13 posts
since Dec 2010
Dec 23rd, 2010
0
Re: RE: reading .wav file and putting ito inot the array
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
Reputation Points: 8
Solved Threads: 7
Junior Poster in Training
cool_zephyr is offline Offline
66 posts
since Apr 2009
Dec 23rd, 2010
0
Re: RE: reading .wav file and putting ito inot the array
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.
Reputation Points: 96
Solved Threads: 20
Junior Poster in Training
Trentacle is offline Offline
71 posts
since Dec 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: Play sound files via mciSendString() commands.
Next Thread in C Forum Timeline: User Input: Strings and Numbers [C]





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC