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

txt2audio

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

txt2audio

A small lib to convert text strings to audio files (mp3 & ogg) using Google Text to Speech api.

  • 1.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11
increased by120%
Maintainers
1
Weekly downloads
 
Created
Source

txt2audio

A small lib to convert text strings to audio files (mp3 & ogg) using Google Text to Speech api.

License: MIT

It uses:

  • Node.js
  • Google Text to Speech Api
  • MP3
  • Ogg Vorbis

Important!

To use Google Text to Speech Api you should, first, enable the api and set up an authentication method. You can read more here.

Installation

npm install txt2audio

How to use it

const Txt2Audio = require('txt2audio')

Then you should declare an object with the options you need.

const path = require('path')

let txt2audio = Txt2Audio({
  text: 'Fuck corona virus',
  filename: 'fck-corona',
  path: path.resolve(__dirname, 'audio'),
  languageCode: 'en-US',
  gender: 'female',
  ogg: true,
  debug: true
})

The Txt2Audio will return another function, generateAudio, which will generate the audio files and save them in the given path.

txt2audio.generateAudio()

Options

ArgumentTypeDefaultDescription
textstringtext from which the audio file will be generated
filenamestringname of the generated file
pathstringfolder where the file will be saved
languageCodestringen-USset the language for the api
genderstringfemalemale or female
oggboolfalsegenerate ogg version from the audio file
debugboolfalseprints the request object in the terminal

You can find a list of languageCode and gender in the Google Text to Speech Api documentation.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Author

Gustavo Cardoso
Gustavo Cardoso

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Keywords

FAQs

Package last updated on 20 Dec 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