Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chgasparoto/aws-polly-voices
:package: Helper module to get AWS polly voices in an idiomatic way :baby_chick:
https://github.com/chgasparoto/aws-polly-voices
aws aws-polly
Last synced: about 2 months ago
JSON representation
:package: Helper module to get AWS polly voices in an idiomatic way :baby_chick:
- Host: GitHub
- URL: https://github.com/chgasparoto/aws-polly-voices
- Owner: chgasparoto
- License: mit
- Created: 2019-08-31T13:27:58.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-11-15T11:05:43.000Z (10 months ago)
- Last Synced: 2024-07-21T10:22:26.549Z (2 months ago)
- Topics: aws, aws-polly
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/aws-polly-voices
- Size: 2.1 MB
- Stars: 4
- Watchers: 2
- Forks: 17
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# AWS Polly Voices
A lightweight library to get the VoiceID programmatically without install or call the heavyweight aws-sdk for nodejs. https://docs.aws.amazon.com/polly/latest/dg/voicelist.html
[![travis build](https://img.shields.io/travis/chgasparoto/aws-polly-voices.svg?style=flat-square)](https://travis-ci.org/chgasparoto/aws-polly-voices)
[![codecov coverage](https://img.shields.io/codecov/c/github/chgasparoto/aws-polly-voices.svg?style=flat-square)](https://codecov.io/gh/chgasparoto/aws-polly-voices)
[![version](https://img.shields.io/npm/v/aws-polly-voices.svg?style=flat-square)](https://www.npmjs.com/package/aws-polly-voices)
[![downloads](https://img.shields.io/npm/dt/aws-polly-voices.svg?style=flat-square)](https://www.npmjs.com/package/aws-polly-voices)
[![style](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![quality](https://img.shields.io/lgtm/grade/javascript/g/middyjs/middy.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/chgasparoto/aws-polly-voices/overview/)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square)](https://github.com/chgasparoto/aws-polly-voices/blob/master/LICENSE)## Getting Started
### Prerequisites
```sh
node -v
node: >= v10.23.1
```## Installing
#### Using npm
```sh
npm install --save aws-polly-voices
npm i aws-polly-voices
```#### Using Yarn
```sh
yarn add aws-polly-voices
```## How to use
#### Importing with Commonjs style
```javascript
const Voices = require('aws-polly-voices')
const voices = new Voices()
```#### Importing with ES6 modules style
```javascript
import Voices from 'aws-polly-voices'
const voices = new Voices()
```#### Examples
#### With SINGLE VoiceId
```javascript
const Voices = require('aws-polly-voices')
const voices = new Voices()const brazilianFemaleVoice = voices.brazilian().female()
// Returns the array with the voice(s) data.
// Depending on the selected language this array can have more than one element.
const voiceData = brazilianFemaleVoice.valconsole.log(voiceData)
/**
[{
Gender: 'Female',
Name: 'Vitória',
LanguageName: 'Brazilian Portuguese',
Id: 'Vitoria',
LanguageCode: 'pt-BR'
}]
*/// Get the VoiceId.
// If there is only one element in voiceData array then it will return that voiceId.
// Otherwise it will return a random voiceId based on the criteria (chained methods and/or filters).
// See the next example for clarity.
const voiceId = brazilianFemaleVoice.id // Vitoria
```#### With MULTIPLE VoiceId
```javascript
const Voices = require('aws-polly-voices')
const voices = new Voices()const englishMaleVoices = voices.english().male()
const voiceData = englishMaleVoices.val
console.log(voiceData)
/**
[{
Gender: 'Male',
Name: 'Matthew',
LanguageName: 'US English',
Id: 'Matthew',
LanguageCode: 'en-US'
},
{
Gender: 'Male',
Name: 'Justin',
LanguageName: 'US English',
Id: 'Justin',
LanguageCode: 'en-US'
}]
*/const voiceId = englishMaleVoices.id // random value: [Matthew, Justin]
const matthew = voiceData[0].Id // Matthew
const justin = voiceData[1].Id // Justin
```#### Full API reference
Most of the methods are chainable.```javascript
const Voices = require('aws-polly-voices')
const voices = new Voices()// available languages by name
// this parameter can be: ['Gender', 'Name', 'LanguageName', 'Id', 'LanguageCode']
// defaults to: LanguageName
const allLanguages = voices.languages()// available Voice Id
const allVoicesId = voices.languages('Id')// by language: english
const english = voices.english() || voices.byLang('english')// by language code: nl-NL
const dutch = voices.dutch() || voice.byLangCode('nl-NL')// by gender: male || female
const portuguese = voices.portuguese().male() || voices.brazilian().female()// by voice id
const vitoria = voices.byId('Vitoria')// reseting the filter
voices.reset()
const portuguese = voices.portuguese().male()// Helpers for specific language
const english = voices.english()
const portuguese = voices.portuguese()
const dutch = voices.dutch()
const russian = voices.russian()
const german = voices.german()
const polish = voices.polish()
const italian = voices.italian()
const turkish = voices.turkish()
const spanish = voices.spanish()
const welsh = voices.welsh()
const icelandic = voices.icelandic()
const japanese = voices.japanese()
const norwegian = voices.norwegian()
const swedish = voices.swedish()
const french = voices.french()
const danish = voices.danish()
const arabic = voices.arabic()// Helpers for specific language and country
const american = voice.american()
const americanSpanish = voice.americanSpanish()
const brazilian = voice.brazilian()
const europeanPortuguese = voice.europeanPortuguese()
const british = voices.british()
const mexican = voices.mexican()
const indianEnglish = voices.indian()
const canadianFrench = voices.canadianFrench()
const castilian = voices.castilian()
const welshEnglish = voices.welshEnglish()```
## Running the tests
To run the tests, go to the terminal and enter:
- All tests: `npm run test`
- Watch: `npm run test:watch`## TODO
- [x] 100% unit test coverage
- [x] Documentation (this file)
- [x] CI/CD with `sematinc-release` integrating with `Travis`, `Github` and `NPM registry`
- [ ] Add support for Typescript
- [x] Implement a helper for `Portugal Portuguese`
- [x] Implement a helper for `Welsh English`
- [x] Implement a helper for `Spanish`
- [x] Implement a helper for `US Spanish`
- [x] Implement a helper for `Castilian Spanish`
- [x] Implement a helper for `Mexican Spanish`
- [x] Implement a helper for `Icelandic`
- [x] Implement a helper for `Arabic`
- [ ] Implement a helper for `Chinese Mandarin`
- [x] Implement a helper for `Welsh`
- [x] Implement a helper for `Swedish`
- [x] Implement a helper for `Indian English`
- [x] Implement a helper for `Canadian French`
- [ ] Implement a helper for `Australian English`
- [ ] Implement a helper for `Romanian`
- [x] Implement a helper for `Turkish`
- [x] Implement a helper for `French`
- [x] Implement a helper for `Danish`
- [x] Implement a helper for `Japanese`
- [x] Implement a helper for `Norwegian`
- [ ] Implement a helper for `Korean`
- [x] Implement a helper for `Italian`## Contributing
If you want to collaborate, please feel free. I appreciate any help :)
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
## Versioning
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/chgasparoto/aws-polly-voices/tags).
## Authors
* **Cleber Gasparoto** - [Profile](https://github.com/chgasparoto)
See also the list of [contributors](https://github.com/chgasparoto/aws-polly-voices/contributors) who participated in this project.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.