> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ja/llms.txt # voice.getSpeakers() `getSpeakers()` メソッドは、Voice Provider から使用可能な Voice オプション(Speaker)の一覧を取得します。アプリケーションはユーザーに Voice の選択肢を提示したり、コンテキストに最適な Voice をプログラムで選択したりできます。 ## 使用例 ```typescript import { OpenAIVoice } from '@mastra/voice-openai' import { ElevenLabsVoice } from '@mastra/voice-elevenlabs' // Initialize voice providers const openaiVoice = new OpenAIVoice() const elevenLabsVoice = new ElevenLabsVoice({ apiKey: process.env.ELEVENLABS_API_KEY, }) // Get available speakers from OpenAI const openaiSpeakers = await openaiVoice.getSpeakers() console.log('OpenAI voices:', openaiSpeakers) // Example output: [{ voiceId: "alloy" }, { voiceId: "echo" }, { voiceId: "fable" }, ...] // Get available speakers from ElevenLabs const elevenLabsSpeakers = await elevenLabsVoice.getSpeakers() console.log('ElevenLabs voices:', elevenLabsSpeakers) // Example output: [{ voiceId: "21m00Tcm4TlvDq8ikWAM", name: "Rachel" }, ...] // Use a specific voice for speech const text = 'Hello, this is a test of different voices.' await openaiVoice.speak(text, { speaker: openaiSpeakers[2].voiceId }) await elevenLabsVoice.speak(text, { speaker: elevenLabsSpeakers[0].voiceId }) ``` ## パラメーター このメソッドはパラメーターを受け取りません。 ## 戻り値 **Promise\>** (`Promise`): Voice オプションの配列に解決する Promise。各オプションには少なくとも voiceId プロパティが含まれ、Provider 固有の追加メタデータが含まれる場合があります。 ## Provider 固有のメタデータ Voice Provider ごとに、Voice について返すメタデータが異なります。 **OpenAI**: **voiceId** (`string`): Voice の一意な識別子(例:'alloy'、'echo'、'fable'、'onyx'、'nova'、'shimmer') **OpenAI Realtime**: **voiceId** (`string`): Voice の一意な識別子(例:'alloy'、'echo'、'fable'、'onyx'、'nova'、'shimmer') **Deepgram**: **voiceId** (`string`): Voice の一意な識別子 **language** (`string`): Voice ID に含まれる言語コード(例:'en') **ElevenLabs**: **voiceId** (`string`): Voice の一意な識別子 **name** (`string`): 人が読める Voice 名 **category** (`string`): Voice のカテゴリー(例:'premade'、'cloned') **Google**: **voiceId** (`string`): Voice の一意な識別子 **languageCodes** (`string[]`): Voice がサポートする言語コードの配列(例:\['en-US']) **Azure**: **voiceId** (`string`): Voice の一意な識別子 **language** (`string`): Voice ID から抽出された言語コード(例:'en') **region** (`string`): Voice ID から抽出されたリージョンコード(例:'US') **Murf**: **voiceId** (`string`): Voice の一意な識別子 **name** (`string`): Voice 名(voiceId と同じ) **language** (`string`): Voice ID から抽出された言語コード(例:'en') **gender** (`string`): Voice の性別(現在の実装では常に 'neutral') **PlayAI**: **voiceId** (`string`): Voice の一意な識別子(manifest.json の S3 URL) **name** (`string`): 人が読める Voice 名(例:'Angelo'、'Arsenio') **accent** (`string`): Voice のアクセント(例:'US'、'Irish'、'US African American') **gender** (`string`): Voice の性別('M' または 'F') **age** (`string`): Voice の年齢カテゴリー(例:'Young'、'Middle') **style** (`string`): Voice の発話スタイル(例:'Conversational') **Speechify**: **voiceId** (`string`): Voice の一意な識別子 **name** (`string`): 人が読める Voice 名 **language** (`string`): Voice の言語コード(例:'en-US') **Sarvam**: **voiceId** (`string`): Voice の一意な識別子 **name** (`string`): 人が読める Voice 名 **language** (`string`): Voice の言語(例:'english'、'hindi') **gender** (`string`): Voice の性別('male' または 'female') ## 注意事項 - 使用可能な Voice は Provider によって大きく異なります - Voice の完全な一覧を取得するために認証が必要な Provider もあります - Provider がこのメソッドをサポートしない場合、デフォルト実装は空の配列を返します - 一覧を頻繁に表示する場合は、パフォーマンスのために結果のキャッシュを検討してください - `voiceId` プロパティはすべての Provider で必ず存在しますが、追加のメタデータは異なります