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

simple-tts-mp3

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

simple-tts-mp3

Converts text to mp3 audio using google-tts-api, it hasn't a limit

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
49
decreased by-37.97%
Maintainers
1
Weekly downloads
 
Created
Source

simple-tts-mp3 package

This package provides two methods to create MP3 audio files from text using the google-tts-api module, it's compatible with TypeScript too, find it on npm!

If you like it, please leave a ⭐ STAR on GitHub

MethodOptions [optional]Description
createAudioFiletext, fileName, [language = 'en']Creates an mp3 audio file from text and returns its final path - Promise (String)
getAudioBuffertext, [language = 'en']Creates an mp3 audio buffer from text and returns it - Promise (Buffer)
  • text - The text to convert to audio.
  • fileName - The name of the audio file to create (can include a relative path, ex: ./folder/name).
  • language - The language of the text (ISO 639-1 code) (optional, default is English - en).

Check the wiki to see all the languages supported by this package.

Installation

npm install simple-tts-mp3

Usage

  • createAudioFile( text, fileName, language = 'en')
// Importing create file method from package
const { createAudioFile } = require('simple-tts-mp3');

// Creates an "output.mp3" audio file with default English text
createAudioFile('Hi, How are you?', 'output');

// Creates an "output.mp3" audio file with Spanish text and promise resolved
createAudioFile('Hola, ¿Cómo estás?', 'output', 'es').then((filepath) => {
    console.log(filepath);
});

// Creates an "output.mp3" audio file with Spanish text inside the "audios" folder and awaits filepath
const filepath = await createAudioFile('Todo bien, gracias', './audios/output', 'es');
  • getAudioBuffer( text, language = 'en')
// Importing create 
const { getAudioBuffer } = require('simple-tts-mp3');

// Creates an MP3 audio buffer with Spanish text and resolves the promise with it
getAudioBuffer('Hola, ¿cómo estás?', 'es')
  .then(buffer => {
    // Do something with the buffer
  });
  
// Creates an MP3 audio buffer with default English text and awaits it
const buffer = await getAudioBuffer('Hi, How are you?');

Keywords

FAQs

Package last updated on 20 Nov 2023

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