1
我剛剛遇到有關Amazon Polly text-to-speech service的公告。我能夠訪問AWS控制檯中的服務,但找不到任何集成點。控制檯中沒有任何鏈接可以訪問API/SDK。AWS Polly集成SDK
v3 documentation for the AWS .NET SDK不包含波莉的文檔。
是否有針對.NET的SDK for Amazon Polly?
我剛剛遇到有關Amazon Polly text-to-speech service的公告。我能夠訪問AWS控制檯中的服務,但找不到任何集成點。控制檯中沒有任何鏈接可以訪問API/SDK。AWS Polly集成SDK
v3 documentation for the AWS .NET SDK不包含波莉的文檔。
是否有針對.NET的SDK for Amazon Polly?
您是否覈對過link? 目前,在Amazon Polly開發者指南(pdf/html)中,您可以找到python,android,iOS的示例。安裝SDK後,您可以找到C:\Program Files (x86)\AWS SDK for .NET\bin\Net45\AWSSDK.Polly.dll
,其中包含所有要使用Polly的類。
下面是一個簡單的例子,我剛玩:
public static void Main(string[] args)
{
AmazonPollyClient client = new AmazonPollyClient();
// Create describe voices request.
DescribeVoicesRequest describeVoicesRequest = new DescribeVoicesRequest();
// Synchronously ask Amazon Polly to describe available TTS voices.
DescribeVoicesResponse describeVoicesResult = client.DescribeVoices(describeVoicesRequest);
List<Voice> voices = describeVoicesResult.Voices;
// Create speech synthesis request.
SynthesizeSpeechRequest synthesizeSpeechPresignRequest = new SynthesizeSpeechRequest();
// Text
synthesizeSpeechPresignRequest.Text = "Hello world!";
// Select voice for synthesis.
synthesizeSpeechPresignRequest.VoiceId = voices[0].Id;
// Set format to MP3.
synthesizeSpeechPresignRequest.OutputFormat = OutputFormat.Mp3;
// Get the presigned URL for synthesized speech audio stream.
var presignedSynthesizeSpeechUrl = client.SynthesizeSpeechAsync(synthesizeSpeechPresignRequest).GetAwaiter().GetResult();
using (FileStream output = File.OpenWrite("hello_world.mp3"))
{
presignedSynthesizeSpeechUrl.AudioStream.CopyTo(output);
}
Console.Read();
}
它返回指定文本編碼的MP3音頻文件。