> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ko/llms.txt # 일레븐랩스 Mastra의 ElevenLabs 음성 구현은 ElevenLabs API를 사용하여 고품질 TTS(텍스트 음성 변환) 및 STT(음성 텍스트 변환) 기능을 제공합니다. ## 사용예 ```typescript import { ElevenLabsVoice } from '@mastra/voice-elevenlabs' // Initialize with default configuration (uses ELEVENLABS_API_KEY environment variable) const voice = new ElevenLabsVoice() // Initialize with custom configuration const voice = new ElevenLabsVoice({ speechModel: { name: 'eleven_multilingual_v2', apiKey: 'your-api-key', }, speaker: 'custom-speaker-id', }) // Text-to-Speech const audioStream = await voice.speak('Hello, world!') // Get available speakers const speakers = await voice.getSpeakers() ``` ## 생성자 매개변수 **speechModel** (`ElevenLabsVoiceConfig`): Configuration for text-to-speech functionality. (Default: `{ name: 'eleven_multilingual_v2' }`) **speechModel.name** (`ElevenLabsModel`): The ElevenLabs model to use **speechModel.apiKey** (`string`): ElevenLabs API key. Falls back to ELEVENLABS\_API\_KEY environment variable **speaker** (`string`): ID of the speaker to use for text-to-speech (Default: `'9BWtsMINqrJLrRacOk9x' (Aria voice)`) ## 행동 양식 ### `speak()` 구성된 음성 Model 및 음성을 사용하여 텍스트를 음성으로 변환합니다. **input** (`string | NodeJS.ReadableStream`): Text to convert to speech. If a stream is provided, it will be converted to text first. **options** (`object`): Additional options for speech synthesis **options.speaker** (`string`): Override the default speaker ID for this request 보고:`Promise` ### `getSpeakers()` 각 노드에 다음이 포함된 사용 가능한 음성 옵션의 배열을 반환합니다. **voiceId** (`string`): Unique identifier for the voice **name** (`string`): Display name of the voice **language** (`string`): Language code for the voice **gender** (`string`): Gender of the voice ### `listen()` ElevenLabs Speech-to-Text API를 사용하여 오디오 입력을 텍스트로 변환합니다. **input** (`NodeJS.ReadableStream`): A readable stream containing the audio data to transcribe **options** (`object`): Configuration options for the transcription 옵션 개체는 다음 속성을 지원합니다. **language\_code** (`string`): ISO language code (e.g., 'en', 'fr', 'es') **tag\_audio\_events** (`boolean`): Whether to tag audio events like \[MUSIC], \[LAUGHTER], etc. **num\_speakers** (`number`): Number of speakers to detect in the audio **filetype** (`string`): Audio file format (e.g., 'mp3', 'wav', 'ogg') **timeoutInSeconds** (`number`): Request timeout in seconds **maxRetries** (`number`): Maximum number of retry attempts **abortSignal** (`AbortSignal`): Signal to abort the request 보고:`Promise` - 변환된 텍스트로 이행되는 Promise ## 중요 사항 1. ElevenLabs API 키가 필요합니다. 다음을 통해 설정하세요.`ELEVENLABS_API_KEY` 환경 변수를 설정하거나 생성자에 전달합니다. 2. 기본 스피커는 Aria(ID: '9BWtsMINqrJLrRacOk9x')로 설정되어 있습니다. 3. ElevenLabs에서는 음성-텍스트 기능을 지원하지 않습니다. 4. 사용 가능한 스피커는 다음을 사용하여 검색할 수 있습니다.`getSpeakers()` 메서드는 언어와 성별을 포함하여 각 음성에 대한 상세 정보를 반환합니다.