flutter_realtime_voice_ai library
A Flutter package for streaming voice recording and audio playback with focus on real-time voice interactions.
This package provides:
- Stream recording from device microphones
- Streaming audio playback with buffering support
- State management for recorder and player
- Comprehensive error handling and logging
- Configurable audio quality settings
Basic Usage
Recording
import "package:flutter_realtime_voice_ai/flutter_realtime_voice_ai.dart";
final recorder = VoiceRecorderService();
await recorder.startRecording(
config: StreamConfig.lowLatency(),
onAudioData: (data) => print("Received ${data.length} bytes"),
);
Playback
final player = VoicePlayerService();
player.startBuffering("stream-1");
player.addAudioData(audioBytes);
await player.finalizeBufferAndPlay();
Classes
- AudioChunk
- Represents a chunk of audio data with metadata
- StreamConfig
- Configuration for audio streaming
- VoicePlayerService
- Service responsible for audio playback with streaming and buffering capabilities
- VoiceRecorderService
- Service responsible for audio recording with streaming capabilities
Enums
- VoicePlayerState
- Represents the current state of the voice player
- VoiceRecorderState
- Represents the current state of the voice recorder