هذه حزمة Nodejs مفتوحة المصدر لـ Elevenlabs.io text إلى API للكلام. يمكنك العثور على مستند API الرسمي هنا: https://api.elevenlabs.io/docs
إذا كنت تحب هذا المشروع ، فيرجى التفكير في بطولة ذلك . النجوم هي وسيلة لإظهار التقدير والاهتمام في هذا المشروع. ومن يدري ، قد أكون أكثر ميلًا إلى تحسينه.
سواء كنت تستخدم هذا المشروع ، أو تعلمت شيئًا منه ، أو مثله تمامًا ، يرجى التفكير في دعمه عن طريق شراء قهوة لي ، حتى أتمكن من تكريس المزيد من الوقت في مشاريع مفتوحة المصدر مثل هذا :)
| طريقة | حدود | نقطة النهاية | طريقة HTTP |
|---|---|---|---|
textToSpeech() | voiceId ، text ، modelId ، voiceSettings | /v1/text-to-speech/{voice_id}/stream | بريد |
getModels() | ن/أ | /v1/models | يحصل |
getVoices() | ن/أ | /v1/voices | يحصل |
getDefaultVoiceSettings() | ن/أ | /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() | ن/أ | /v1/user/subscription | يحصل |
getUser() | ن/أ | /v1/user | يحصل |
| المعلمة | يكتب | وصف | مطلوب | تقصير |
|---|---|---|---|---|
| Voiceid | خيط | معرف الصوت للاستخدام. يمكنك الحصول على قائمة بالأصوات المتاحة باستخدام getVoices() . | نعم | ن/أ |
| نص | خيط | النص للتحويل إلى خطاب. | نعم | ن/أ |
| طراز | خيط | معرف النموذج للاستخدام. يمكنك الحصول على قائمة من النماذج المتاحة باستخدام getModels() . | لا | eleven_multilingual_v2 |
| Voicesettings | هدف | الإعدادات لاستخدامها للصوت. | لا | {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-js .const 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 ) ;
} ) ; أيضًا ، يمكنك العثور على اللغات الأخرى لهذه الحزمة هنا:
تم ترخيص هذا المشروع بموجب ترخيص معهد ماساتشوستس للتكنولوجيا - راجع ملف الترخيص للحصول على التفاصيل.