Skip to content

Silence detection

Silence detection can be helpful for test purposes, for example, if you need to check your audio equipment for workabilty. For this, it would be useful to have an active working stream source and some indication when silence occurs in it.

Flussonic allows you to turn on silence detection on a stream and specify a threshold value of the sound level to tell Flussonic what it must consider silence. Flussonic will then generate events to inform you when silence occures and when the sound reappears. The events are generated only for active sources, not for lost ones. When a lost source reappears, Flussonic resumes to detect silence.

If a stream contains a number of audio tracks, Flussonic detects silence in the first of them.

To enable silence detection on a stream:

  1. Open the Flussonic configuration file.
  2. Add the silencedetect option into the stream configuration:

    stream example { input udp://127.0.0.1:5500; silencedetect duration=20 interval=10 noise=-30dB; }

    Here:

    • duration (in seconds) — the duration of a continuous time interval during which silence must last for Flussonic to generate an appropriate event.
    • interval (in seconds) — Flussonic will keep sending the event audio_silence_detected once upon the specified time interval until the sound reappears in the source.
    • noise — the threshold value of the sound level. Sound of this and lower level will be considered by Flussonic as silence.

    The configuration in the example means that if the sound is not louder than -30dB for at least 20 seconds, then Flussonic starts to generate the event audio_silence_detected every 10 seconds until the sound reappears.

  3. Subscribe to the events audio_silence_detected and audio_silence_end, for example:

    notify events { sink log:///var/log/flussonic/audio_silence.log; only event=stream_media_info,audio_silence_detected,audio_silence_end; }

    Here:

    • audio_silence_detected — this event is generated when the sound level is not higher than the value specified in noise, for the time specified in duration.
    • audio_silence_end — this event is generated when the sound reappears in the source.