Lightweight, Triggered Audio Recorder for Pi

Job ID: 40440085

Budget: £10 – £150 GBP

I need a command-line application that runs on a Raspberry Pi Zero 2 W and records audio when triggered by environmental sound. The tool needs to listen continuously and trigger a recording when it detects sound over a pre-specified frequency and amplitude. Recordings also need to include a buffer *before* the trigger event.

So point by point, the tool needs to:
– sample continuously while consuming minimal power, using 384 kHz as the default sampling rate
– watch incoming samples in real time, trigger when both a user-defined frequency band and amplitude threshold are exceeded, including a pre-event buffer so the beginning of the sound is not lost
– continue recording for a configurable post-trigger period, or until a maximum file length is reached
– save file as uncompressed WAV and continue recording.

The tool needs command-line options for setting the:
– start / end of the listening time window
– sampling rate
– trigger frequency and amplitude
– pre- and post-trigger record time
– maximum recording length
– output filename template.

It needs to be extremely lightweight so as to run on a Raspberry Pi Zero 2 W with minimal power usage, so likely will need to be written in C/C++. The finished source will be published under an open-source licence, so the code must be clean, documented and buildable with a simple Makefile on Raspberry Pi OS (Trixie).

Deliverables
1. Compilable source code with README covering build, install and usage examples.
2. A test script or procedure I can run on a Pi Zero 2 W to confirm trigger accuracy, buffer inclusion and low CPU load.