> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ja/llms.txt # Deepgram Mastra の Deepgram Voice 実装は、Deepgram API を使用した Text-to-Speech(TTS)および Speech-to-Text(STT)機能を提供します。複数の Voice モデルと言語をサポートし、音声合成と文字起こしの両方に設定可能なオプションがあります。 ## 使用例 ```typescript import { DeepgramVoice } from '@mastra/voice-deepgram' // Initialize with default configuration (uses DEEPGRAM_API_KEY environment variable) const voice = new DeepgramVoice() // Initialize with custom configuration const voice = new DeepgramVoice({ speechModel: { name: 'aura', apiKey: 'your-api-key', }, listeningModel: { name: 'nova-2', apiKey: 'your-api-key', }, speaker: 'asteria-en', }) // Text-to-Speech const audioStream = await voice.speak('Hello, world!') // Speech-to-Text const transcript = await voice.listen(audioStream) ``` ## コンストラクターパラメーター **speechModel** (`DeepgramVoiceConfig`): Text-to-Speech 機能の設定。 (Default: `{ name: 'aura' }`) **speechModel.name** (`DeepgramModel`): 使用する Deepgram モデル **speechModel.apiKey** (`string`): Deepgram API キー。未指定の場合は DEEPGRAM\_API\_KEY 環境変数を使用します **speechModel.properties** (`Record`): Deepgram API に渡す追加プロパティ **speechModel.language** (`string`): モデルの言語コード **listeningModel** (`DeepgramVoiceConfig`): Speech-to-Text 機能の設定。 (Default: `{ name: 'nova' }`) **listeningModel.name** (`DeepgramModel`): 使用する Deepgram モデル **listeningModel.apiKey** (`string`): Deepgram API キー。未指定の場合は DEEPGRAM\_API\_KEY 環境変数を使用します **listeningModel.properties** (`Record`): Deepgram API に渡す追加プロパティ **listeningModel.language** (`string`): モデルの言語コード **speaker** (`DeepgramVoiceId`): Text-to-Speech に使用するデフォルトの Voice (Default: `'asteria-en'`) ## メソッド ### `speak()` 設定された音声モデルと Voice を使用してテキストを音声に変換します。 **input** (`string | NodeJS.ReadableStream`): 音声に変換するテキスト。ストリームを指定した場合は、先にテキストへ変換されます。 **options** (`object`): 音声合成の追加オプション **options.speaker** (`string`): このリクエストでデフォルトの Speaker を上書きします 戻り値:`Promise` ### `listen()` 設定されたリスニングモデルを使用して音声をテキストに変換します。 **audioStream** (`NodeJS.ReadableStream`): 文字起こしする音声ストリーム **options** (`object`): Deepgram API に渡す追加オプション 戻り値:`Promise` ### `getSpeakers()` 使用可能な Voice オプションの一覧を返します。 **voiceId** (`string`): Voice の一意な識別子