Package Exports
- simple-tts-mp3
- simple-tts-mp3/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (simple-tts-mp3) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
simple-tts-mp3 package
This package provides two methods to create MP3 audio files from text using the google-tts-api module, find it on npm!
Method | Options [optional] | Description |
---|---|---|
createAudioFile | text, fileName, [language = 'en'] | Creates an mp3 audio file from text. |
getAudioBuffer | text, [language = 'en'] | 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).
Installation
npm install simple-tts-mp3
Usage
// Importing the package and methods
const { createAudioFile, getAudioBuffer } = require('simple-tts-mp3');
// Create an MP3 audio file with Spanish text
createAudioFile('Hola, ¿cómo estás?', 'hello', 'es');
// Get an MP3 audio buffer with Spanish text
getAudioBuffer('Hola, ¿cómo estás?', 'es')
.then(buffer => {
// Do something with the buffer
});