Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
can someone post code on how to
* merge 2 mono wav files into a single stereo wav file (one file in the left channel one in the right) * append one wav file to another * merge 2 stereo wav files into a single stereo wav file (specifying the "mix" for each channel - the volume for file #1 left and file #2 left, and right, respectively) * save a section of a wav file (starting second, end second) VB.NET code or a .NET assembly would be best for my purposes, but any language would work, all it should be doing that is system-specific would be binary reading / binary writing the data from the WAV file on disk... thanks |
#2
![]() |
|||
|
|||
![]()
Mad Scientist Jr wrote:
The .wav file is just a short 56-byte header, followed by 16-bit samples one after the other. If it is stereo, the samples are interleaved between channels. A 20 or 24 bit wav file will have fullword samples instead of halfword, with the unused bits being zeroed out. But I am assuming 16-bit stuff he * merge 2 mono wav files into a single stereo wav file (one file in the left channel one in the right) Load the first 56 bytes of one file. Change the header byte saying that it's mono and make it stereo (the rfc tell you this) and write it to the o output. Skip the first 56 bytes of the other file. Load a short from one file, write it to the output. Load a short from the other file and write it to the output. Continue until you run out. * append one wav file to another Here you just load the header, dump it unchanged, and then dump the data out, one halfword at a time. Then you discard the header from the second file, and dump the data from that too. * merge 2 stereo wav files into a single stereo wav file (specifying the "mix" for each channel - the volume for file #1 left and file #2 left, and right, respectively) Here you just read a word from each file alternately, multiply by a scaling factor, add and dump. How you decide to deal with rounding is your issue. --scott -- "C'est un Nagra. C'est suisse, et tres, tres precis." |
#4
![]() |
|||
|
|||
![]()
On Thu, 8 Jul 2004 20:49:45 UTC, (Scott Dorsey)
wrote: The .wav file is just a short 56-byte header, followed by 16-bit samples one after the other. Not necessarily. If the file is PCM it could also be 44 bytes. If it isn't PCM, it could be anything. Also, there could be any number of non-audio 'chunks' before the PCM data. You really need to parse the header to accurately get to the data. Start here for info: http://msdn.microsoft.com/archive/de...ive/en-us/dx81 _vb/directx_vb/htm/_dx_reading_wave_files_dxaudio.asp |
#5
![]() |
|||
|
|||
![]()
(Scott Dorsey) wrote in
: The .wav file is just a short 56-byte header, followed by 16-bit samples one after the other. Well... It's usually a RIFF file with audio data, wich means there can be other chunks in there as well as the wave data chunks. Actually, even the audio data can be in a number of different formats, including compressed ones, so before working on a RIFF wave file you should allways check what the actual data format is. Some more info (found by googling): http://www.sonicspot.com/guide/wavefiles.html Regards /Jonas |
#6
![]() |
|||
|
|||
![]()
(Scott Dorsey) wrote in
: The .wav file is just a short 56-byte header, followed by 16-bit samples one after the other. Well... It's usually a RIFF file with audio data, wich means there can be other chunks in there as well as the wave data chunks. Actually, even the audio data can be in a number of different formats, including compressed ones, so before working on a RIFF wave file you should allways check what the actual data format is. Some more info (found by googling): http://www.sonicspot.com/guide/wavefiles.html Regards /Jonas |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Recommended Hard Drive Partitioning for A/V Editing | Pro Audio | |||
Richman's ethical lapses | Audio Opinions |