SpeechEdge
Low latency cross-platform audio capture SDK for Flutter with:
- Microphone capture abstraction
- Echo cancellation / noise suppression / auto gain flags
- PCM16 little-endian chunking
- Real-time WebSocket streaming
Current status
This repo now contains:
- A reusable SDK API in
lib/speech_edge.dart - A runnable demo app in
lib/main.dart
The SDK uses the record plugin for cross-platform capture and web_socket_channel for transport.
Install
dependencies:
speech_edge:
path: .
Usage
import 'package:speech_edge/speech_edge.dart';
final client = SpeechEdgeClient(
config: const SpeechEdgeConfig(
sampleRate: 16000,
channels: 1,
chunkSizeBytes: 3200,
echoCancellation: true,
noiseSuppression: true,
autoGainControl: true,
payloadMode: SpeechEdgePayloadMode.rawPcm16leBinary,
),
);
await client.connectWebSocket(Uri.parse('ws://localhost:8080/stream'));
await client.startCapture();
client.chunks.listen((chunk) {
// local access to PCM bytes
print('chunk ${chunk.sequence} => ${chunk.pcm16le.length} bytes');
});
Platform setup
- Android:
RECORD_AUDIOpermission is required and already added. - iOS/macOS: microphone usage descriptions are required and already added.
- macOS sandbox: audio input + network client entitlements are required and already added.
- Web: browser mic permission and secure context (HTTPS or localhost) are required.
Notes
- DSP controls (
echoCancellation,noiseSuppression,autoGainControl) are best-effort and depend on OS/device support. - Payload can be raw PCM binary frames or JSON with base64 payload.