2016-12-02 1 views

답변

6

이것을 확인한 적이 있습니까? link? 현재 Amazon Polly Developer Guide (pdf/html)에는 python, android, iOS 용 예제가 있습니다. SDK를 설치하면 Polly를 사용할 모든 클래스가 포함 된 C:\Program Files (x86)\AWS SDK for .NET\bin\Net45\AWSSDK.Polly.dll을 찾을 수 있습니다. 여기

난 그냥 연주 한 간단한 예입니다 :

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 인코딩 된 오디오 파일을 반환합니다.