> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ja/llms.txt # PlayAI Mastra の PlayAI Voice 実装は、PlayAI API を使用した Text-to-Speech 機能を提供します。 ## 使用例 ```typescript import { PlayAIVoice } from '@mastra/voice-playai' // Initialize with default configuration (uses PLAYAI_API_KEY environment variable and PLAYAI_USER_ID environment variable) const voice = new PlayAIVoice() // Initialize with default configuration const voice = new PlayAIVoice({ speechModel: { name: 'PlayDialog', apiKey: process.env.PLAYAI_API_KEY, userId: process.env.PLAYAI_USER_ID, }, speaker: 'Angelo', // Default voice }) // Convert text to speech with a specific voice const audioStream = await voice.speak('Hello, world!', { speaker: 's3://voice-cloning-zero-shot/b27bc13e-996f-4841-b584-4d35801aea98/original/manifest.json', // Dexter voice }) ``` ## コンストラクターパラメーター **speechModel** (`PlayAIConfig`): Text-to-Speech 機能の設定 (Default: `{ name: 'PlayDialog' }`) **speechModel.name** (`'PlayDialog' | 'Play3.0-mini'`): 使用する PlayAI モデル **speechModel.apiKey** (`string`): PlayAI API キー。未指定の場合は PLAYAI\_API\_KEY 環境変数を使用します **speechModel.userId** (`string`): PlayAI ユーザー ID。未指定の場合は PLAYAI\_USER\_ID 環境変数を使用します **speaker** (`string`): 音声合成に使用するデフォルトの Voice ID (Default: `First available voice ID`) ## メソッド ### `speak()` 設定された音声モデルと Voice を使用してテキストを音声に変換します。 **input** (`string | NodeJS.ReadableStream`): 音声に変換するテキスト。ストリームを指定した場合は、先にテキストへ変換されます。 **options** (`Options`): 設定オプション。 **options.speaker** (`string`): このリクエストでデフォルトの Speaker を上書きします 戻り値:`Promise`。 ### `getSpeakers()` 使用可能な Voice オプションの配列を返します。各要素には次の値が含まれます。 **name** (`string`): Voice 名 **accent** (`string`): Voice のアクセント(例:'US'、'British'、'Australian') **gender** (`'M' | 'F'`): Voice の性別 **age** (`'Young' | 'Middle' | 'Old'`): Voice の年齢カテゴリー **style** (`'Conversational' | 'Narrative'`): Voice の発話スタイル **voiceId** (`string`): Voice の一意な識別子 ### `listen()` このメソッドは PlayAI でサポートされておらず、エラーをスローします。PlayAI は Speech-to-Text 機能を提供しません。 ## 注意事項 - PlayAI の認証には API キーとユーザー ID の両方が必要です - このサービスは、'PlayDialog' と 'Play3.0-mini' の2つのモデルを提供します - 各 Voice には一意な S3 マニフェスト ID があり、API 呼び出しで使用する必要があります