Does any one know how to convert a uncompressed wave file in PCM format to a wav file compressed in GSM 6.10 Audio Codec?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Try How to convert to Gsm Wav file
static void ToWavWithGsm()
{
string fileName = @"e:\Down\male.wav";
WaveReader wr = new WaveReader(File.OpenRead(fileName));
IntPtr format = wr.ReadFormat();
IntPtr formatGsm = AudioCompressionManager.GetCompatibleFormat(format,
AudioCompressionManager.Gsm610FormatTag);
byte[] dataGsm = AudioCompressionManager.ToFormat(wr, formatGsm);
WaveWriter ww = new WaveWriter(File.Create(fileName + ".wav"),
AudioCompressionManager.FormatBytes(formatGsm));
ww.WriteData(dataGsm);
ww.Close();
wr.Close();
}
回答2:
IIRC, if you have the codec installed, naudio should be able to encode with it using WaveFormatConversionStream