elevenlabs js
1.0.0
これは、ElevenLabs.ioテキストからスピーチAPIのオープンソースNodeJSパッケージです。公式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 | 得る |
| パラメーター | タイプ | 説明 | 必須 | デフォルト |
|---|---|---|---|---|
| VoiceId | 弦 | 使用する音声のID。 getVoices()を使用して利用可能な声のリストを取得できます。 | はい | n/a |
| 文章 | 弦 | スピーチに変換するテキスト。 | はい | n/a |
| ModelID | 弦 | 使用するモデルのID。 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')を使用してAPIキーを設定します。テキストからスピーチオーディオファイルを生成します。ファイルを保存するか、パイプを取得して、必要なことは何でも実行できます。
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ライセンスに基づいてライセンスされています。詳細については、ライセンスファイルを参照してください。