Why Use Virtual Devices?
Virtual devices are essential for:- Building bots and AI agents that interact with video calls
- Sending pre-recorded or generated audio/video content
- Processing media in real-time (e.g., filters, transcription, AI models)
- Capturing call audio/video for recording or analysis
- Testing without physical hardware
- Building voice assistants and conversational AI
Virtual Camera Device
AVirtualCameraDevice allows you to send video frames into a Daily call.
Creating a Virtual Camera
Create a virtual camera with theDaily.create_camera_device() static method:
Properties
Writing Frames
Send video frames usingwrite_frame():
Using with CallClient
To use a virtual camera in a call, specify it in theclient_settings:
Virtual Microphone Device
AVirtualMicrophoneDevice allows you to send audio into a Daily call.
Creating a Virtual Microphone
Create a virtual microphone with theDaily.create_microphone_device() static method:
Properties
Writing Audio Frames
Send audio data usingwrite_frames():
Using with CallClient
Virtual Speaker Device
AVirtualSpeakerDevice allows you to receive audio from a Daily call.
Creating a Virtual Speaker
Create a virtual speaker with theDaily.create_speaker_device() static method:
Properties
Reading Audio Frames
Receive audio data usingread_frames():
Using with CallClient
After creating a virtual speaker, select it as the active speaker device:Complete Example: Audio Bot
Here’s a complete example of a bot that joins a call and plays audio:Audio Format Details
Virtual audio devices use 16-bit signed PCM format:- Sample format: 16-bit signed integer (little-endian)
- Common sample rates: 8000, 16000, 24000, 48000 Hz
- Channels: 1 (mono) or 2 (stereo)
- Byte order: Little-endian
Calculating Buffer Sizes
For a given duration of audio:Video Format Details
Virtual camera devices support multiple color formats:| Format | Bytes per Pixel | Description |
|---|---|---|
RGB | 3 | Red, Green, Blue |
RGBA | 4 | Red, Green, Blue, Alpha |
ARGB | 4 | Alpha, Red, Green, Blue |
ABGR | 4 | Alpha, Blue, Green, Red |
Calculating Frame Sizes
Best Practices
Match sample rates to your source
Match sample rates to your source
Use the same sample rate for your virtual device as your audio source to avoid quality loss from resampling.
Send frames at consistent intervals
Send frames at consistent intervals
For smooth audio/video, send frames at regular intervals matching your frame rate or sample rate.
Handle blocking vs non-blocking
Handle blocking vs non-blocking
Use
non_blocking=True for audio devices if you need precise timing control and don’t want writes to block when the buffer is full.Clean up resources
Clean up resources
Virtual devices are automatically cleaned up when the Daily SDK is deinitialized, but explicitly release resources when done for best practices.
Use Cases
AI Voice Assistants
Use virtual microphones to send synthesized speech and speakers to capture user audio for transcription.
Video Bots
Send generated or pre-recorded video content using virtual cameras for automated participants.
Media Processing
Capture call audio/video with virtual speakers/renderers for real-time processing or recording.
Testing
Test your application without physical hardware by using virtual devices with sample media.
Related Resources
CallClient
Learn how to use virtual devices with CallClient
Event Handling
Respond to call events