simple tts mp3
1.1.0
Este paquete proporciona dos métodos para crear archivos de audio MP3 desde el texto utilizando el módulo Google-TTS-API, también es compatible con TypeScript, ¡busque en NPM!
Si te gusta, deja una estrella en Github
| Método | Opciones [opcional] | Descripción |
|---|---|---|
| createAudiofile | texto, nombre de archivo, [lenguaje = 'en'] | Crea un archivo de audio MP3 desde el texto y devuelve su ruta final - Promise (cadena) |
| getaudiobuffer | texto, [lenguaje = 'en'] | Crea un búfer de audio MP3 de texto y lo devuelve - Promise (buffer) |
ex: ./folder/name ).Consulte el wiki para ver todos los idiomas compatibles con este paquete.
npm install simple-tts-mp3 // 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' ) ; // 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?' ) ;