DotNetSpeech门诊叫号系统系列-1.语音叫号 .net c#
2021-03-09 10:29
标签:attribute orm 音量 增加 dex Speak ++ mic tostring 最近收到一个需求,朋友诊室需要做到门诊叫号,流程如下:病人选择医生-刷身份证排队-医生点击病人姓名叫号。 经过团队的努力,一个简易的门诊叫号系统已经完成。现在把各个功能记录下来,方便以后查看。 1.语音叫号 叫号的DLL:DotNetSpeech.dll 测试代码如下: 测试界面如下: 注意事项:采用DotNetSpeech.dll 是不支持64位的,启动的程序要编译为X86,DLL编译需要ANYCPU,很奇怪,这个找不到原因 DotNetSpeech门诊叫号系统系列-1.语音叫号 .net c# 标签:attribute orm 音量 增加 dex Speak ++ mic tostring 原文地址:https://www.cnblogs.com/80028366local/p/12680730.htmlusing
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Windows.Forms;
using
DotNetSpeech;
namespace
voice
{
public
partial
class
Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
///
/// 语音列表
///
List
new
List
private
void
btnSound_Click(
object
sender, EventArgs e)
{
this
.AddVoice(txtVoice1.Text,
int
.Parse(txtVolume1.Text),
int
.Parse(txtRate1.Text));
this
.AddVoice(txtVoice2.Text,
int
.Parse(txtVolume2.Text),
int
.Parse(txtRate2.Text));
for
(
int
i = 0; i
{
try
{
//根据文本叫号
_voice[i].Speak(
this
.txtVoiceText.Text, SpeechVoiceSpeakFlags.SVSFlagsAsync);
}
catch
(Exception ex)
{
txtError.Text = DateTime.Now.ToString() + ex.ToString() +
" "
+ txtError.Text;
}
}
}
///
/// 增加语音库
///
/// 语音库名称
/// 音量
/// 音速
public
void
AddVoice(
string
p_Name,
int
? p_Volume,
int
? p_Rate)
{
try
{
for
(
int
i = 0; i
{
if
(_voice[i].Voice.GetAttribute(
"name"
) == p_Name)
{
_voice[i].Rate = p_Rate ==
null
? -3 : p_Rate.Value;
if
(p_Volume !=
null
) _voice[i].Volume = p_Volume.Value;
return
;
}
}
SpVoice voice =
new
SpVoice();
voice.Voice = voice.GetVoices(
string
.Format(
"name={0}"
, p_Name),
""
).Item(0);
voice.Rate = p_Rate ==
null
? -3 : p_Rate.Value;
if
(p_Volume !=
null
) voice.Volume = p_Volume.Value;
_voice.Add(voice);
}
catch
(Exception ex) {
txtError.Text = DateTime.Now.ToString()+ex.ToString() +
" "
+ txtError.Text;
}
}
}
}
上一篇:node 访问第三方API
文章标题:DotNetSpeech门诊叫号系统系列-1.语音叫号 .net c#
文章链接:http://soscw.com/index.php/essay/62250.html