Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

google-cloud-text-to-speech

Package Overview
Dependencies
Maintainers
4
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-cloud-text-to-speech

Thinkster Math google text to speech compoment.

  • 0.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
605
increased by166.52%
Maintainers
4
Weekly downloads
 
Created
Source

google-cloud-text-to-speech: React JS

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)

Tech

  • ReactJs - The component integration and run on the web app.

Installation

npm install google-cloud-text-to-speech --save

Demo

Try it on CodeSandbox

Usage

import TextToSpeech from 'google-cloud-text-to-speech';

Example Code

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

ParameterTypeRequiredDescription
textStringYesThis is the text that will get converted into Audio
voiceListArrayNoIf not provided then the feature takes up the default array provided
defaultVoiceStringNoIf not provided then the feature takes up the default voice provided
secretkeyStringYesThis is the google cloud key required to call the google cloud API
showAudioControlBooleanYesTakes 'false' as default , if 'false' then shows only play/pause, if 'true' shows an audio player
typeStringYesTakes two values, "Modal" and "Page", "Page" as default, "Page" takes up 50% width while "Modal" takes up 100% width
toolTipNameStringNoButton data-tooltip name
removeToolTip()FunctionNoTo perform operations of tooltip remove
stopReadOutPlaying()FunctionnoTo manage button play and stop
readOutIconStyleStringnoTo add custome css classes
buttonIconString / IconyesPass button text Play or pass font icon
showSettingsBooleanYesTo display custom select voice and adjust voice settings
autoPlayBooleanYesTo autoplay the voice once compoment loads

Adding VoiceList Example

voiceList: [
        { name: 'English (US) Male', value: 'en-US-Wavenet-A' },
        { name: 'English (US) Female', value: 'en-US-Wavenet-E' },
      ]

VoiceList Parameters

ParameterTypeRequiredDescription
nameStringYesThis is the name of the voice that shows up in the options for voices, can be changed as per user wants to display
valueStringYesActual name of voice type which is called in the google cloud, cannot be other than the given voices

Reference

License

MIT

Keywords

FAQs

Package last updated on 29 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc