cjm-media-plugin-silero-vad
Install
pip install cjm_media_plugin_silero_vad
Project Structure
nbs/
└── plugin.ipynb # Pure-compute voice-activity-detection tool capability using Silero VAD (Option C, stage 8).
Total: 1 notebook
Module Dependencies
graph LR
plugin["plugin<br/>Silero VAD Plugin"]
No cross-module dependencies detected.
CLI Reference
No CLI commands found in this project.
Module Overview
Detailed documentation for each module in the project:
Silero VAD Plugin (plugin.ipynb)
Pure-compute voice-activity-detection tool capability using Silero VAD (Option C, stage 8).
Import
from cjm_media_plugin_silero_vad.plugin import (
SileroVADConfig,
SileroVADPlugin
)
Classes
@dataclass
class SileroVADConfig:
"Configuration for Silero VAD parameters."
threshold: float = field(...)
min_speech_duration_ms: int = field(...)
min_silence_duration_ms: int = field(...)
speech_pad_ms: int = field(...)
use_onnx: bool = field(...)
class SileroVADPlugin:
def __init__(self):
"""Initialize the Silero VAD plugin."""
self.logger = logging.getLogger(f"{__name__}.{type(self).__name__}")
self.config: SileroVADConfig = None
"""
Voice Activity Detection tool capability using Silero VAD (stage 8: pure compute).
Native-surface model (PILLAR 1c): this tool is PURE COMPUTE — `detect_speech`
reads MODEL-READY audio, runs Silero inference, and builds the typed
`VADResult`. The cache-check + persistence bookends + the per-call `force`
control live in the generic VAD adapter (cjm-vad-adapter-interface); the
result DTO lives in cjm-capability-primitives; identity is derived from the
installed distribution. No `get_plugin_metadata`, no `self.storage`, no
librosa (decode/resample is upstream ffmpeg, soxr).
"""
def __init__(self):
"""Initialize the Silero VAD plugin."""
self.logger = logging.getLogger(f"{__name__}.{type(self).__name__}")
self.config: SileroVADConfig = None
"Initialize the Silero VAD plugin."
def name(self) -> str: # Plugin name identifier
"""Plugin identity, derived from the installed distribution (PILLAR 1c)."""
from importlib.metadata import metadata, packages_distributions
dist = (packages_distributions().get(__package__) or [__package__.replace("_", "-")])[0]
return metadata(dist)["Name"]
@property
def version(self) -> str: # Plugin version string
"Plugin identity, derived from the installed distribution (PILLAR 1c)."
def version(self) -> str: # Plugin version string
"""Get the plugin version string."""
from cjm_media_plugin_silero_vad import __version__
return __version__
def get_current_config(self) -> Dict[str, Any]: # Current configuration as dictionary
"Get the plugin version string."
def get_current_config(self) -> Dict[str, Any]: # Current configuration as dictionary
"""Return current configuration state."""
return config_to_dict(self.config) if self.config else {}
def get_config_schema(self) -> Dict[str, Any]: # JSON Schema for configuration
"Return current configuration state."
def get_config_schema(self) -> Dict[str, Any]: # JSON Schema for configuration
"""Return JSON Schema for UI generation."""
return dataclass_to_jsonschema(SileroVADConfig)
def _apply_config(
self,
config: Optional[Any] = None # Configuration dataclass, dict, or None
) -> None
"Return JSON Schema for UI generation."
def initialize(
self,
config: Optional[Any] = None # Configuration dataclass, dict, or None
) -> None
"First-time setup. CR-4: config application is factored into _apply_config;
the substrate's reconfigure(old, new) fires _release_model on a use_onnx
change (RELOAD_TRIGGER) then re-applies config. No storage init — the
adapter owns the cache (stage 8)."
def detect_speech(
self,
audio: Union[str, Path], # Path to MODEL-READY audio (mono 8k/16k, converted upstream)
**kwargs # Provenance pass-through (unused by VAD compute)
) -> VADResult: # Typed VAD output with detected speech segments
"Detect speech segments in model-ready audio — PURE COMPUTE.
Stage 8 / PILLAR 1c: the cache-check + persistence bookends + the per-call
`force` control moved to the generic VAD adapter; this method reads the
audio, runs Silero, and builds the typed result. Detection params come
from `self.config` (no per-call kwarg override — the tool runs its
effective config)."
def is_available(self) -> bool: # True if Silero VAD is available
"""Check if Silero VAD is available."""
return SILERO_AVAILABLE
def prefetch(self) -> None
"Check if Silero VAD is available."
def prefetch(self) -> None:
"""CR-4 (SG-19): eagerly load the model so the first call doesn't pay the load cost."""
self._load_model()
def on_disable(self) -> None
"CR-4 (SG-19): eagerly load the model so the first call doesn't pay the load cost."
def on_disable(self) -> None:
"""CR-2: release the model when the operator disables the plugin (worker stays alive)."""
self._release_model()
def cleanup(self) -> None
"CR-2: release the model when the operator disables the plugin (worker stays alive)."
def cleanup(self) -> None
"Release resources on unload."
Metadata
Release files for cjm-media-plugin-silero-vad 0.0.27
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| cjm_media_plugin_silero_vad-0.0.27.tar.gz | 12.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cjm_media_plugin_silero_vad-0.0.27-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.6 kB
Release files / cjm_media_plugin_silero_vad-0.0.27.tar.gz
| Download URL | cjm_media_plugin_silero_vad-0.0.27.tar.gz |
|---|---|
| Size | 12.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
10953b82e7017d974418a9c174bfc416b7a7e72a4a3f3a8258d8e4abeccf5676
|
|
BLAKE2b-256 checksum How to use checksums |
fbe8ecc286c39bd79df8b4ba8510af68dfedade404aba37b93ef3b5fe3a9ffec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / cjm_media_plugin_silero_vad-0.0.27-py3-none-any.whl
| Download URL | cjm_media_plugin_silero_vad-0.0.27-py3-none-any.whl |
|---|---|
| Size | 13.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
50be0e6eb39880ea86e01144dad8c091f7428ffe0b76fc8f6893fe6113045995
|
|
BLAKE2b-256 checksum How to use checksums |
fdbee49489628ecb68a5b5b4fa72625d8a3b9b37fe3a852927b514cb3057f006
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Security for cjm-media-plugin-silero-vad 0.0.27
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.