simple tts mp3
1.1.0
แพ็คเกจนี้มีสองวิธีในการสร้างไฟล์เสียง MP3 จากข้อความโดยใช้โมดูล Google-TTS-API ซึ่งเข้ากันได้กับ TypeScript ด้วยเช่นกันค้นหาได้ที่ NPM!
ถ้าคุณชอบโปรดทิ้ง ดาว ไว้ที่ GitHub
| วิธี | ตัวเลือก [ไม่บังคับ] | คำอธิบาย |
|---|---|---|
| createAudiofile | ข้อความ, ชื่อไฟล์, [language = 'en'] | สร้างไฟล์เสียง MP3 จากข้อความและส่งคืนเส้นทางสุดท้าย - สัญญา (สตริง) |
| Getaudiobuffer | ข้อความ, [language = '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?' ) ;