Sound Detection
Sound Detection analyzes audio frames with an FFT spectrogram and emits a SoundEvent when configured threshold rules are crossed. Use it to turn knocks, alarms, glass breaks, shouts, machine noise, or other audio spikes into Banalytics automation signals.
Audio events for automation
The task compares the current audio spectrum with a learned or fixed threshold model. When the configured condition is satisfied, it fires a SoundEvent. If the task is placed before Motion Recording or Motion Image Shot, an accepted sound event can also set AUDIO_MOTION_DETECTED and start recording or snapshot capture even when video motion is absent.
Audio input requirements
Audio frames are available
The upstream grabber, camera, playback source, or audio input component must provide audio frames. Keep audio enabled in the media source when sound-based events are required.
Start with debug tuning
Enable Debug only while selecting thresholds. Debug emits extra event data with FFT magnitudes and moving averages, which is helpful for tuning but noisy in production.
Connect downstream actions
Use Event Manager, Motion Recording, Motion Image Shot, Telegram, email, or custom actions to react to accepted sound events.
Adding the sound detection task
Choose the audio source
Use a camera stream with audio, an Audio Input component, or a playback source that includes audio data.
Add Sound Detection
Add the task under the source or capture task that delivers audio frames.
Select the threshold model
Start with Relative for most environments. Switch to Absolute or Proportional only when the sound source behavior requires it.
Tune threshold and history
Raise the threshold to reduce false events, lower it if real sounds are missed, and adjust spectrum and history settings to match the noise profile.
Configuration parameters
These are the parameters available when configuring Sound Detection.
| Parameter | Required | Description | Default |
|---|---|---|---|
ID | Yes | Unique identifier generated automatically for this task instance. Read-only. | Auto |
Restart on failure | Yes | Controls how the task is restarted after an error: stop on failure, immediately, 10 sec, 30 sec, or 1 min. | 10 sec |
Debug | Yes | Emits diagnostic sound data with current FFT magnitudes and moving averages. Enable only while tuning because it can create a high event volume. | false |
Threshold type | Optional | Threshold calculation mode: Relative, Absolute, or Proportional. | Relative |
Threshold | Optional | Detection threshold value. Increase to reduce false events from wind, hum, traffic, rain, or microphone noise. Decrease when real sounds are missed. | 10 |
Spectral sensitivity | Optional | Number of frequency ranges analyzed. Valid range is 10 to 100. Higher values provide more detail but cost more CPU and can be more sensitive to tuning mistakes. | 40 |
History length | Yes | Length of the background analysis buffer. Valid range is 1 to 20. Longer history is more stable but adapts more slowly. | 10 |
Apply upon threshold exceed | Yes | When enabled, threshold-exceeding sounds can be learned into the background model. Use it for recurring or slowly changing loud noise that should not trigger continuously. | false |
Speed of accustom (sec) | Conditional | Background adaptation speed when Apply upon threshold exceed is enabled. Lower values adapt faster; higher values preserve sensitivity longer. | 1 |
Choosing the right threshold model
Relative
Best starting point for rooms, offices, streets, and camera microphones with changing ambient noise. It compares current spectrum values with the learned background average.
Absolute
Use when microphone gain and background level are stable and you want a fixed trigger level. It is simple but can be too sensitive in noise or too insensitive in quiet, low-gain recordings.
Proportional
Use when relative growth matters more than absolute amplitude, for example a quiet room where a sound several times louder than baseline should trigger. Tune carefully when baseline values are very low.
Recommended profiles
General audio motion
Threshold type = Relative, Threshold = 10, Spectral sensitivity = 40, History length = 10, Apply upon threshold exceed = false.
Quiet room or sensitive alarm
Use Relative or Proportional, lower the threshold, set Spectral sensitivity to 40-80, and keep Apply upon threshold exceed disabled so short abnormal sounds remain abnormal.
Noisy outdoor camera
Use Relative, a higher threshold, Spectral sensitivity = 20-40, History length = 15-20, and enable adaptation with Speed of accustom = 5-20.
Stable microphone with known levels
Use Absolute and tune the threshold from debug magnitudes. Keep spectral sensitivity moderate and history shorter when the environment is predictable.
Machinery or repeating background noise
Use Relative, higher spectral sensitivity, a stable history length, and threshold-exceed adaptation so normal cycles are learned while short anomalies still trigger.