Skip to main content

Silero plugin for GetStream

Project description

Silero Voice Activity Detection Plugin

A fast and accurate Voice Activity Detection (VAD) plugin for GetStream that uses the Silero VAD model.

Installation

pip install getstream-plugins-silero

Usage

from getstream.plugins.silero import SileroVAD
from getstream.video.rtc.track_util import PcmData

# Initialize with default settings
vad = SileroVAD()

# Or customize parameters
vad = SileroVAD(
    sample_rate=16000,
    frame_size=512,
    silence_threshold=0.3,
    speech_pad_ms=300,
    min_speech_ms=250,
    max_speech_ms=60000,
)

# Register event handlers
@vad.on("audio")
async def on_audio(pcm_data, user):
    print(f"Detected speech: {pcm_data.duration:.2f} seconds")
    # Process the detected speech with an STT engine
    # await stt.process_audio(pcm_data)

# Process incoming audio
incoming_audio = PcmData(samples=audio_bytes, sample_rate=16000, format="s16")
await vad.process_audio(incoming_audio)

# Reset state if needed
await vad.reset()

Configuration Options

  • sample_rate: Audio sample rate in Hz (default: 16000)
  • frame_size: Size of audio frames to process (default: 512)
  • silence_threshold: Threshold for detecting silence (0.0 to 1.0) (default: 0.5)
  • speech_pad_ms: Number of milliseconds to pad before/after speech (default: 300)
  • min_speech_ms: Minimum milliseconds of speech to emit (default: 250)
  • max_speech_ms: Maximum milliseconds of speech before forced flush (default: 30000)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vision_agents_plugins_silero-0.0.18.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vision_agents_plugins_silero-0.0.18-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file vision_agents_plugins_silero-0.0.18.tar.gz.

File metadata

File hashes

Hashes for vision_agents_plugins_silero-0.0.18.tar.gz
Algorithm Hash digest
SHA256 4da60689340953205393210771e3b5686e88ec654dcb767a10bf0d57f8c69120
MD5 c84d7e13657681148c2309b8d2f9f584
BLAKE2b-256 bc6895b0baf2a91154eaf3358364c899801a2a6a7a1ddae6f6c6d14f40817423

See more details on using hashes here.

File details

Details for the file vision_agents_plugins_silero-0.0.18-py3-none-any.whl.

File metadata

File hashes

Hashes for vision_agents_plugins_silero-0.0.18-py3-none-any.whl
Algorithm Hash digest
SHA256 b63e3ebe009c4e6cfa01a350a65e26ec85b4f167abf26b4a485bbee7b997177a
MD5 5dc4c5a896ce5f09a10a6e8bb916a900
BLAKE2b-256 33dc5d8ab8a77a3245b8e937e42046d1cf184e0f16625e3c002e34e0df6e52a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page