使用 System.Speech 将音频文件转换为文本
我希望使用 C# 将通过 Android 手机在 16000 录制的 .wav 文件转换为文本;即 System.Speech 命名空间。我的代码如下所述;
recognizer.SetInputToWaveFile(Server.MapPath("~/spoken.wav"));
recognizer.LoadGrammar(new DictationGrammar());
RecognitionResult result = recognizer.Recognize();
label1.Text = result.Text;
它与示例 .wav“Hello world”文件完美配合。然而,当我在手机上录制一些内容并尝试在电脑上转换时,转换后的文本与我录制的内容相差甚远。有什么方法可以确保音频文件准确转录吗?
I am looking to convert a .wav file recorded through an android phone at 16000 to text using C#; namely the System.Speech namespace. My code is mentioned below;
recognizer.SetInputToWaveFile(Server.MapPath("~/spoken.wav"));
recognizer.LoadGrammar(new DictationGrammar());
RecognitionResult result = recognizer.Recognize();
label1.Text = result.Text;
The is working perfectly with sample .wav "Hello world" file. However when i record something on teh phone and try to convert to on the pc, the converted text is no where close to what i had recoreded. Is there some way to make sure the audio file is transcribed accurately?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
手机的音频文件是以什么格式录制的?文件是否已编码? Microsoft 识别器支持 PCM、ALaw 和 ULaw。确保您以支持的格式进行录制。您可以查看 RecognizerInfo.SupportedAudioFormats 属性 - http://msdn.microsoft.com/en-us/library/system.speech.recognition.recognizerinfo.supportedaudioformats(v=VS.90).aspx 并检查您的格式识别器版本支持。
你听过手机里录制的文件吗?吵吗?听起来清楚吗?确保为识别器提供尽可能最好的声音音频。
由于您使用的是听写语法,我假设您使用的是 Windows 7。您是否尝试过训练识别器?我的理解是听写语法性能可以通过训练来提高,标准的 Windows 7 语音识别训练将有助于其性能 - http://windows.microsoft.com/en-US/windows7/Set-up-Speech-Recognition
StackOverflow 上的其他一些问题也可能会给您一些帮助见解。请参阅良好的语音识别 API 开始。
What format is the phone's audio file recorded in? Is the file encoded? Microsoft recognizer supports PCM, ALaw, and ULaw. Make sure you are recording in a supported format. You can look at the RecognizerInfo.SupportedAudioFormats Property - http://msdn.microsoft.com/en-us/library/system.speech.recognition.recognizerinfo.supportedaudioformats(v=VS.90).aspx and check the formats your recognizer version supports.
Did you listen to the file you recorded on your phone? Is it noisy? Does it sound clear? Make sure you are feeding the recognizer the best sounding audio you can.
Since you are using a Dictation grammar, I'm assuming you're using Windows 7. Have you tried training the recognizer? My understanding is that the dictation grammar performance can be improved by training and that the standard Windows 7 speech recognition training will help its performance - http://windows.microsoft.com/en-US/windows7/Set-up-Speech-Recognition
Some other questions on StackOverflow may also give you some insights. See good Speech recognition API to start.
您可以在这里找到您想要的完整实现细节:
使用 System.Speech 将 WAV 音频转换为文本
Full implementation details for exactly what you want can be found here:
Converting WAV audio to text using System.Speech
或尝试此链接
免费音频转文本软件
or try this link
Audio to text software free