Repository navigation
Shruti's Final Project Video
This page provides an overview of Shruti Kalyankar's contribution to the AESD Final Project AviAlert.
AviAlert is a real-time, edge-AI system designed for acoustic classification of bird species. My primary focus was building the entire user-space pipeline, including real-time audio capture from a USB microphone, signal processing and downsampling, integration of the BirdNET neural network via TFLite, and connecting the inference output to the kernel character driver developed by my partner.
The video demonstrates:
- Audio Capture Pipeline: How the USB microphone is configured with ALSA and sounddevice to capture audio at 48kHz, downsample to 16kHz in real time using decimation, and assemble overlapping 1-second windows into a thread-safe queue for inference.
- BirdNET Inference: How each audio window is upsampled, written to a temporary wav file, and passed to birdnetlib's Recording class, which internally uses TFLite with the XNNPACK delegate for accelerated inference on the RPi4's ARM NEON units.
-
Pipeline Integration: How the two-thread architecture (capture thread + inference thread) ensures audio never drops due to inference latency, and how detections above the confidence threshold are written to
/dev/birdclassifierto trigger the LED hardware response.
My most difficult challenge when implementing this project was:
-
Dependency Resolution on Buildroot: Getting the Python ML stack running on a minimal embedded image was significantly harder than on a standard Linux system. Without Python's zlib module compiled in, pip was broken — which cascaded into numpy, librosa, joblib, and numba all failing to import. I had to patch 8 librosa source files to make numba optional, stub out the lzma module, patch joblib's compressor registration, and replace birdnetlib's internal librosa audio loader with Python's standard
wavemodule. Each fix revealed another dependency, requiring careful tracing of import chains across multiple library layers.
The most important topics I learned from this project were:
-
Real-Time Audio Systems: I learned that capturing audio reliably on an embedded CPU requires careful separation of concerns — the capture callback must never block, and inference latency must be isolated in a separate thread with a bounded queue. A maxsize-3 queue with oldest-window dropping was the key to preventing lag from accumulating over time.
-
Embedded ML Constraints: Deploying a neural network on a resource-constrained device is not just about model size — it is about the entire dependency tree. I learned to trace what a library actually needs at runtime versus what it pulls in by default, and to patch third-party libraries when the standard installation path is not viable.
-
Signal Processing Fundamentals: Implementing mel-spectrogram extraction from scratch using pure numpy — without librosa — gave me a deep understanding of what happens inside audio ML pipelines: FFT windowing, Hanning functions, mel filterbanks, power-to-dB conversion, and normalization. Understanding these steps made debugging inference issues significantly easier.
-
Cross-Layer Debugging: The most valuable skill I developed was debugging across layers — from ALSA kernel drivers, through Python audio libraries, through the ML inference stack, all the way to the kernel character driver. Problems at one layer often manifest as symptoms at a completely different layer, and learning to trace the full path was essential.