C# 将文本保存为语音到 MP3 文件 [英] C# Save text to speech to MP3 file

查看:36
本文介绍了C# 将文本保存为语音到 MP3 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有办法将文本转语音数据保存为 mp3 或 Wav 文件格式,以便以后播放?

I am wondering if there is a way to save text to speech data to an mp3 or Wav file format to be played back at a later time?

SpeechSynthesizer reader = new SpeechSynthesizer();
reader.Rate = (int)-2;
reader.Speak("Hello this is an example expression from the computers TTS engine in C-Sharp);

我正在尝试将其保存在外部,以便稍后播放.做这个的最好方式是什么?

I am trying to get that saved externally so I can play it back later. What is the best way to do this?

推荐答案

多个选项,例如保存到现有流.如果要创建新的 WAV 文件,可以使用 SetOutputToWaveFile方法.

There are multiple options such as saving to an existing stream. If you want to create a new WAV file, you can use the SetOutputToWaveFile method.

reader.SetOutputToWaveFile(@"C:\MyWavFile.wav");

这篇关于C# 将文本保存为语音到 MP3 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆