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

Commit

Permalink
cookbook for aws-polly
Browse files Browse the repository at this point in the history
  • Loading branch information
Andela Developer authored and Andela Developer committed Mar 6, 2018
1 parent d37ac31 commit 4c83ff4
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
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 @@
# Stripe Payment Integration

* 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:

### 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.

0 comments on commit 4c83ff4

Please sign in to comment.