# google-cloud-text-to-speech

> Thinkster Math google text to speech compoment.

Latest version **0.3.2** (published 2020-10-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install google-cloud-text-to-speech
pnpm add google-cloud-text-to-speech
yarn add google-cloud-text-to-speech
bun add google-cloud-text-to-speech
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.2 |
| Published | 2020-10-29 |
| First published | 2020-09-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 43.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | ThinksterMath |
| Maintainers | krishnam-thinkster, aviral-thinkster, kiranthinkster, pravin-thinkster |
| Keywords | promise, async, text to speech, Voice |

## Links

- npm: https://www.npmjs.com/package/google-cloud-text-to-speech
- Repository: https://github.com/PrazAs/TextToSpeech
- Homepage: https://github.com/PrazAs/TextToSpeech#readme
- Issues: https://github.com/PrazAs/TextToSpeech/issues
- npm.io page: https://npm.io/package/google-cloud-text-to-speech

## Dependencies (5)

- [react](https://npm.io/package/react.md) ^16.13.1
- [react-dom](https://npm.io/package/react-dom.md) ^16.13.1
- [framer-motion](https://npm.io/package/framer-motion.md) 1.11.0
- [react-scripts](https://npm.io/package/react-scripts.md) 3.4.3
- [styled-components](https://npm.io/package/styled-components.md) 5.1.1

## Alternatives

- [promise-throttle](https://npm.io/package/promise-throttle.md) — 44.2K weekly downloads
- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads

## Recent versions

- 0.3.2 (latest) — 2020-10-29
- 0.3.1 — 2020-10-29
- 0.3.0 — 2020-10-29
- 0.1.11 — 2020-10-28
- 0.1.10 — 2020-10-22
- 0.1.9 — 2020-10-22
- 0.1.8 — 2020-10-21
- 0.1.7 — 2020-10-20
- 0.1.6 — 2020-10-07
- 0.1.5 — 2020-10-07
- 0.1.4 — 2020-10-06
- 0.1.3 — 2020-09-28
- 0.1.2 — 2020-09-28
- 0.1.1 — 2020-09-25

## README

# [google-cloud-text-to-speech: React JS](https://github.com/PrazAs/TextToSpeech)

A simple Google Cloud Text-to-Speech integration for ReactJS

# New Features!
  - Enter the text or state defined text gives voice audio of the entered text.
  - Supports all voices and languages which avilables in cloud text to speech. ([Link](https://cloud.google.com/text-to-speech/docs/voices))

### Tech
* [ReactJs](https://reactjs.org/)  - The component integration and run on the web app.

### Installation
```
npm install google-cloud-text-to-speech --save
```

## Demo

[Try it on CodeSandbox](https://codesandbox.io/s/google-cloud-text-to-speech-1djqj)

## Usage
```javascript
import TextToSpeech from 'google-cloud-text-to-speech';
```

 

## Example Code

```javascript
import React from 'react';
import TextToSpeech from 'google-cloud-text-to-speech';

class App extends React.Component {

  constructor() {
    super();
    this.state = {
      text: 'Enter text to convert in to speech',
      voiceList: [
        { name: 'English (US) Male', value: 'en-US-Wavenet-A' },
        { name: 'English (US) Female', value: 'en-US-Wavenet-E' },
      ],
      defaultVoice: 'en-US-Wavenet-E',
      secretKey: '' // get your google cloud access key to text-to-speech
    }
  }

  render() {
    return (<div>
        <TextToSpeech
          text={this.state.text}
          voiceList={this.state.voiceList}
          defaultVoice={this.state.defaultVoice}
          secretKey={this.state.secretKey}
          showAudioControl={false}
          showSettings={false}
          type="Page"
        >
      </TextToSpeech>
    </div>
  );
  }
}

export default App;

```


## Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| text      | String | Yes | This is the text that will get converted into Audio |
| voiceList | Array | No | If not provided then the feature takes up the default array provided |
| defaultVoice | String | No | If not provided then the feature takes up the default voice provided |
| secretkey | String | Yes | This is the google cloud key required to call the google cloud API |
| showAudioControl | Boolean | Yes | Takes 'false' as default , if 'false' then shows only play/pause, if 'true' shows an audio player |
| type | String | Yes | Takes two values, "Modal" and "Page", "Page" as default, "Page" takes up 50% width while "Modal" takes up 100% width |
| toolTipName | String | No | Button data-tooltip name |
| removeToolTip() | Function | No | To perform operations of tooltip remove |
| stopReadOutPlaying() | Function | no | To manage button play and stop |
| readOutIconStyle | String | no | To add custome css classes |
| buttonIcon | String / Icon | yes | Pass button text Play or pass font icon |
| showSettings | Boolean | Yes | To display custom select voice and adjust voice settings |
| autoPlay | Boolean | Yes | To autoplay the voice once compoment loads|
 
### Adding VoiceList Example
```javascript
voiceList: [
        { name: 'English (US) Male', value: 'en-US-Wavenet-A' },
        { name: 'English (US) Female', value: 'en-US-Wavenet-E' },
      ]
```

### VoiceList Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| name  | String | Yes | This is the name of the voice that shows up in the options for voices, can be changed as per user wants to display |
| value | String | Yes | Actual name of voice type which is called in the google cloud, cannot be other than the given voices |

## Reference

* [Google Cloud Text-to-Speech Documentation](https://cloud.google.com/text-to-speech)
* [github.com/googleapis/nodejs-text-to-speech](https://github.com/googleapis/nodejs-text-to-speech)

License
----

MIT

---
_Source: https://npm.io/package/google-cloud-text-to-speech · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
