AWS Polly 集成 SDK
AWS Polly Integration SDKs
我刚刚看到关于 Amazon Polly text-to-speech service 的公告。我可以在 AWS 控制台中访问该服务,但找不到任何集成点。控制台中没有任何链接可以访问 API/SDK。
v3 documentation for the AWS .NET SDK 也不包含 Polly 的文档。
是否有适用于 .NET 和 Amazon Polly 的 SDK?
你检查过这个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();
}
它returns mp3 编码的音频文件,带有您指定的文本。
我刚刚看到关于 Amazon Polly text-to-speech service 的公告。我可以在 AWS 控制台中访问该服务,但找不到任何集成点。控制台中没有任何链接可以访问 API/SDK。
v3 documentation for the AWS .NET SDK 也不包含 Polly 的文档。
是否有适用于 .NET 和 Amazon Polly 的 SDK?
你检查过这个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();
}
它returns mp3 编码的音频文件,带有您指定的文本。