นี่คือแพ็คเกจโอเดอร์โอเด็ลโอเดอร์สำหรับ Elevenlabs.io text to Speech API คุณสามารถค้นหาเอกสาร API อย่างเป็นทางการได้ที่นี่: https://api.elevenlabs.io/docs
หากคุณชอบโครงการนี้โปรดพิจารณา นำแสดงโดย ดาวเป็นวิธีที่จะแสดงความชื่นชมและความสนใจในโครงการนี้ และใครจะรู้ฉันอาจมีแนวโน้มที่จะปรับปรุงเพิ่มเติม
ไม่ว่าคุณจะใช้โครงการนี้ได้เรียนรู้บางสิ่งบางอย่างจากมันหรือชอบมันโปรดพิจารณาสนับสนุนด้วยการซื้อกาแฟให้ฉันดังนั้นฉันจึงสามารถอุทิศเวลามากขึ้นในโครงการโอเพนซอร์ซเช่นนี้ :)
| วิธี | พารามิเตอร์ | จุดสิ้นสุด | วิธี http |
|---|---|---|---|
textToSpeech() | voiceId , text , modelId , voiceSettings | /v1/text-to-speech/{voice_id}/stream | โพสต์ |
getModels() | N/A | /v1/models | รับ |
getVoices() | N/A | /v1/voices | รับ |
getDefaultVoiceSettings() | N/A | /v1/voices/settings/default | รับ |
getVoiceSettings() | voiceId | /v1/voices/{voiceId}/settings | รับ |
getVoice() | voiceId , withSettings | /v1/voices/{voiceId} | รับ |
deleteVoice() | voiceId | /v1/voices/{voiceId} | ลบ |
editVoiceSettings() | voiceId , voiceSettings | /v1/voices/{voiceId}/settings/edit | โพสต์ |
getUserSubscription() | N/A | /v1/user/subscription | รับ |
getUser() | N/A | /v1/user | รับ |
| พารามิเตอร์ | พิมพ์ | คำอธิบาย | ที่จำเป็น | ค่าเริ่มต้น |
|---|---|---|---|---|
| เป็นเสียง | สาย | ID ของเสียงที่จะใช้ คุณสามารถรับรายการเสียงที่มีอยู่โดยใช้ getVoices() | ใช่ | N/A |
| ข้อความ | สาย | ข้อความที่จะแปลงเป็นคำพูด | ใช่ | N/A |
| แบบจำลอง | สาย | ID ของโมเดลที่จะใช้ คุณสามารถรับรายการรุ่นที่มีอยู่โดยใช้ getModels() | เลขที่ | eleven_multilingual_v2 |
| การตั้งค่าเสียง | วัตถุ | การตั้งค่าที่จะใช้สำหรับเสียง | เลขที่ | {stability: 0.95, similarity_boost: 0.75, style: 0.06, use_speaker_boost: true} |
| พารามิเตอร์ | พิมพ์ | คำอธิบาย | ค่าเริ่มต้น |
|---|---|---|---|
| ความมั่นคง | ลอย | ความมั่นคงของเสียง | 0.95 |
| ความคล้ายคลึงกัน _boost | ลอย | ความคล้ายคลึงกันช่วยเพิ่มเสียง | 0.75 |
| สไตล์ | ลอย | สไตล์ของเสียง | 0.06 |
| use_speaker_boost | บูลีน | ไม่ว่าจะใช้การเพิ่มลำโพงหรือไม่ | จริง |
npm i elevenlabs-jsconst elevenLabs = require('elevenlabs-js')elevenLabs.setApiKey('YOUR_API_KEY')สร้างไฟล์ข้อความเสียงพูด คุณสามารถบันทึกไฟล์หรือรับท่อและทำทุกอย่างที่คุณต้องการ
const elevenLabs = require ( 'elevenlabs-js' ) ;
const fs = require ( "fs" ) ;
// Set your API key
elevenLabs . setApiKey ( 'YOUR_API_KEY' ) ;
elevenLabs . textToSpeech ( "YOUR_VOICE_ID" , "Hello World!" , "elevenlabs_multilingual_v2" , {
stability : 0.95 ,
similarity_boost : 0.75 ,
style : 0.06 ,
use_speaker_boost : true
} ) . then ( async ( res ) => {
// You can save the file
await res . saveFile ( "test.mp3" )
// Or get the pipe and do whatever you want with it (like streaming it to the client)
const pipe = await res . pipe ;
pipe ( fs . createWriteStream ( "test-with-pipe.mp3" ) ) ;
} ) ;รับรายการรุ่นที่มีอยู่
const elevenLabs = require ( 'elevenlabs-js' ) ;
// Set your API key
elevenLabs . setApiKey ( 'YOUR_API_KEY' ) ;
elevenLabs . getModels ( ) . then ( ( res ) => {
console . log ( "models" , res ) ;
} ) ;รับรายการเสียงที่มีอยู่
const elevenLabs = require ( 'elevenlabs-js' ) ;
// Set your API key
elevenLabs . setApiKey ( 'YOUR_API_KEY' ) ;
elevenLabs . getVoices ( ) . then ( ( res ) => {
console . log ( "voices" , res ) ;
} ) ;รับการตั้งค่าเสียงเริ่มต้น
const elevenLabs = require ( 'elevenlabs-js' ) ;
// Set your API key
elevenLabs . setApiKey ( 'YOUR_API_KEY' ) ;
elevenLabs . getDefaultVoiceSettings ( ) . then ( ( res ) => {
console . log ( "default voice settings" , res ) ;
} ) ;รับการตั้งค่าเสียงของเสียง
const elevenLabs = require ( 'elevenlabs-js' ) ;
// Set your API key
elevenLabs . setApiKey ( 'YOUR_API_KEY' ) ;
elevenLabs . getVoiceSettings ( "YOUR_VOICE_ID" ) . then ( ( res ) => {
console . log ( "voice settings" , res ) ;
} ) ;รับเสียง
const elevenLabs = require ( 'elevenlabs-js' ) ;
// Set your API key
elevenLabs . setApiKey ( 'YOUR_API_KEY' ) ;
elevenLabs . getVoice ( "YOUR_VOICE_ID" ) . then ( ( res ) => {
console . log ( "voice" , res ) ;
} ) ;ลบเสียง
const elevenLabs = require ( 'elevenlabs-js' ) ;
// Set your API key
elevenLabs . setApiKey ( 'YOUR_API_KEY' ) ;
elevenLabs . deleteVoice ( "YOUR_VOICE_ID" ) . then ( ( res ) => {
console . log ( "voice" , res ) ;
} ) ;แก้ไขการตั้งค่าเสียงของเสียง
const elevenLabs = require ( 'elevenlabs-js' ) ;
// Set your API key
elevenLabs . setApiKey ( 'YOUR_API_KEY' ) ;
elevenLabs . editVoiceSettings ( "YOUR_VOICE_ID" , {
stability : 0.95 ,
similarity_boost : 0.75 ,
style : 0.06 ,
use_speaker_boost : true
} ) . then ( ( res ) => {
console . log ( "voice settings" , res ) ;
} ) ;รับข้อมูลการสมัครสมาชิกผู้ใช้
const elevenLabs = require ( 'elevenlabs-js' ) ;
// Set your API key
elevenLabs . setApiKey ( 'YOUR_API_KEY' ) ;
elevenLabs . getUserSubscription ( ) . then ( ( res ) => {
console . log ( "user subscription" , res ) ;
} ) ;รับข้อมูลผู้ใช้
const elevenLabs = require ( 'elevenlabs-js' ) ;
// Set your API key
elevenLabs . setApiKey ( 'YOUR_API_KEY' ) ;
elevenLabs . getUser ( ) . then ( ( res ) => {
console . log ( "user" , res ) ;
} ) ; นอกจากนี้คุณสามารถค้นหาภาษาอื่น ๆ ของแพ็คเกจนี้ได้ที่นี่:
โครงการนี้ได้รับใบอนุญาตภายใต้ใบอนุญาต MIT - ดูไฟล์ใบอนุญาตสำหรับรายละเอียด