$ show fulldecent/FDSoundActivatedRecorder
FDSoundActivatedRecorder is a Swift library for iOS that implements sound-activated audio recording. It automatically starts recording when sound exceeds a dynamic threshold and stops when silence is detected, saving the output as an m4a file with fade-in/fade-out to prevent clicks. The core logic uses a moving average of audio power levels to dynamically adjust trigger thresholds, making it robust to varying noise environments. Built with modern Swift concurrency (actor) for thread safety, it provides a delegate protocol for callbacks and metering updates. The library is self-contained, depends only on standard iOS frameworks, and includes an example app demonstrating integration via SwiftUI.
The LLM identified 1 files worth highlighting for reuse:
The core implementation of the sound-activated recorder. It uses a Swift actor to manage state and concurrency safely, implements a dynamic threshold algorithm based on moving averages of audio power (in dB) to detect speech onset/offset, and applies fade-in/fade-out during audio export to prevent clicks. The component is highly reusable due to its isolation (depends only on AVFoundation/CoreMedia/Foundation), clear delegate protocol for callbacks, and configurable parameters. Demonstrates non-obvious skill in real-time audio state management and thread-safe design using modern Swift concurrency primitives.