微软SpeechRecognitionEngine
2014-08-27 13:41
459 查看
API官网手册:http://msdn.microsoft.com/zh-cn/library/System.Speech.Recognition.SpeechRecognitionEngine(v=vs.110).aspx
微软语音识别识别率比较低,尤其是话筒不清晰或者音量低的情况下,识别率几乎为0。慎用。
微软、讯飞和google语音识别引擎的对比:
http://fqctyj.blog.163.com/blog/static/70843455201361955322797/
微软语音识别引擎
C# sample代码:
using System;
using System.Speech.Recognition;
using System.IO;
namespace SynchronousRecognition
{
class Program
{
static void Main(string[] args)
{
String textFilePath = null;
int audDevOrFile = -1;
String waveFilePath = null;
if (args.Length < 1)
{
Console.WriteLine("Too less Params: " + args.Length);
return;
}
else if (args.Length > 1)
{
textFilePath = args[0];
audDevOrFile = int.Parse(args[1]); //大于0,是音频文件;0是音频设备
if (audDevOrFile > 0)
{
if (args.Length < 3)
{
Console.WriteLine("please check the param!");
}
else
{
waveFilePath = args[2];
}
}
}
waveFilePath = "F:\\7_.wav";
// Create an in-process speech recognizer for the en-US locale.
using (SpeechRecognitionEngine recognizer =
new SpeechRecognitionEngine(
new System.Globalization.CultureInfo("zh-CN")))
{
// Create and load a dictation grammar.
recognizer.LoadGrammar(new DictationGrammar());
// Configure input to the speech recognizer.
if (audDevOrFile > 0)
{
recognizer.SetInputToWaveFile(waveFilePath);
}
else
{
recognizer.SetInputToDefaultAudioDevice();
}
// Modify the initial silence time-out value.
recognizer.InitialSilenceTimeout = TimeSpan.FromSeconds(500);
// Start synchronous speech recognition.
RecognitionResult result = recognizer.Recognize();
if (result != null)
{
//FileStream fs = new FileStream(textFilePath, FileMode.Open, FileAccess.ReadWrite);
StreamWriter sw = File.CreateText(textFilePath);
//fs.SetLength(0);//首先把文件清空了。
sw.Write(result.Text);//写你的字符串。
sw.Close();
Console.WriteLine("{0}", result.Text);
Console.WriteLine("recognize done!");
}
else
{
Console.WriteLine("No recognition result available.");
}
}
//Console.WriteLine();
//Console.WriteLine("Press any key to continue...");
//Console.ReadKey();
}
}
}
微软语音识别识别率比较低,尤其是话筒不清晰或者音量低的情况下,识别率几乎为0。慎用。
微软、讯飞和google语音识别引擎的对比:
http://fqctyj.blog.163.com/blog/static/70843455201361955322797/
微软语音识别引擎
C# sample代码:
using System;
using System.Speech.Recognition;
using System.IO;
namespace SynchronousRecognition
{
class Program
{
static void Main(string[] args)
{
String textFilePath = null;
int audDevOrFile = -1;
String waveFilePath = null;
if (args.Length < 1)
{
Console.WriteLine("Too less Params: " + args.Length);
return;
}
else if (args.Length > 1)
{
textFilePath = args[0];
audDevOrFile = int.Parse(args[1]); //大于0,是音频文件;0是音频设备
if (audDevOrFile > 0)
{
if (args.Length < 3)
{
Console.WriteLine("please check the param!");
}
else
{
waveFilePath = args[2];
}
}
}
waveFilePath = "F:\\7_.wav";
// Create an in-process speech recognizer for the en-US locale.
using (SpeechRecognitionEngine recognizer =
new SpeechRecognitionEngine(
new System.Globalization.CultureInfo("zh-CN")))
{
// Create and load a dictation grammar.
recognizer.LoadGrammar(new DictationGrammar());
// Configure input to the speech recognizer.
if (audDevOrFile > 0)
{
recognizer.SetInputToWaveFile(waveFilePath);
}
else
{
recognizer.SetInputToDefaultAudioDevice();
}
// Modify the initial silence time-out value.
recognizer.InitialSilenceTimeout = TimeSpan.FromSeconds(500);
// Start synchronous speech recognition.
RecognitionResult result = recognizer.Recognize();
if (result != null)
{
//FileStream fs = new FileStream(textFilePath, FileMode.Open, FileAccess.ReadWrite);
StreamWriter sw = File.CreateText(textFilePath);
//fs.SetLength(0);//首先把文件清空了。
sw.Write(result.Text);//写你的字符串。
sw.Close();
Console.WriteLine("{0}", result.Text);
Console.WriteLine("recognize done!");
}
else
{
Console.WriteLine("No recognition result available.");
}
}
//Console.WriteLine();
//Console.WriteLine("Press any key to continue...");
//Console.ReadKey();
}
}
}
相关文章推荐
- SpeechRecognizer 和 SpeechRecognitionEngine 的区别
- FPGA 17最佳论文导读 ESE: Efficient Speech Recognition Engine with Compressed LSTM on FPGA
- FPGA 17最佳论文导读 ESE: Efficient Speech Recognition Engine with Compressed LSTM on FPGA
- speech recognition resource
- The Kaldi Speech Recognition Toolkit
- DeepSpeech: Accurate Speech Recognition with GPU-Accelerated DeepLearning
- CMUSphinx Wiki--Open Source Toolkit For Speech Recognition
- 微软 MSR Image Recognition Challenge 2016(IRC@ICME) 测试demo
- Google Speech Recognition(ASR)
- Speech Recognition with Hidden Markov Model
- IOS10新特性:Speech Recognition(语音识别)
- Automatic Speech Recognition(ASR) 学习资源
- Google explains how more data means better speech recognition
- 计算机语音技术--在微软Speech平台
- 利用微软Text-To-Speech朗读文本
- Context-Dependent Pre-Trained Deep Neural Networks for Large-Vocabulary Speech Recognition
- CMUSphinx-Open Source Toolkit For Speech Recognition
- 基于HTK中文普通话语音识别DEMO,LilyMandarinSpeechRecognition V1.0
- A simple approach to Speech Recognition - step.1
- 微软近期发布的三个新产品:SL PivotViewer SQL CE 4和Razor View Engine