Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

cookbook for aws-polly #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions web/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- [Wordpress on Lightsail](/solutions/aws-wordpress)
- [NodeJS on Lightsail](/solutions/aws-node)
- [Ethereum on Lightsail](/solutions/aws-ethereum)
- [Polly](/solutions/aws-polly)
- Payments
- [Stripe](/solutions/stripe-payment)
- Deployment
Expand Down
85 changes: 85 additions & 0 deletions web/solutions/aws-polly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# AWS Polly

* Preparation: **2 minutes**
* Requirements:
* Initiated Syncano project
* AWS ACCESS_KEY_ID
* AWS SECRET_ACCESS_KEY
* Region

### Problem to solve

You want to integrate a service that converts text to speech into application:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/into application:/into your application.


### Solution

Our solution is established using [aws-polly](https://syncano.io/#/sockets/aws-polly) Text-to-Speech (TTS) cloud service that converts text into lifelike speech.

### Installing dependencies

#### Server-side

To install aws-polly, type:

```sh
$ syncano-cli add aws-polly
```

Provide `AWS ACCESS_KEY_ID`, `AWS SECRET_ACCESS_KEY` and `Region`

* N/B: To find `AWS ACCESS_KEY_ID` and `AWS SECRET_ACCESS_KEY`, log into your AWS account to get it.
Also to get `Region`, search for Polly on your AWS Console to check supported regions and select one (e.g, us-east-1 )

Deploy aws-polly to update socket

```sh
$ syncano-cli deploy aws-polly
```

#### Client-side

Install syncano-client to interact with Syncano aws-polly socket:
N/B: There are two way's of achieving installation.

1. When using webpack and es6 the way to handle the client lib is:
Shell:

```sh
$ npm i -S @syncano/client
```

Create a connection by initializing Syncano object with instance name:

```javascript
import SyncanoClient from "@syncano/client"

const s = new SyncanoClient("MY_INSTANCE_NAME");
```

2. And the vanilla js way:
```HTML
<script src="https://unpkg.com/@syncano/client"></script>
<script>
const s = new SyncanoClient("MY_INSTANCE_NAME");
</script>
```

Implement text-to-speech process using aws-polly synthesizeSpeech endpoint:

```javascript

const polly = synthesizeSpeechParams => {
try {
const synthesizeSpeech = s.post("aws-polly/synthesizeSpeech", synthesizeSpeechParams);
(response) => {
return { data: response.data}
}
} catch (error) {
return error.message;
}
};
```

### Testing functionality

Now you can create a text-box collecting text from user and pass on to script file for conversion to speech. On you application, You could decide for your users to download file or listen to speech.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and pass it on to the aws-polly/synthesizeSpeech endpoint. In your application, you could decide if the users can download the file or playback the synthesized speech directly.