当前位置:网站首页>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
-----------------------------------------------------------------
边栏推荐
- 这些考研专业容易混淆,搞错就白考啦!
- 基于飞桨搭建的多模态学习工具包PaddleMM
- MySQL——基本的Select语句
- [assembly] analysis of Experiment 7 of the fourth edition of assembly language
- These postgraduate entrance examination majors are easy to be confused. If you make a mistake, you will take the exam in vain!
- Flutter doctor 显示xcode没有安装的解决办法
- Experiment report of basic mechanical experiment (II) of School of distance and continuing education, Dalian University of technology [standard answer]
- WR | effect of micro nano plastic pollution in Jufeng formation of West Lake University on microbial flora and nitrogen removal function of Constructed Wetland
- Specific methods for porting WinCC flexible 2008 project to botu WinCC
- Apache APISIX 在Amazon Graviton3 上的安装和性能测试
猜你喜欢

计算926的9260次方里的字符串里有多少个926

ICML 2022 𞓜 rethinking anomaly detection based on structured data: what kind of graph neural network do we need
【求助】请问如何让微信公众号文章在外部浏览器中打开后还能显示下方的精选留言?

何恺明团队的“视频版本MAE”,高效视频预训练!Mask Ratio高达90%时效果也很好!...

Raki's notes on reading paper: learning fast, learning slow: a general continuous learning method

AHB2Standard_ handshake_ Bridge design

The latest test questions and answers for the eight major members (standard members) of Ningxia architecture in 2022

接口隔离原则

AHB_ Bus_ Matrix_ 3x3 design

POJ 1458 longest common subsequence (dynamic planning exercise)
随机推荐
MySQL - Basic select statement
QQ贴吧那种图片一点开,就变了的原理
[laravel series 7.5] event system
Comp3411 -prolog language
3D建模有什么技巧吗?
Experiment report of basic mechanical experiment (II) of School of distance and continuing education, Dalian University of technology [standard answer]
[advanced MySQL] differences among 10 data types and how to optimize the table structure (3)
这些考研专业容易混淆,搞错就白考啦!
Flutter doctor 显示xcode没有安装的解决办法
The latest test questions and answers for the eight major members (standard members) of Ningxia architecture in 2022
Apache APISIX 在Amazon Graviton3 上的安装和性能测试
In unity, opencv and QT are used to create a plugin (I)
MySQL - transaction
Tensorflow---TFRecord文件的创建与读取
Calculate the number of 926 in the string to the power of 9260 of 926
VS2010 cannot open when linking sql2008 database
Merge sort divide and conquer
Unsupervised image classification code analysis notes of scan:learning to classify images without (1): simclr
Image transformation torchvision Transforms notes
Raki's notes on reading paper: learning fast, learning slow: a general continuous learning method