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();
}
}
}

微软SpeechRecognitionEngine的更多相关文章

  1. 一起学微软Power BI系列-使用技巧(5)自定义PowerBI时间日期表

    1.日期函数表作用 经常使用Excel或者PowerBI,Power Pivot做报表,时间日期是一个重要的纬度,加上做一些钻取,时间日期函数表不可避免.所以今天就给大家分享一个自定义的做日期表的方法 ...

  2. 一起学微软Power BI系列-使用技巧(4)Power BI中国版企业环境搭建和帐号问题

    千呼万唤的Power BI中国版终于落地了,相信12月初的微软技术大会之后已经铺天盖地的新闻出现了,不错,Power BI中国版真的来了,但还有些遗憾,国际版的一些重量级服务如power bi emb ...

  3. 2015 西雅图微软总部MVP峰会记录

    2015 西雅图微软总部MVP峰会记录 今年决定参加微软MVP全球峰会,在出发之前本人就已经写这篇博客,希望将本次会议原汁原味奉献给大家 因为这次是本人第一次写会议记录,写得不好的地方希望各位园友见谅 ...

  4. 本人提供微软系.NET技术顾问服务,欢迎企业咨询!

    背景: 1:目前微软系.NET技术高端人才缺少. 2:企业很难直接招到高端技术人才. 3:本人提供.NET技术顾问,保障你的产品或项目在正确的技术方向. 技术顾问服务 硬服务项: 1:提供技术.决策. ...

  5. Connect() 2016 大会的主题 ---微软大法好

    文章首发于微信公众号"dotnet跨平台",欢迎关注,可以扫页面左面的二维码. 今年 Connect 大会的主题是 Big possibilities. Bold technolo ...

  6. 微软发布正式版SQL Server 2016

    微软于今天在SQL 官方博客上宣布 SQL Server 数据库软件的正式发布版本(GA),历时一年多,微软为该软件发布了多个公共预览版和候选版本,而今天最终版本终于上线了.在博客中,微软数据集团的企 ...

  7. 微软.NET Core RC2正式发布,横跨所有平台

    .NET官方博客宣布了<Announcing .NET Core RC2 and .NET Core SDK Preview 1>,正式如期发布了.NET Core RC2, 现在可以放心 ...

  8. 关于微软HttpClient使用,避免踩坑

    最近公司对于WebApi的场景使用也越来越加大了,随之而来就是Api的客户端工具我们使用哪个?我们最常用的估计就是HttpClient,在微软类库中命名空间地址:System.Net.Http,是一个 ...

  9. 微软Azure 经典模式下创建内部负载均衡(ILB)

    微软Azure 经典模式下创建内部负载均衡(ILB) 使用之前一定要注意自己的Azure的模式,老版的为cloud service模式,新版为ARM模式(资源组模式) 本文适用于cloud servi ...

随机推荐

  1. SQL 时间戳转DateTime类型

    最近在工作中通过接口获取时间字段为时间戳的值,直接入库后再页面查询时间格式时候需要通过SQL语句将时间戳格式装换为时间格式进行比较,首先我们需要知道时间戳格式是怎么产生的,: Unix时间戳(Unix ...

  2. linux下svn修改用户名和密码

    1.临时更换,在命令下强制加上 --username 和--password选项, 例如:svn up --username zhangsan --password 123456 svn co URL ...

  3. ArcGis : unable to save as template this document is already based on another template

    原文:http://forums.esri.com/Thread.asp?c=93&f=989&t=289930 ----------------- I ran into this p ...

  4. [Design Pattern] Iterator Pattern 简单案例

    Iterator Pattern,即迭代时模式,按照顺序依次遍历集合内的每一个元素,而不用了解集合的底层实现,属于行为类的设计模式.为了方便理解记忆,我也会称其为遍历模式. 下面是一个迭代器模式的简单 ...

  5. Diamond Armor - The most expensive Suit: 2.8 Mio Swiss Francs

    Diamond Armor - The most expensive Suit: 2.8 Mio Swiss Francs Diamond Armor

  6. Sublime text 3 格式化HTML/css/js/json代码 插件

    JsFormat: 这里下载这插件包 https://github.com/jdc0589/JsFormat ,点油下角的zip就能下载 插件包放到sublime安装目录的Data\Packages目 ...

  7. 标准的数据获取 -ios

    #define kBgQueue dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) #define kLatestKivaL ...

  8. Android开发/源代码资源汇总

    全网最全的Android游戏源代码汇总 mod=viewthread&tid=5080&fromuid=5" target="_blank">htt ...

  9. mount, findmnt,df命令

    ■    The  mount  command gives an overview of all mounted devices. To get this information, the /pro ...

  10. nginx配置学习文章

    partOne 自我释义部分 我的是阿里云的ubuntu *******实际上感觉这里是基本配置,很用不到*********#定义其用户或用户组user www-data;#nginx的进程数,应当为 ...