Home/Projects/Sonar: Real-Time On-Device Speech Intelligence & Diarization
Edge AI / Embedded SystemsEdge AI & Embedded Machine Learning Systems Featured Case Study

Sonar: Real-Time On-Device Speech Intelligence & Diarization

Engineered an edge speech intelligence system running entirely on a Raspberry Pi 5. Combines USB audio ingestion, Silero VAD v5, dual-stream ECAPA2 diarization with AOSC adaptation, and faster-whisper INT8 ASR.

System Visual ExhibitInteractive Vector Canvas
Raspberry Pi 5 Dual-Stream Pipeline

Hardware architecture showing USB ALSA capture, NumPy SIMD decimation, Silero VAD, and parallel CTranslate2 + ECAPA2 execution.

4 Pipeline Stages•6 Core Modules
Live Studio Tab

End-to-End Latency

2,433.5 ms

49.8% Faster

Speaker Accuracy

93.3%

+11.9%

CPU Utilization

68% avg

Thermals <62°C

RAM Footprint

1.15 GB

-66.2%
Executive Abstract & Formulation

Sonar is an edge speech intelligence and speaker diarization engine deployed completely on-device on a Raspberry Pi 5 without cloud reliance. Captures 48kHz audio via ALSA, decimates 3:1 to 16kHz mono, and filters speech with Silero VAD v5. Operates a dual-stream architecture: Stream A extracts 512-D ECAPA2 speaker embeddings with exponential moving average profile adaptation, while Stream B transcribes live speech with faster-whisper small.en quantized to INT8 via CTranslate2. In verified hardware trials on Broadcom BCM2712, Sonar processed 49.2 seconds of conversational speech across 15 utterances with 2,433.5ms end-to-end latency and 93.3% speaker attribution accuracy.

Problem Addressed:

Cloud-dependent speech diarization suffers from unacceptable network latency, privacy violations in confidential environments, and recurring API costs. Deploying dual-stream diarization and transcription on edge ARM hardware requires aggressive memory optimization and CPU parallelism.

End-to-End System Dataflow

Expandable Vector Architecture
Sonar: Real-Time On-Device Speech Intelligence & Diarization — System Architecture
Synthesizing architecture vector graph...
Verified System Pipeline ArchitectureInteractive Canvas

System Execution Pipeline

1Stage 1

Hardware Ingestion & SIMD Decimation

Captures raw 48kHz audio directly from the USB microphone via Linux ALSA, applying 3:1 SIMD decimation down to 16kHz 16-bit PCM mono.

2Stage 2

Silero VAD v5 Speech Gating

Evaluates 512-sample frame windows through Silero VAD v5, gating non-speech silence and passing active speech bursts to the inference queue.

3Stage 3

Dual-Stream Diarization & Transcription

Stream A extracts 512-D ECAPA2 speaker embeddings with AOSC clustering, while Stream B transcribes speech tokens in parallel using faster-whisper small.en INT8.

4Stage 4

SCDiar Alignment & Telemetry

Aligns word timestamp boundaries with active speaker clusters, publishing real-time attributed transcripts over WebSockets to the web dashboard.

Core Architectural Components Breakdown

ALSA Audio Ingest & Decimator

Audio Acquisition & Resampling

Direct ALSA hardware access with vectorized NumPy 3:1 decimation filter.

Inputs:USB microphone 48kHz 24-bit PCM stream
Outputs:Standardized 16kHz 16-bit PCM mono audio

Silero VAD v5

Voice Activity Detection

Lightweight deep neural network evaluating 512-sample frame probabilities with 300ms hangover.

Inputs:16kHz PCM audio buffer
Outputs:Speech segment boundaries (start/end timestamps)

SpeechBrain ECAPA2

Speaker Embedding Extraction

Time-delay neural network extracting 512-dimensional speaker acoustic identity vectors.

Inputs:Speech segment audio chunk
Outputs:512-D speaker identity embedding vector

AOSC Profile Adaptation

Dynamic Speaker Tracking

Adaptive Online Speaker Clustering with exponential moving average (EMA, alpha=0.15) updating centroid profiles.

Inputs:New 512-D embedding + existing cluster centroids
Outputs:Updated speaker cluster ID assignment

faster-whisper small.en (INT8)

Streaming Automatic Speech Recognition

Quantized INT8 Transformer running on CTranslate2 utilizing 4 ARM Cortex-A76 cores.

Inputs:Normalized 16kHz speech segment
Outputs:Timestamped token and word sequence

SCDiar Token Aligner

Temporal Cross-Modal Synchronization

Synchronizes word start/end timestamps with active speaker cluster intervals.

Inputs:Token stream + Speaker cluster intervals
Outputs:Attributed transcript: [Speaker ID, Timestamp, Text]