当前位置:网站首页>Text to speech small software
Text to speech small software
2022-06-11 19:54:00 【XiaOy's blog】
The function of converting text into speech is very common , If you don't pursue voice individuality , It only needs a few lines of code to realize .

download
Code , Quote in the project
using System.Speech.Synthesis;
- 1.
Four lines of code to achieve speaking :
using (SpeechSynthesizer voice = new SpeechSynthesizer())
{
voice.Rate = 1;
voice.Volume = 100;
voice.Speak(" Small y Design ");
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
Encapsulate the :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Speech.Synthesis;
using System.Text;
using System.Threading.Tasks;
namespace SpeakHello
{
public class SoundHelper
{
/// <summary>
/// Default volume [0,100]
/// </summary>
public static int DefaultVolume = 100;
/// <summary>
/// Default sonic speed [-10,10]
/// </summary>
public static int DefaultRate = 1;
public static void Speak(string msg)
{
Speak(msg, DefaultRate, DefaultVolume);
}
/// <summary>
/// Broadcast voice
/// </summary>
/// <param name="msg"> Content </param>
/// <param name="rate"> The speed [-10,10]</param>
/// <param name="volume"> The volume [0,100]</param>
public static void Speak(string msg, int rate, int volume)
{
using (SpeechSynthesizer voice = new SpeechSynthesizer())
{
voice.Rate = rate;
voice.Volume = volume;
voice.Speak(msg);
}
}
}
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
Expand the :
In addition to the default Anna voice , Other sounds can also be installed :Microsoft Mary,Microsoft Mike and Sample TTS Voice
speaker.SelectVoice("Microsoft Mike");
- 1.
System.Speech and Microsoft.Speech Is different , And to avoid confusion , Only one of them should be selected .
about System.Speech
- Go to settings / Region and language / Add language
- From the language settings , Download voice
for example Helen be located en_US In the package . therefore , It should be done by adding English ( The United States ) Language to download other voice .
about Microsoft.Speech
- Download the voice from the link below
- Add pair In the project Microsoft.Speech DLL
You can download it from the link below Microsoft Speech recognition and text to speech engine data files ;
be used for Microsoft Supported languages for speech recognition and text to speech engines https://www.microsoft.com/en-us/download/details.aspx?id=27224
For more information :
Microsoft Voice programming guide
https://docs.microsoft.com/en-us/previous-versions/office/developer/speech-technologies/hh378466(v%3doffice.14)
SpeechSynthesizer.SelectVoice Method
https://docs.microsoft.com/en-us/previous-versions/office/developer/speech-technologies/dd167624(v%3Doffice.14)
System.Speech.Synthesis Namespace
https://docs.microsoft.com/en-us/dotnet/api/system.speech.synthesis?view=netframework-4.7.2
-----------------------------------------------------------------
边栏推荐
- [laravel series 7.5] event system
- Detailed tutorial on installing MySQL database in Linux environment (including uninstallation and password reset process)
- AHB2Standard_handshake_bridge 设计
- 使用flask框架写挡板
- Course design for construction organization, School of distance and continuing education, Dalian University of technology [standard answer]
- Qubicle notes: self set shortcut keys (attached with Lao Wang's self set shortcut key file)
- 2022Redis7.0x版本持久化详细讲解
- Proficient in xmake
- MySQL - Basic select statement
- 秀创意,赢显卡!MMPose姿态估计创意大赛震撼来袭
猜你喜欢

AHB2APB_ Bridge design

YOLOv3 Pytorch代码及原理分析(二):网络结构和 Loss 计算

RTL arbiter design
[help] how can wechat official account articles be opened in an external browser to display the selected messages below?

构建Web应用程序

AHB2Standard_handshake_bridge 设计

POJ 1458 longest common subsequence (dynamic planning exercise)

Chrome tips - browser web page setting coding, solving the problem of web page garbled code, obtaining the latest version of charset plug-in, UTF-8 coding setting

The first bullet of comparative learning

CMU 15 - 445 cours de base de données Leçon 5 version texte - Pool tampon
随机推荐
Hanging memory recursive dynamic programming (with example explanation POJ 1163)
Full list! 2022 Times Asia University Rankings announced!
Calculate the number of 926 in the string to the power of 9260 of 926
ICML 2022 𞓜 rethinking anomaly detection based on structured data: what kind of graph neural network do we need
Experiment report of basic mechanical experiment (II) of School of distance and continuing education, Dalian University of technology [standard answer]
YOLOv3 Pytorch代码及原理分析(二):网络结构和 Loss 计算
Xmake help 2
In unity, opencv and QT are used to create a plugin (I)
Show your creativity and win the graphics card! Mmpose attitude estimation creative contest shocks
MySQL - Basic select statement
Course design for construction organization, School of distance and continuing education, Dalian University of technology [standard answer]
556. 下一个更大元素 III-(31. 下一个排列)-两次遍历
AHB_ Bus_ Matrix_ 3x3 design
Leetcode2027. 转换字符串的最少操作次数(可以,一次过)
MySQL——基本的Select语句
Hospital intelligent infusion management system source code hospital source code
Image transformation torchvision Transforms notes
RTL arbiter design
30讲 线性代数第二讲 矩阵
WR | 西湖大学鞠峰组微纳塑料污染对人工湿地菌群与脱氮功能的影响