> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ko/llms.txt # 마스트라의 목소리 Mastra의 음성 시스템은 음성 상호 작용을 위한 통합 인터페이스를 제공하여 애플리케이션에서 TTS(텍스트 음성 변환), STT(음성 변환) 및 실시간 STS(음성 변환) 기능을 활성화합니다. ## Agent에게 음성 추가 다음을 사용하여 음성 제공자를 Agent에게 전달합니다.`voice` 속성을 사용합니다. 구성한 Provider에 따라 동일한 속성에서 텍스트 음성 변환(TTS), 음성 텍스트 변환(STT), 실시간 음성 간 변환(STS)을 지원합니다. ```typescript import { Agent } from '@mastra/core/agent' import { OpenAIVoice } from '@mastra/voice-openai' // Initialize OpenAI voice for TTS const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new OpenAIVoice(), }) ``` 그런 다음 다음 음성 기능을 사용할 수 있습니다. ### 텍스트 음성 변환(TTS) Mastra의 TTS 기능을 사용하여 Agent의 응답을 자연스러운 음성으로 변환하세요. OpenAI, ElevenLabs 등과 같은 여러 Provider 중에서 선택하세요. 자세한 구성 옵션과 고급 기능을 알아보려면 당사를 확인하세요.[Text-to-Speech guide](https://mastra.zisheng.pro/ko/guides/voice/text-to-speech). **OpenAI**: ```typescript import { Agent } from '@mastra/core/agent' import { OpenAIVoice } from '@mastra/voice-openai' import { playAudio } from '@mastra/node-audio' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new OpenAIVoice(), }) const { text } = await voiceAgent.generate('What color is the sky?') // Convert text to speech to an Audio Stream const audioStream = await voiceAgent.voice.speak(text, { speaker: 'default', // Optional: specify a speaker responseFormat: 'wav', // Optional: specify a response format }) playAudio(audioStream) ``` 방문[OpenAI Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/openai) 에서 OpenAI 음성 Provider에 관한 자세한 정보를 확인하세요. **Azure**: ```typescript import { Agent } from '@mastra/core/agent' import { AzureVoice } from '@mastra/voice-azure' import { playAudio } from '@mastra/node-audio' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new AzureVoice(), }) const { text } = await voiceAgent.generate('What color is the sky?') // Convert text to speech to an Audio Stream const audioStream = await voiceAgent.voice.speak(text, { speaker: 'en-US-JennyNeural', // Optional: specify a speaker }) playAudio(audioStream) ``` 방문[Azure Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/azure) 에서 Azure 음성 Provider에 관한 자세한 정보를 확인하세요. **ElevenLabs**: ```typescript import { Agent } from '@mastra/core/agent' import { ElevenLabsVoice } from '@mastra/voice-elevenlabs' import { playAudio } from '@mastra/node-audio' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new ElevenLabsVoice(), }) const { text } = await voiceAgent.generate('What color is the sky?') // Convert text to speech to an Audio Stream const audioStream = await voiceAgent.voice.speak(text, { speaker: 'default', // Optional: specify a speaker }) playAudio(audioStream) ``` 방문[ElevenLabs Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/elevenlabs) 에서 ElevenLabs 음성 Provider에 관한 자세한 정보를 확인하세요. **PlayAI**: ```typescript import { Agent } from '@mastra/core/agent' import { PlayAIVoice } from '@mastra/voice-playai' import { playAudio } from '@mastra/node-audio' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new PlayAIVoice(), }) const { text } = await voiceAgent.generate('What color is the sky?') // Convert text to speech to an Audio Stream const audioStream = await voiceAgent.voice.speak(text, { speaker: 'default', // Optional: specify a speaker }) playAudio(audioStream) ``` 방문[PlayAI Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/playai) 에서 PlayAI 음성 Provider에 관한 자세한 정보를 확인하세요. **Google**: ```typescript import { Agent } from '@mastra/core/agent' import { GoogleVoice } from '@mastra/voice-google' import { playAudio } from '@mastra/node-audio' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new GoogleVoice(), }) const { text } = await voiceAgent.generate('What color is the sky?') // Convert text to speech to an Audio Stream const audioStream = await voiceAgent.voice.speak(text, { speaker: 'en-US-Studio-O', // Optional: specify a speaker }) playAudio(audioStream) ``` 방문[Google Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/google) 에서 Google 음성 Provider에 관한 자세한 정보를 확인하세요. **Cloudflare**: ```typescript import { Agent } from '@mastra/core/agent' import { CloudflareVoice } from '@mastra/voice-cloudflare' import { playAudio } from '@mastra/node-audio' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new CloudflareVoice(), }) const { text } = await voiceAgent.generate('What color is the sky?') // Convert text to speech to an Audio Stream const audioStream = await voiceAgent.voice.speak(text, { speaker: 'default', // Optional: specify a speaker }) playAudio(audioStream) ``` 방문[Cloudflare Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/cloudflare) 에서 Cloudflare 음성 Provider에 관한 자세한 정보를 확인하세요. **Deepgram**: ```typescript import { Agent } from '@mastra/core/agent' import { DeepgramVoice } from '@mastra/voice-deepgram' import { playAudio } from '@mastra/node-audio' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new DeepgramVoice(), }) const { text } = await voiceAgent.generate('What color is the sky?') // Convert text to speech to an Audio Stream const audioStream = await voiceAgent.voice.speak(text, { speaker: 'aura-english-us', // Optional: specify a speaker }) playAudio(audioStream) ``` 방문[Deepgram Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/deepgram) 에서 Deepgram 음성 Provider에 관한 자세한 정보를 확인하세요. **Inworld**: ```typescript import { Agent } from '@mastra/core/agent' import { InworldVoice } from '@mastra/voice-inworld' import { playAudio } from '@mastra/node-audio' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new InworldVoice(), }) const { text } = await voiceAgent.generate('What color is the sky?') // Convert text to speech to an Audio Stream const audioStream = await voiceAgent.voice.speak(text, { speaker: 'Dennis', // Optional: specify a speaker }) playAudio(audioStream) ``` 방문[Inworld Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/inworld) 에서 Inworld 음성 Provider에 관한 자세한 정보를 확인하세요. **Speechify**: ```typescript import { Agent } from '@mastra/core/agent' import { SpeechifyVoice } from '@mastra/voice-speechify' import { playAudio } from '@mastra/node-audio' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new SpeechifyVoice(), }) const { text } = await voiceAgent.generate('What color is the sky?') // Convert text to speech to an Audio Stream const audioStream = await voiceAgent.voice.speak(text, { speaker: 'matthew', // Optional: specify a speaker }) playAudio(audioStream) ``` 방문[Speechify Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/speechify) 에서 Speechify 음성 Provider에 관한 자세한 정보를 확인하세요. **Sarvam**: ```typescript import { Agent } from '@mastra/core/agent' import { SarvamVoice } from '@mastra/voice-sarvam' import { playAudio } from '@mastra/node-audio' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new SarvamVoice(), }) const { text } = await voiceAgent.generate('What color is the sky?') // Convert text to speech to an Audio Stream const audioStream = await voiceAgent.voice.speak(text, { speaker: 'shubh', // Optional: specify a bulbul:v3 speaker }) playAudio(audioStream) ``` 방문[Sarvam Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/sarvam) 에서 Sarvam 음성 Provider에 관한 자세한 정보를 확인하세요. **Murf**: ```typescript import { Agent } from '@mastra/core/agent' import { MurfVoice } from '@mastra/voice-murf' import { playAudio } from '@mastra/node-audio' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new MurfVoice(), }) const { text } = await voiceAgent.generate('What color is the sky?') // Convert text to speech to an Audio Stream const audioStream = await voiceAgent.voice.speak(text, { speaker: 'default', // Optional: specify a speaker }) playAudio(audioStream) ``` 방문[Murf Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/murf) 에서 Murf 음성 Provider에 관한 자세한 정보를 확인하세요. ### 음성을 텍스트로 변환(STT) OpenAI, ElevenLabs 등과 같은 Provider를 사용하여 음성 콘텐츠를 텍스트로 변환하세요. 자세한 구성 옵션 등을 확인하려면 다음을 확인하세요.[Speech to Text](https://mastra.zisheng.pro/ko/guides/voice/speech-to-text). 다음에서 샘플 오디오 파일을 다운로드할 수 있습니다.[here](https://github.com/mastra-ai/realtime-voice-demo/raw/refs/heads/main/how_can_i_help_you.mp3). [](https://github.com/mastra-ai/realtime-voice-demo/raw/refs/heads/main/how_can_i_help_you.mp3) **OpenAI**: ```typescript import { Agent } from '@mastra/core/agent' import { OpenAIVoice } from '@mastra/voice-openai' import { createReadStream } from 'fs' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new OpenAIVoice(), }) // Use an audio file from a URL const audioStream = await createReadStream('./how_can_i_help_you.mp3') // Convert audio to text const transcript = await voiceAgent.voice.listen(audioStream) console.log(`User said: ${transcript}`) // Generate a response based on the transcript const { text } = await voiceAgent.generate(transcript) ``` 방문[OpenAI Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/openai) 에서 OpenAI 음성 Provider에 관한 자세한 정보를 확인하세요. **Azure**: ```typescript import { createReadStream } from 'fs' import { Agent } from '@mastra/core/agent' import { AzureVoice } from '@mastra/voice-azure' import { createReadStream } from 'fs' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new AzureVoice(), }) // Use an audio file from a URL const audioStream = await createReadStream('./how_can_i_help_you.mp3') // Convert audio to text const transcript = await voiceAgent.voice.listen(audioStream) console.log(`User said: ${transcript}`) // Generate a response based on the transcript const { text } = await voiceAgent.generate(transcript) ``` 방문[Azure Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/azure) 에서 Azure 음성 Provider에 관한 자세한 정보를 확인하세요. **ElevenLabs**: ```typescript import { Agent } from '@mastra/core/agent' import { ElevenLabsVoice } from '@mastra/voice-elevenlabs' import { createReadStream } from 'fs' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new ElevenLabsVoice(), }) // Use an audio file from a URL const audioStream = await createReadStream('./how_can_i_help_you.mp3') // Convert audio to text const transcript = await voiceAgent.voice.listen(audioStream) console.log(`User said: ${transcript}`) // Generate a response based on the transcript const { text } = await voiceAgent.generate(transcript) ``` 방문[ElevenLabs Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/elevenlabs) 에서 ElevenLabs 음성 Provider에 관한 자세한 정보를 확인하세요. **Google**: ```typescript import { Agent } from '@mastra/core/agent' import { GoogleVoice } from '@mastra/voice-google' import { createReadStream } from 'fs' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new GoogleVoice(), }) // Use an audio file from a URL const audioStream = await createReadStream('./how_can_i_help_you.mp3') // Convert audio to text const transcript = await voiceAgent.voice.listen(audioStream) console.log(`User said: ${transcript}`) // Generate a response based on the transcript const { text } = await voiceAgent.generate(transcript) ``` 방문[Google Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/google) 에서 Google 음성 Provider에 관한 자세한 정보를 확인하세요. **Cloudflare**: ```typescript import { Agent } from '@mastra/core/agent' import { CloudflareVoice } from '@mastra/voice-cloudflare' import { createReadStream } from 'fs' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new CloudflareVoice(), }) // Use an audio file from a URL const audioStream = await createReadStream('./how_can_i_help_you.mp3') // Convert audio to text const transcript = await voiceAgent.voice.listen(audioStream) console.log(`User said: ${transcript}`) // Generate a response based on the transcript const { text } = await voiceAgent.generate(transcript) ``` 방문[Cloudflare Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/cloudflare) 에서 Cloudflare 음성 Provider에 관한 자세한 정보를 확인하세요. **Deepgram**: ```typescript import { Agent } from '@mastra/core/agent' import { DeepgramVoice } from '@mastra/voice-deepgram' import { createReadStream } from 'fs' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new DeepgramVoice(), }) // Use an audio file from a URL const audioStream = await createReadStream('./how_can_i_help_you.mp3') // Convert audio to text const transcript = await voiceAgent.voice.listen(audioStream) console.log(`User said: ${transcript}`) // Generate a response based on the transcript const { text } = await voiceAgent.generate(transcript) ``` 방문[Deepgram Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/deepgram) 에서 Deepgram 음성 Provider에 관한 자세한 정보를 확인하세요. **Inworld**: ```typescript import { Agent } from '@mastra/core/agent' import { InworldVoice } from '@mastra/voice-inworld' import { createReadStream } from 'fs' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new InworldVoice(), }) // Use an audio file from a URL const audioStream = await createReadStream('./how_can_i_help_you.mp3') // Convert audio to text const transcript = await voiceAgent.voice.listen(audioStream) console.log(`User said: ${transcript}`) // Generate a response based on the transcript const { text } = await voiceAgent.generate(transcript) ``` 방문[Inworld Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/inworld) 에서 Inworld 음성 Provider에 관한 자세한 정보를 확인하세요. **Sarvam**: ```typescript import { Agent } from '@mastra/core/agent' import { SarvamVoice } from '@mastra/voice-sarvam' import { createReadStream } from 'fs' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new SarvamVoice(), }) // Use an audio file from a URL const audioStream = await createReadStream('./how_can_i_help_you.mp3') // Convert audio to text const transcript = await voiceAgent.voice.listen(audioStream) console.log(`User said: ${transcript}`) // Generate a response based on the transcript const { text } = await voiceAgent.generate(transcript) ``` 방문[Sarvam Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/sarvam) 에서 Sarvam 음성 Provider에 관한 자세한 정보를 확인하세요. ### 음성 대 음성(STS) 음성 대 음성 변환 기능으로 대화 환경을 조성하세요. 통합 API를 사용하면 사용자와 AI Agent 간의 실시간 음성 상호작용이 가능합니다. 자세한 구성 옵션과 고급 기능을 확인하려면 다음을 확인하세요.[Speech to Speech](https://mastra.zisheng.pro/ko/guides/voice/speech-to-speech). **OpenAI**: ```typescript import { Agent } from '@mastra/core/agent' import { playAudio, getMicrophoneStream } from '@mastra/node-audio' import { OpenAIRealtimeVoice } from '@mastra/voice-openai-realtime' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new OpenAIRealtimeVoice(), }) // Listen for agent audio responses voiceAgent.voice.on('speaker', ({ audio }) => { playAudio(audio) }) // Initiate the conversation await voiceAgent.voice.speak('How can I help you today?') // Send continuous audio from the microphone const micStream = getMicrophoneStream() await voiceAgent.voice.send(micStream) ``` 방문[OpenAI Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/openai-realtime) 에서 OpenAI 음성 Provider에 관한 자세한 정보를 확인하세요. **Google**: ```typescript import { Agent } from '@mastra/core/agent' import { playAudio, getMicrophoneStream } from '@mastra/node-audio' import { GeminiLiveVoice } from '@mastra/voice-google-gemini-live' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new GeminiLiveVoice({ // Live API mode apiKey: process.env.GOOGLE_API_KEY, model: 'gemini-2.0-flash-exp', speaker: 'Puck', debug: true, // Vertex AI alternative: // vertexAI: true, // project: 'your-gcp-project', // location: 'us-central1', // serviceAccountKeyFile: '/path/to/service-account.json', }), }) // Connect before using speak/send await voiceAgent.voice.connect() // Listen for agent audio responses voiceAgent.voice.on('speaker', ({ audio }) => { playAudio(audio) }) // Listen for text responses and transcriptions voiceAgent.voice.on('writing', ({ text, role }) => { console.log(`${role}: ${text}`) }) // Initiate the conversation await voiceAgent.voice.speak('How can I help you today?') // Send continuous audio from the microphone const micStream = getMicrophoneStream() await voiceAgent.voice.send(micStream) ``` 방문[Google Gemini Live Reference](https://mastra.zisheng.pro/ko/reference/voice/google-gemini-live) 에서 Google Gemini Live 음성 Provider에 관한 자세한 정보를 확인하세요. **AWS Nova Sonic**: ```typescript import { Agent } from '@mastra/core/agent' import { playAudio, getMicrophoneStream } from '@mastra/node-audio' import { NovaSonicVoice } from '@mastra/voice-aws-nova-sonic' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new NovaSonicVoice({ region: 'us-east-1', speaker: 'matthew', // Static credentials are optional. The default AWS credential // provider chain is used when none are passed. }), }) // Connect before using speak/send await voiceAgent.voice.connect() // Listen for assistant audio (Int16Array PCM) voiceAgent.voice.on('speaking', ({ audioData }) => { if (audioData) playAudio(audioData) }) // Listen for transcribed text voiceAgent.voice.on('writing', ({ text, role }) => { console.log(`${role}: ${text}`) }) // Initiate the conversation await voiceAgent.voice.speak('How can I help you today?') // Send continuous audio from the microphone const micStream = getMicrophoneStream() await voiceAgent.voice.send(micStream) ``` 방문[AWS Nova Sonic Reference](https://mastra.zisheng.pro/ko/reference/voice/aws-nova-sonic) 에서 AWS Nova Sonic 음성 Provider에 관한 자세한 정보를 확인하세요. **Inworld Realtime**: ```typescript import { Agent } from '@mastra/core/agent' import { playAudio, getMicrophoneStream } from '@mastra/node-audio' import { InworldRealtimeVoice } from '@mastra/voice-inworld' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'openai/gpt-5.6-sol', voice: new InworldRealtimeVoice({ apiKey: process.env.INWORLD_API_KEY, model: 'inworld/models/gemma-4-26b-a4b-it', speaker: 'Sarah', }), }) // Connect before using speak/send await voiceAgent.voice.connect() // Listen for agent audio (PCM stream) voiceAgent.voice.on('speaker', stream => { playAudio(stream) }) // Listen for text responses and transcriptions voiceAgent.voice.on('writing', ({ text, role }) => { console.log(`${role}: ${text}`) }) // Initiate the conversation await voiceAgent.voice.speak('How can I help you today?') // Send continuous audio from the microphone const micStream = getMicrophoneStream() await voiceAgent.voice.send(micStream) ``` 방문[Inworld Realtime Reference](https://mastra.zisheng.pro/ko/reference/voice/inworld-realtime) 에서 Inworld Realtime 음성 Provider에 관한 자세한 정보를 확인하세요. **xAI**: ```typescript import { Agent } from '@mastra/core/agent' import { playAudio, getMicrophoneStream } from '@mastra/node-audio' import { XAIRealtimeVoice } from '@mastra/voice-xai-realtime' const voiceAgent = new Agent({ id: 'voice-agent', name: 'Voice Agent', instructions: 'You are a voice assistant that can help users with their tasks.', model: 'xai/grok-4.3', voice: new XAIRealtimeVoice({ apiKey: process.env.XAI_API_KEY, model: 'grok-voice-think-fast-1.0', speaker: 'eve', turnDetection: { type: 'server_vad' }, }), }) // Connect before using speak/send await voiceAgent.voice.connect() // Listen for agent audio responses voiceAgent.voice.on('speaker', audioStream => { playAudio(audioStream) }) // Listen for text responses and transcriptions voiceAgent.voice.on('writing', ({ text, role }) => { console.log(`${role}: ${text}`) }) // Initiate the conversation await voiceAgent.voice.speak('How can I help you today?') // Send continuous audio from the microphone const micStream = getMicrophoneStream() await voiceAgent.voice.send(micStream) ``` 방문[xAI Realtime Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/xai-realtime) 에서 xAI 음성 Provider에 관한 자세한 정보를 확인하세요. ### 실시간 음성 사용자가 브라우저나 전화를 통해 대화할 수 있는 실시간 통화를 실행하세요. Mastra는 음성 활동 감지, 의미론적 차례 감지 및 참여를 다루는 오디오 루프를 LiveKit에 전달하고 Agent는 자체 Model, Tool 및 Memory를 사용하여 각 응답을 생성합니다. 설정 및 구성 옵션을 확인하려면 다음을 확인하세요.[Realtime voice](https://mastra.zisheng.pro/ko/guides/voice/realtime-voice). ## 음성 구성 각 음성 Provider는 다양한 Model과 옵션으로 구성될 수 있습니다. 다음은 지원되는 모든 공급자에 대한 자세한 구성 옵션입니다. **OpenAI**: ```typescript // OpenAI Voice Configuration const voice = new OpenAIVoice({ speechModel: { name: 'gpt-3.5-turbo', // Example model name apiKey: process.env.OPENAI_API_KEY, language: 'en-US', // Language code voiceType: 'neural', // Type of voice model }, listeningModel: { name: 'whisper-1', // Example model name apiKey: process.env.OPENAI_API_KEY, language: 'en-US', // Language code format: 'wav', // Audio format }, speaker: 'alloy', // Example speaker name }) ``` 방문[OpenAI Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/openai) 에서 OpenAI 음성 Provider에 관한 자세한 정보를 확인하세요. **Azure**: ```typescript // Azure Voice Configuration const voice = new AzureVoice({ speechModel: { name: 'en-US-JennyNeural', // Example model name apiKey: process.env.AZURE_SPEECH_KEY, region: process.env.AZURE_SPEECH_REGION, language: 'en-US', // Language code style: 'cheerful', // Voice style pitch: '+0Hz', // Pitch adjustment rate: '1.0', // Speech rate }, listeningModel: { name: 'en-US', // Example model name apiKey: process.env.AZURE_SPEECH_KEY, region: process.env.AZURE_SPEECH_REGION, format: 'simple', // Output format }, }) ``` 방문[Azure Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/azure) 에서 Azure 음성 Provider에 관한 자세한 정보를 확인하세요. **ElevenLabs**: ```typescript // ElevenLabs Voice Configuration const voice = new ElevenLabsVoice({ speechModel: { voiceId: 'your-voice-id', // Example voice ID model: 'eleven_multilingual_v2', // Example model name apiKey: process.env.ELEVENLABS_API_KEY, language: 'en', // Language code emotion: 'neutral', // Emotion setting }, // ElevenLabs may not have a separate listening model }) ``` 방문[ElevenLabs Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/elevenlabs) 에서 ElevenLabs 음성 Provider에 관한 자세한 정보를 확인하세요. **PlayAI**: ```typescript // PlayAI Voice Configuration const voice = new PlayAIVoice({ speechModel: { name: 'playai-voice', // Example model name speaker: 'emma', // Example speaker name apiKey: process.env.PLAYAI_API_KEY, language: 'en-US', // Language code speed: 1.0, // Speech speed }, // PlayAI may not have a separate listening model }) ``` 방문[PlayAI Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/playai) 에서 PlayAI 음성 Provider에 관한 자세한 정보를 확인하세요. **Google**: ```typescript // Google Voice Configuration const voice = new GoogleVoice({ speechModel: { name: 'en-US-Studio-O', // Example model name apiKey: process.env.GOOGLE_API_KEY, languageCode: 'en-US', // Language code gender: 'FEMALE', // Voice gender speakingRate: 1.0, // Speaking rate }, listeningModel: { name: 'en-US', // Example model name sampleRateHertz: 16000, // Sample rate }, }) ``` 방문[Google Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/google) 에서 Google 음성 Provider에 관한 자세한 정보를 확인하세요. **Cloudflare**: ```typescript // Cloudflare Voice Configuration const voice = new CloudflareVoice({ speechModel: { name: 'cloudflare-voice', // Example model name accountId: process.env.CLOUDFLARE_ACCOUNT_ID, apiToken: process.env.CLOUDFLARE_API_TOKEN, language: 'en-US', // Language code format: 'mp3', // Audio format }, // Cloudflare may not have a separate listening model }) ``` 방문[Cloudflare Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/cloudflare) 에서 Cloudflare 음성 Provider에 관한 자세한 정보를 확인하세요. **Deepgram**: ```typescript // Deepgram Voice Configuration const voice = new DeepgramVoice({ speechModel: { name: 'nova-2', // Example model name speaker: 'aura-english-us', // Example speaker name apiKey: process.env.DEEPGRAM_API_KEY, language: 'en-US', // Language code tone: 'formal', // Tone setting }, listeningModel: { name: 'nova-2', // Example model name format: 'flac', // Audio format }, }) ``` 방문[Deepgram Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/deepgram) 에서 Deepgram 음성 Provider에 관한 자세한 정보를 확인하세요. **Inworld**: ```typescript // Inworld Voice Configuration const voice = new InworldVoice({ speechModel: { name: 'inworld-tts-2', apiKey: process.env.INWORLD_API_KEY, }, listeningModel: { name: 'groq/whisper-large-v3', apiKey: process.env.INWORLD_API_KEY, }, speaker: 'Dennis', audioEncoding: 'MP3', sampleRateHertz: 48000, language: 'en-US', }) // Per-call options: `deliveryMode` is honored only by `inworld-tts-2`. const audioStream = await voice.speak('Hello!', { deliveryMode: 'BALANCED', // 'STABLE' | 'BALANCED' | 'CREATIVE' language: 'en-US', // BCP-47 per-call override }) ``` 방문[Inworld Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/inworld) 에서 Inworld 음성 Provider에 관한 자세한 정보를 확인하세요. **Speechify**: ```typescript // Speechify Voice Configuration const voice = new SpeechifyVoice({ speechModel: { name: 'speechify-voice', // Example model name speaker: 'matthew', // Example speaker name apiKey: process.env.SPEECHIFY_API_KEY, language: 'en-US', // Language code speed: 1.0, // Speech speed }, // Speechify may not have a separate listening model }) ``` 방문[Speechify Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/speechify) 에서 Speechify 음성 Provider에 관한 자세한 정보를 확인하세요. **Sarvam**: ```typescript // Sarvam Voice Configuration const voice = new SarvamVoice({ speechModel: { model: 'bulbul:v3', // TTS model (bulbul:v2 or bulbul:v3) apiKey: process.env.SARVAM_API_KEY, language: 'en-IN', // BCP-47 language code }, listeningModel: { model: 'saarika:v2.5', // STT model (saarika:v2.5 or saaras:v3) apiKey: process.env.SARVAM_API_KEY, }, speaker: 'shubh', // Default bulbul:v3 speaker }) ``` 방문[Sarvam Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/sarvam) 에서 Sarvam 음성 Provider에 관한 자세한 정보를 확인하세요. **Murf**: ```typescript // Murf Voice Configuration const voice = new MurfVoice({ speechModel: { name: 'murf-voice', // Example model name apiKey: process.env.MURF_API_KEY, language: 'en-US', // Language code emotion: 'happy', // Emotion setting }, // Murf may not have a separate listening model }) ``` 방문[Murf Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/murf) 에서 Murf 음성 Provider에 관한 자세한 정보를 확인하세요. **OpenAI Realtime**: ```typescript // OpenAI Realtime Voice Configuration const voice = new OpenAIRealtimeVoice({ speechModel: { name: 'gpt-3.5-turbo', // Example model name apiKey: process.env.OPENAI_API_KEY, language: 'en-US', // Language code }, listeningModel: { name: 'whisper-1', // Example model name apiKey: process.env.OPENAI_API_KEY, format: 'ogg', // Audio format }, speaker: 'alloy', // Example speaker name }) ``` OpenAI Realtime 음성 제공자에 대한 자세한 내용은[OpenAI Realtime Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/openai-realtime). **xAI Realtime**: ```typescript // xAI Realtime Voice Configuration const voice = new XAIRealtimeVoice({ apiKey: process.env.XAI_API_KEY, model: 'grok-voice-think-fast-1.0', speaker: 'eve', instructions: 'You are a concise voice assistant.', turnDetection: { type: 'server_vad', threshold: 0.85, silence_duration_ms: 1000, prefix_padding_ms: 333, }, audio: { input: { format: { type: 'audio/pcm', rate: 24000 } }, output: { format: { type: 'audio/pcm', rate: 24000 } }, }, serverTools: [ { type: 'web_search' }, { type: 'mcp', server_url: 'https://mcp.example.com/mcp', server_label: 'business-tools', }, ], }) ``` 방문[xAI Realtime Voice Reference](https://mastra.zisheng.pro/ko/reference/voice/xai-realtime) 에서 xAI 실시간 음성 Provider에 관한 자세한 정보를 확인하세요. **Google Gemini Live**: ```typescript // Google Gemini Live Voice Configuration const voice = new GeminiLiveVoice({ speechModel: { name: 'gemini-2.0-flash-exp', // Example model name apiKey: process.env.GOOGLE_API_KEY, }, speaker: 'Puck', // Example speaker name // Google Gemini Live is a realtime bidirectional API without separate speech and listening models }) ``` 방문[Google Gemini Live Reference](https://mastra.zisheng.pro/ko/reference/voice/google-gemini-live) 에서 Google Gemini Live 음성 Provider에 관한 자세한 정보를 확인하세요. **AWS Nova Sonic**: ```typescript // AWS Nova Sonic Voice Configuration const voice = new NovaSonicVoice({ region: 'us-east-1', speaker: 'matthew', sessionConfig: { inferenceConfiguration: { temperature: 0.7, maxTokens: 1024, }, turnDetectionConfiguration: { endpointingSensitivity: 'MEDIUM', }, }, // AWS Nova Sonic is a realtime bidirectional API without separate speech and listening models }) ``` 방문[AWS Nova Sonic Reference](https://mastra.zisheng.pro/ko/reference/voice/aws-nova-sonic) 에서 AWS Nova Sonic 음성 Provider에 관한 자세한 정보를 확인하세요. **Inworld Realtime**: ```typescript // Inworld Realtime Voice Configuration const voice = new InworldRealtimeVoice({ apiKey: process.env.INWORLD_API_KEY, model: 'inworld/models/gemma-4-26b-a4b-it', speaker: 'Sarah', // Typed Inworld realtime knobs (semantic VAD, playback speed, MCP tool routing, ...) session: { audio: { output: { speed: 1.1 }, input: { turn_detection: { type: 'semantic_vad', eagerness: 'high' } }, }, }, }) ``` 방문[Inworld Realtime Reference](https://mastra.zisheng.pro/ko/reference/voice/inworld-realtime) 에서 Inworld Realtime 음성 Provider에 관한 자세한 정보를 확인하세요. **AI SDK**: ```typescript // AI SDK Voice Configuration import { CompositeVoice } from '@mastra/core/voice' import { openai } from '@ai-sdk/openai' import { elevenlabs } from '@ai-sdk/elevenlabs' // Use AI SDK models directly - no need to install separate packages const voice = new CompositeVoice({ input: openai.transcription('whisper-1'), // AI SDK transcription output: elevenlabs.speech('eleven_turbo_v2'), // AI SDK speech }) // Works seamlessly with your agent const voiceAgent = new Agent({ id: 'aisdk-voice-agent', name: 'AI SDK Voice Agent', instructions: 'You are a helpful assistant with voice capabilities.', model: 'openai/gpt-5.6-sol', voice, }) ``` ### 여러 음성 Provider 사용 이 예에서는 Mastra에서 STT(음성-텍스트)용 OpenAI와 TTS(텍스트 음성 변환)용 PlayAI라는 두 가지 음성 공급자를 만들고 사용하는 방법을 보여줍니다. 필요한 구성을 사용하여 음성 공급자의 인스턴스를 만드는 것부터 시작하세요. ```typescript import { OpenAIVoice } from '@mastra/voice-openai' import { PlayAIVoice } from '@mastra/voice-playai' import { CompositeVoice } from '@mastra/core/voice' import { playAudio, getMicrophoneStream } from '@mastra/node-audio' // Initialize OpenAI voice for STT const input = new OpenAIVoice({ listeningModel: { name: 'whisper-1', apiKey: process.env.OPENAI_API_KEY, }, }) // Initialize PlayAI voice for TTS const output = new PlayAIVoice({ speechModel: { name: 'playai-voice', apiKey: process.env.PLAYAI_API_KEY, }, }) // Combine the providers using CompositeVoice const voice = new CompositeVoice({ input, output, }) // Implement voice interactions using the combined voice provider const audioStream = getMicrophoneStream() // Assume this function gets audio input const transcript = await voice.listen(audioStream) // Log the transcribed text console.log('Transcribed text:', transcript) // Convert text to speech const responseAudio = await voice.speak(`You said: ${transcript}`, { speaker: 'default', // Optional: specify a speaker, responseFormat: 'wav', // Optional: specify a response format }) // Play the audio response playAudio(responseAudio) ``` ### AI SDK Model 공급자 사용 AI SDK Model을 직접 사용할 수도 있습니다.`CompositeVoice`: ```typescript import { CompositeVoice } from '@mastra/core/voice' import { openai } from '@ai-sdk/openai' import { elevenlabs } from '@ai-sdk/elevenlabs' import { playAudio, getMicrophoneStream } from '@mastra/node-audio' // Use AI SDK models directly - no provider setup needed const voice = new CompositeVoice({ input: openai.transcription('whisper-1'), // AI SDK transcription output: elevenlabs.speech('eleven_turbo_v2'), // AI SDK speech }) // Works the same way as Mastra providers const audioStream = getMicrophoneStream() const transcript = await voice.listen(audioStream) console.log('Transcribed text:', transcript) // Convert text to speech const responseAudio = await voice.speak(`You said: ${transcript}`, { speaker: 'Rachel', // ElevenLabs voice }) playAudio(responseAudio) ``` AI SDK Model을 Mastra 공급자와 혼합할 수도 있습니다. ```typescript import { CompositeVoice } from '@mastra/core/voice' import { PlayAIVoice } from '@mastra/voice-playai' import { groq } from '@ai-sdk/groq' const voice = new CompositeVoice({ input: groq.transcription('whisper-large-v3'), // AI SDK for STT output: new PlayAIVoice(), // Mastra provider for TTS }) ``` CompositeVoice에 대한 자세한 내용은[CompositeVoice Reference](https://mastra.zisheng.pro/ko/reference/voice/composite-voice). ## 더 많은 리소스 - [합성음성](https://mastra.zisheng.pro/ko/reference/voice/composite-voice) - [마스트라보이스](https://mastra.zisheng.pro/ko/reference/voice/mastra-voice) - [오픈AI 보이스](https://mastra.zisheng.pro/ko/reference/voice/openai) - [OpenAI 실시간 음성](https://mastra.zisheng.pro/ko/reference/voice/openai-realtime) - [xAI 실시간 음성](https://mastra.zisheng.pro/ko/reference/voice/xai-realtime) - [Azure 보이스](https://mastra.zisheng.pro/ko/reference/voice/azure) - [구글 보이스](https://mastra.zisheng.pro/ko/reference/voice/google) - [Google Gemini 라이브 보이스](https://mastra.zisheng.pro/ko/reference/voice/google-gemini-live) - [AWS Nova Sonic 음성](https://mastra.zisheng.pro/ko/reference/voice/aws-nova-sonic) - [딥그램 보이스](https://mastra.zisheng.pro/ko/reference/voice/deepgram) - [인월드 보이스](https://mastra.zisheng.pro/ko/reference/voice/inworld) - [라이브킷](https://mastra.zisheng.pro/ko/reference/voice/livekit) - [플레이AI 보이스](https://mastra.zisheng.pro/ko/reference/voice/playai) - [음성 예](https://github.com/mastra-ai/voice-examples)