Azure AI VoiceLive SDK for Java
使用 Azure AI 构建实时语音应用
开发者需要一种方式将实时双向语音对话集成到 Java 应用程序中。此技能提供了使用 Azure AI VoiceLive SDK 和 WebSocket 流式传输实现语音 AI 的完整代码示例和最佳实践。
下载技能 ZIP
在 Claude 中上传
前往 设置 → 功能 → 技能 → 上传技能
开启并开始使用
测试它
正在使用“Azure AI VoiceLive SDK for Java”。 Create a VoiceLive client with DefaultAzureCredential
预期结果:
VoiceLiveAsyncClient client = new VoiceLiveClientBuilder()
.endpoint(System.getenv("AZURE_VOICELIVE_ENDPOINT"))
.credential(new DefaultAzureCredentialBuilder().build())
.buildAsyncClient();
正在使用“Azure AI VoiceLive SDK for Java”。 Configure turn detection for natural conversation
预期结果:
ServerVadTurnDetection turnDetection = new ServerVadTurnDetection()
.setThreshold(0.5)
.setPrefixPaddingMs(300)
.setSilenceDurationMs(500)
.setInterruptResponse(true)
.setAutoTruncate(true);
安全审计
安全Prompt-only documentation skill containing code examples for Azure AI VoiceLive SDK. Static analysis found 0 files scanned with 0 potential security issues. Risk score: 0/100. No suspicious patterns detected. Skill provides legitimate documentation for Microsoft Azure service with no executable code.
质量评分
你能构建什么
客户服务语音机器人
构建用于客户支持的交互式语音助手,使用自然语音实时处理咨询
无障碍工具开发
为偏好语音交互而非文本界面的用户创建支持语音的应用程序
IoT 语音控制界面
为 IoT 设备实现低延迟双向通信的语音控制
试试这些提示
Show me how to set up a basic VoiceLiveAsyncClient in Java with API key authentication using the Azure AI VoiceLive SDK.
How do I configure VoiceLiveSessionOptions with turn detection, voice selection, and audio format settings for a natural conversation flow?
Write Java code to handle voice events including speech start/stop detection, audio delta streaming, and error handling in the VoiceLive session.
Show me how to integrate function calling with VoiceLive to enable the AI assistant to execute real actions like weather lookups during conversation.
最佳实践
- Use DefaultAzureCredential instead of API keys for production deployments to leverage Azure managed identities
- Configure ServerVadTurnDetection with appropriate threshold and silence duration to match your use case for natural conversation flow
- Always implement proper error handling and reconnection logic for production voice applications
避免
- Do not hardcode API keys in source code - use environment variables or Azure Key Vault instead
- Avoid blocking calls in reactive streams - use non-blocking patterns throughout
- Do not skip audio format validation - ensure input matches 24kHz 16-bit PCM requirements