【发布时间】:2020-04-23 08:58:04
【问题描述】:
我正在使用这个谷歌云文本到语音,就像他们在他们的网站上写的一样。 https://codelabs.developers.google.com/codelabs/cloud-text-speech-csharp/#6)
但是没有关于如何输出 Wavenet 语音 (Ssml) 的详细信息。这个编码输出是正常的声音。
我的问题是,使用此代码,我如何才能接受人类口音(Wavenet 或 Ssml 语音)?
using Google.Cloud.TextToSpeech.V1;
using System;
using System.IO;
namespace TextToSpeechApiDemo
{
class Program
{
static void Main(string[] args)
{
var client = TextToSpeechClient.Create();
// The input to be synthesized, can be provided as text or SSML.
var input = new SynthesisInput
{
**Text = "This is a demonstration of the Google Cloud Text-to-Speech API"
};
// Build the voice request.
var voiceSelection = new VoiceSelectionParams
{
LanguageCode = "en-US",
SsmlGender = SsmlVoiceGender.Female**
};
// Specify the type of audio file.
var audioConfig = new AudioConfig
{
AudioEncoding = AudioEncoding.Mp3
};
// Perform the text-to-speech request.
var response = client.SynthesizeSpeech(input, voiceSelection, audioConfig);
// Write the response to the output file.
using (var output = File.Create("output.mp3"))
{
response.AudioContent.WriteTo(output);
}
Console.WriteLine("Audio content written to file \"output.mp3\"");
}
}
}
【问题讨论】:
-
你好。编码输出是“正常声音”是什么意思?因为您定义了
SsmlGender = SsmlVoiceGender.Female,所以您正在使用 Ssml 声音。 -
''NORMAL VOICES'' 意思是像电脑的声音。
标签: api google-cloud-platform text-to-speech