Socket
Socket
Sign inDemoInstall

tts-loader

Package Overview
Dependencies
104
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    tts-loader

Webpack loader for text-to-speech


Version published
Maintainers
1
Install size
4.42 MB
Created

Readme

Source

tts-loader

Very basic Webpack loader for text-to-speech.

This loader uses text-to-speech functionality to generate audio files with the contents of a passed-in text file.

Requirements

This loader currently supports macOS's built-in text-to-speech functionality (on Macs only) and Google's unofficially supported text-to-speech API.

In addition to the standard Webpack requirements, ffmpeg is required. On a Mac, it's easiest installed with Homebrew:

brew install ffmpeg

For other platforms, check out ffmpeg's Downloads page.

Example usage

Assuming you have a file called 'quickbrownfox.txt' with the text you wish to have spoken:

var quickBrownFox = require('tts-loader!quickbrownfox.txt');

That will return a array of file paths that can be used, for example, with Howler:

var foxHowl = new Howl({ src: quickBrownFox });
foxHowl.play();

Currently, the loader outputs the result in MP3 and OGG format.

Configuration

For greater configuration, it's recommended that you use a special naming convention for your text files and use the Webpack config files.

macVoice: A string to define which macOS voice to use. To get a list of the macOS voices on your system, run say -v '?' in Terminal. This defaults to the voice you have selected in your System Preferences.

drivers: An array of drivers to attempt. This defaults to ['mac', 'google'].

Sample configuration

{
    test: /\.speech\.txt$/,
    loader: 'tts-loader',
    query: {
        drivers: ['google', 'mac'],
        macVoice: 'Fiona'
    }
}

License

MIT license. See LICENSE.

FAQs

Last updated on 25 May 2017

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc