I want to change the bit rate of wave file.
so I searched in the net and I figure out that the wave file contain a header which is 44 bytes length , and the 25,26,27 and 28 byte are used to store the bit rate of wave file
so I take the wave and store it in an array of byte, then changes the value of bytes that used to store the bit rate of wave.
here is the code :
private int sampleRate;
private byte[] ByteArr;
private MemoryStream ByteMem;
ByteArr = null;
ByteMem = null;
ByteArr = File.ReadAllBytes(pathOfWav.Text);
sampleRate = BitConverter.ToInt32(ByteArr, 24) * 2;
Array.Copy(BitConverter.GetBytes(sampleRate), 0, ByteArr, 24, 4);
ByteMem = new MemoryStream(ByteArr);
here I stored the Wave file location on pathOfWav.Text
which is a textBox, then I stored All the bytes of wave file in ByteArr
then convert the 4 byte (from 25 to 28) to Int32 and multiply it by 2 to Increase the speed of speech and stored the value in sampleRate
after that I modify the previous ByteArr
with the new value of Bit Rate sampleRate
, then I instance a new MemoryStream .
my question is,, how to play the new Wave stream using Naudio ???