EnergyVAD (voice/vad.py)

SynapseKit · src/synapsekit/voice/vad.py · python · Apache-2.0
voice, Voice / Speech

Voice Activity Detection implementations.

# Source: https://github.com/SynapseKit/SynapseKit | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
"""Voice Activity Detection implementations."""

from __future__ import annotations

import asyncio
import math
import struct
from typing import Any

from .base import BaseVAD


class EnergyVAD(BaseVAD):
    """
    RMS energy-based VAD for 16-bit PCM audio.

    Detects speech by comparing the root-mean-square energy of each frame
    against a normalised threshold.  Runs in a thread to avoid blocking the
    event loop.

    Suitable for quiet environments.  For production use, prefer SileroVAD.

    Parameters
    ----------
    threshold:
        Normalised RMS threshold in [0, 1]

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key