simple tts mp3
1.1.0
이 패키지는 Google-Tts-API 모듈을 사용하여 텍스트에서 MP3 오디오 파일을 만드는 두 가지 방법을 제공합니다. TypeScript 와도 호환되며 NPM에서 찾을 수 있습니다!
당신이 그것을 좋아한다면, Github에 별을 남겨주세요
| 방법 | 옵션 [선택 사항] | 설명 |
|---|---|---|
| Createaudiofile | 텍스트, filename, [language = 'en'] | 텍스트에서 MP3 오디오 파일을 생성하고 최종 경로를 반환합니다 - 약속 (String) |
| getaudiobuffer | 텍스트, [언어 = 'en'] | 텍스트에서 MP3 오디오 버퍼를 생성하고 반환 - 약속 (버퍼) |
ex: ./folder/name ).이 패키지에서 지원되는 모든 언어를 확인하려면 위키에 확인하십시오.
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?' ) ;