2012-03-21 110 views
0

我想转换为使用n音讯一个PCM 8位8千赫单声道文件,以DSP TRUESPEECH 1位8千赫单声道,而且我得到以下错误:如何使用PCM音频转换为TRUESPEECH n音讯

第一次机会NAudio.dll中发生类型'NAudio.MmException'异常 AcmNotPossible acmStreamOpen

我明白,可能存在一个我缺少的中间步骤 - 任何见解都将不胜感激。这里是我使用的代码:

 WaveFormat outWaveFormat; 
     outWaveFormat = new TrueSpeechWaveFormat(); 
     Debug.Print("Sample Rate: " + outWaveFormat.SampleRate); //displays "8000" 
     Debug.Print("Bit Rate: " + outWaveFormat.BitsPerSample); //displays "1" 

     FileInfo f = new FileInfo(inputFile); 
     String outputFileName = this.txtDest.Text + @"\" + f.Name; 

     using (WaveFileReader reader = new WaveFileReader(inputFile)) 
     { 
      try 
      { 
       using (WaveStream convertedStream = new WaveFormatConversionStream (outWaveFormat, reader)) 
       { 
        WaveFileWriter.CreateWaveFile(outputFileName, convertedStream); 

       } 
      } 
      catch (Exception ex) 
      { 
       Debug.Print(ex.Message); 
      } 
     } 

回答

0

两个原因这可能发生:

  1. 你没有TRUESPEECH编码器。我认为Windows的新版本不再包含TrueSpeech - 它已经过时了。您可以运行NAudioDemo应用程序以查看机器上的ACM编解码器。

  2. 您的输入格式无法一步转换为目标格式。你确定你的输入是PCM吗。我也希望TrueSpeech编解码器需要16位输入而不是8位。

还有第三个原因,这可能发生,但我不认为这会影响TRUESPEECH,那就是WaveFileWriter.CreateWaveFile假设AverageBytesPerSecond是BlockAlign的整数倍,这并非总是如此。

+0

非常感谢您的回复。我看到DSP Group TrueSpeech编解码器没有显示在可用编解码器列表中。我认为它已经安装好了,但我想我所安装的只是读取/播放DSP文件,而不是创建它们?那可能吗?任何想法,我可以获得编码器?我做了几次网络搜索,并没有提供任何内容。 – user1284603 2012-03-27 18:08:52