Example usage for com.amazonaws.services.polly AmazonPollyClientBuilder standard

List of usage examples for com.amazonaws.services.polly AmazonPollyClientBuilder standard

Introduction

In this page you can find the example usage for com.amazonaws.services.polly AmazonPollyClientBuilder standard.

Prototype

public static AmazonPollyClientBuilder standard() 

Source Link

Usage

From source file:org.openhab.voice.pollytts.internal.cloudapi.PollyTTSCloudImpl.java

License:Open Source License

public PollyTTSCloudImpl(PollyTTSConfig config) {
    this.config = config;

    AWSCredentials credentials = new BasicAWSCredentials(config.getAccessKey(), config.getSecretKey());
    client = AmazonPollyClientBuilder.standard().withRegion(config.getServiceRegion())
            .withCredentials(new AWSStaticCredentialsProvider(credentials)).build();
    voices = client.describeVoices(new DescribeVoicesRequest()).getVoices();

    // create voice to ID translation for service invocation
    labelToID = voices.stream().collect(toMap(Voice::getName, Voice::getId));
}

From source file:org.restcomm.connect.tts.awspolly.AWSPollySpeechSyntetizer.java

License:Open Source License

public AWSPollySpeechSyntetizer(final Configuration configuration) {
    super();//from   ww w  .  jav  a2 s . c o m
    // retrieve polly api credentials
    final String awsAccessKey = configuration.getString("aws-access-key");
    final String awsSecretKey = configuration.getString("aws-secret-key");
    final String awsRegion = configuration.getString("aws-region");

    // Initialize the Amazon Cognito credentials provider.
    AWSCredentials credentials = new BasicAWSCredentials(awsAccessKey, awsSecretKey);
    // Default region
    String region = "eu-west-1";

    //AWS Specific Region
    if ((awsRegion != null) && (!"".equals(awsRegion))) {
        region = awsRegion;
    }

    // Create a client that supports generation of presigned URLs.
    this.pollyClient = (AmazonPollyClient) AmazonPollyClientBuilder.standard()
            .withCredentials(new AWSStaticCredentialsProvider(credentials)).withRegion(region).build();
    //initialize voices list
    men = new HashMap<>();
    women = new HashMap<>();

    load(configuration);
}