Hi,
I am using the WaveWriter class of BASS.NET 2.4.6.4 like this:
BassMisc.WaveWriter waveFile = new BassMisc.WaveWriter("C:\\test.wav", mixerStream, true);
// transfer data from old to new
...
waveFile.Write(data, length);
...
waveFile.Close();
However, the resulting file appears to be invalid (another software component does not like it and they have told me that the length specified in the header is invalid). This is the result:
http://cdburnerxp.se/downloads/HeaderIssue.wavNow I don't know anything about WAV file headers, but I used this project
http://www.codeproject.com/KB/audio-video/WaveEdit.aspx to get some details on the file's headers. This program does not like the file as well and crashes apparently because a "fact" header is expected to occur before any data header, though in this case it only seems to be a faulty check for a null reference. That fixed, it analyses the file properly and the file size in the header seems to match the actual file size.
<?xml version="1.0"?>
<WaveFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<maindata>
<FileName>Track-1.wav</FileName>
<sGroupID>RIFF</sGroupID>
<dwFileLength>423406</dwFileLength>
<sRiffType>WAVE</sRiffType>
</maindata>
<format>
<sChunkID>fmt </sChunkID>
<dwChunkSize>18</dwChunkSize>
<wFormatTag>1</wFormatTag>
<wChannels>2</wChannels>
<dwSamplesPerSec>44100</dwSamplesPerSec>
<dwAvgBytesPerSec>176400</dwAvgBytesPerSec>
<wBlockAlign>4</wBlockAlign>
<dwBitsPerSample>16</dwBitsPerSample>
</format>
<data>
<sChunkID>data</sChunkID>
<dwChunkSize>423360</dwChunkSize>
<lFilePosition>46</lFilePosition>
<dwMinLength>0</dwMinLength>
<dSecLength>2.4</dSecLength>
<dwNumSamples>105840</dwNumSamples>
</data>
</WaveFile>
So can anyone tell me whether there is a bug in BASS or an incorrect usage of the class on my side? Or is the file not faulty at all?
Best regards,
Florian