Reference documentation | Package (Maven)
This folder contains Java samples demonstrating how to build real-time voice assistants using Azure AI Speech VoiceLive service. Each sample is self-contained for easy understanding and deployment.
Demonstrates the new Voice Live + Foundry Agent flow, including creating an agent configured for Voice Live and running a v2 agent-connected voice assistant sample.
Key Features:
- Agent creation utility with Voice Live metadata chunking
- New SDK-based agent session configuration
- Proactive greeting and barge-in handling
- Conversation logging
Demonstrates direct integration with VoiceLive models for voice conversations without agent overhead.
Key Features:
- Direct model access
- Flexible authentication (API key or Azure credentials)
- Custom instructions support
- Model selection options
- Real-time audio capture and playback
- Voice Activity Detection with interruption handling
All samples require:
- Java 11 or later
- Maven 3.6+
- Audio input/output devices (microphone and speakers)
- Azure subscription - Create one for free
Depending on which sample you want to run:
For Model Quickstart:
- AI Foundry resource
- API key or Azure CLI for authentication
-
Choose a sample: Navigate to a folder under
voice-live-quickstarts(for example,ModelQuickstartorAgentsNewQuickstart) -
Install prerequisites: Ensure Java 11+ and Maven 3.6+ are installed
-
Set up Azure resources: Create required Azure resources based on the sample
-
Configure settings: Copy
application.properties.sampletoapplication.propertiesand update with your Azure credentials -
Build and run:
cd voice-live-quickstarts/ModelQuickstart mvn clean install mvn exec:java
Model Quickstart supports both authentication methods:
# With API key (from application.properties or --api-key)
mvn exec:java
# With Azure credentials
az login
mvn exec:java -Dexec.args="--use-token-credential"Each sample includes an application.properties.sample file that you need to copy to application.properties and configure:
# Required: Your VoiceLive endpoint URL
azure.voicelive.endpoint=https://your-endpoint.services.ai.azure.com/
# Required: Your API key (if using API key authentication)
azure.voicelive.api-key=your-api-key-here
# Optional: Model name (default: gpt-realtime)
# azure.voicelive.model=gpt-realtime
# Optional: Voice name (default: en-US-Ava:DragonHDLatestNeural)
# azure.voicelive.voice=en-US-Ava:DragonHDLatestNeuralVoiceLive supports multiple neural voices:
en-US-Ava:DragonHDLatestNeural(default)en-US-Jenny:DragonHDLatestNeuralen-US-Guy:DragonHDLatestNeuralen-US-Emma:DragonHDLatestNeuralen-US-Andrew:DragonHDLatestNeural
See Azure Text-to-Speech voice list for all available voices.
Problem: Microphone not detected or no audio input
Solutions:
- Verify microphone is connected and set as default input device
- Check system audio settings and permissions
- Ensure no other application is exclusively using the microphone
- Try running with administrator/elevated privileges
Problem: 401 Unauthorized or authentication failures
Solutions:
- Verify your API key is correct in
application.properties - Ensure endpoint URL is properly formatted (starts with
https://and ends with/) - Check that your Azure subscription is active
- For Azure credential auth, ensure you've run
az loginand have the correct permissions
Problem: Poor audio quality, echoes, or background noise
Solutions:
- Use a quality microphone with noise cancellation
- Enable audio processing features in the configuration
- Check for proper microphone positioning and environment
- Ensure sample rate is 24kHz as required by VoiceLive
Problem: Cannot connect to VoiceLive service
Solutions:
- Verify network connectivity
- Check firewall and proxy settings
- Ensure the endpoint URL is accessible from your network
- Verify your Azure resource is in a supported region
Problem: Build failures or dependency resolution errors
Solutions:
- Ensure you're using Java 11 or later:
java -version - Ensure Maven 3.6+ is installed:
mvn -version - Clear Maven cache:
mvn cleanor delete~/.m2/repository - Check internet connectivity for dependency downloads
Java quickstart content also includes:
- Agents New Quickstart:
voice-live-quickstarts/AgentsNewQuickstart - Model Quickstart:
voice-live-quickstarts/ModelQuickstart
- Azure AI Speech - Voice Live Documentation
- VoiceLive SDK Documentation
- Azure AI Services Documentation
- Maven Documentation
- Support Guide
Explore samples in other languages:
- C# Samples - .NET implementation
- Python Samples - Python implementation
Interested in contributing Java samples? Please see our Contributing Guidelines.
For issues, questions, or contributions, please see our Support Guide.