You need to enable JavaScript to run this app.
Lake AI Service

Lake AI Service

Copy page
Download PDF
Audio processing
Audio silence detection
Copy page
Download PDF
Audio silence detection

Operator introduction

Description

Audio silence detection processor that intelligently identifies whether audio is completely silent

Key features

  • Silence detection: Analyzes the entire audio file to determine whether it is silent
  • Configurable threshold: Supports custom sensitivity threshold (dB) for silence detection
  • Efficient processing: Optimized volume analysis algorithm for fast processing speed
  • Accurate analysis: Determines silence status using professional volume detection technology
  • Supports local files, HTTP/HTTPS URLs, and TOS/S3 storage

Format support

  • Input: Mainstream audio formats such as MP3, WAV, FLAC, AAC, M4A, and OGG
  • Detection algorithm: Based on professional volume analysis technology
  • Sampling rate: Automatically adapts to various sampling rates
  • Channels: Supports mono and multi-channel audio

Detection principle

  • Volume threshold detection: Analyzes the maximum and average volume of the audio
  • Silence determination: When the maximum volume is lower than the set threshold, the audio is considered silent
  • Lossless analysis: Uses professional audio processing technology to ensure analysis accuracy

Daft call

Operator parameters

Input

Input column name

Note

audio_inputs

Column storing audio paths or binary data

Output

A Boolean column storing the results of silence detection: True indicates silence, False indicates non-silence, and None indicates processing failure or no channel

Parameters

If a parameter does not have a default value, it is required

Parameter name

Type

Default value

Description

silence_threshold_db

float

-60.0

Silence volume threshold (dB). When the maximum volume of the audio is lower than this value, it is considered silent. Default value: -60.0 (dB)

timeout

int or None

None

Timeout for processing a single audio file (seconds). If set to None, there is no limit. Default value: None

Examples

The following code demonstrates how to use Daft (for distributed environments) to run the operator for audio silence detection.

from __future__ import annotations

import os

import daft
from daft import col
from daft.las.functions.audio import AudioSilenceDetection
from daft.las.functions.udf import las_udf

if __name__ == "__main__":
    TOS_TEST_DIR_URL = os.getenv("TOS_TEST_DIR_URL", "las-cn-beijing-public-online.tos-cn-beijing.volces.com")

    if os.getenv("DAFT_RUNNER", "native") == "ray":
        import logging

        import ray

        def configure_logging():
            logging.basicConfig(
                level=logging.INFO,
                format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
                datefmt="%Y-%m-%d %H:%M:%S",
            )
            logging.getLogger("tracing.span").setLevel(logging.WARNING)
            logging.getLogger("daft_io.stats").setLevel(logging.WARNING)
            logging.getLogger("DaftStatisticsManager").setLevel(logging.WARNING)
            logging.getLogger("DaftFlotillaScheduler").setLevel(logging.WARNING)
            logging.getLogger("DaftFlotillaDispatcher").setLevel(logging.WARNING)

        ray.init(dashboard_host="0.0.0.0", runtime_env={"worker_process_setup_hook": configure_logging})
        daft.set_runner_ray()

    daft.set_execution_config(actor_udf_ready_timeout=600)
    daft.set_execution_config(min_cpu_per_task=0)

    samples = {
        "input_path": [
            f"https://{TOS_TEST_DIR_URL}/public/archive/audio_silence_detection/sample_silence.wav",
            f"https://{TOS_TEST_DIR_URL}/public/archive/audio_silence_detection/sample_speech.wav",
        ],
    }
    ds = daft.from_pydict(samples)

    # Using Daft to detect silence in audio files
    constructor_kwargs = {
        "silence_threshold_db": -60.0,
        "timeout": 30,
    }

    ds = ds.with_column(
        "is_silence",
        las_udf(
            AudioSilenceDetection,
            construct_args=constructor_kwargs,
            num_cpus=1,
            concurrency=1,
            batch_size=1,
        )(col("input_path")),
    )

    ds.show()
    # ╭────────────────────────────────┬────────────╮
    # │ input_path                     ┆ is_silence │
    # │ ---                            ┆ ---        │
    # │ String                         ┆ Bool       │
    # ╞════════════════════════════════╪════════════╡
    # │ https://las-public-data-qa.to… ┆ true       │
    # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
    # │ https://las-public-data-qa.to… ┆ false      │
    # ╰────────────────────────────────┴────────────╯
Last updated: 2026.05.12 19:06:34