Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating .wav files from .raw files

Status
Not open for further replies.

chrishall3

Technical User
Apr 29, 2002
4
IE
Hi all,
not quite a newbie, but confused all the same.
Trying to create my own .wav files from straight .raw format files, ie numbers only.
Got the original part working where I convert .wav to .raw, by stripping the header, and fstream the binary data to the .raw file as ints, but the opposite has left me stuck.
I've tried the reverse, but that didnt work, due to not having the header, but I cant find a simple solution to creating this header in binary.
All I'm going to create are 16khz, mono 8-bit unsigned .wav files, so a generic header might do the trick I think.

Anyone have any ideas??

thanks all,
Chris
 
What is the .raw file? Is that .wav without header? So add simply the header, if you know, what exactly is the format of the data, what is the problem?
 
Hi,
The .raw file, is simply a text file consisting of integers, one a line. I dont know how to calculate the number of samples from this type of file. The header of a wav file holds the size (ie number of samples) so I cant create the header. Does this help?

Thanks,
Chris
 
Then you have to scan input file twice - first calculate count of samples and only after that write the .wav itself.
Another solution - leave count of samples field in the header empty and fill it after all data from .raw file are scanned.
 
Thanks,
but thats the problem I am stuck with: I'm not sure how to calculate the number samples?
Due to the sound being in mono, will it simply be the number of int's in the file?

Thanks again,
Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top