A local, persistent Voice Activity Detection (VAD) worker for the cjm-plugin-system that provides high-accuracy speech segmentation using Silero VAD with SQLite result caching.
Project description
cjm-media-plugin-silero-vad
Install
pip install cjm_media_plugin_silero_vad
Project Structure
nbs/
├── meta.ipynb # Metadata introspection for the Silero VAD plugin used by cjm-ctl to generate the registration manifest.
└── plugin.ipynb # Plugin implementation for Voice Activity Detection using Silero VAD with SQLite result caching.
Total: 2 notebooks
Module Dependencies
graph LR
meta[meta<br/>Metadata]
plugin[plugin<br/>Silero VAD Plugin]
plugin --> meta
1 cross-module dependencies detected
CLI Reference
No CLI commands found in this project.
Module Overview
Detailed documentation for each module in the project:
Metadata (meta.ipynb)
Metadata introspection for the Silero VAD plugin used by cjm-ctl to generate the registration manifest.
Import
from cjm_media_plugin_silero_vad.meta import (
get_plugin_metadata
)
Functions
def get_plugin_metadata() -> Dict[str, Any]: # Plugin metadata for manifest generation
"""Return metadata required to register this plugin with the PluginManager."""
# Fallback base path (current behavior for backward compatibility)
base_path = os.path.dirname(os.path.dirname(sys.executable))
# Use CJM config if available
cjm_data_dir = os.environ.get("CJM_DATA_DIR")
# Plugin data directory
plugin_name = "cjm-media-plugin-silero-vad"
if cjm_data_dir
"Return metadata required to register this plugin with the PluginManager."
Silero VAD Plugin (plugin.ipynb)
Plugin implementation for Voice Activity Detection using Silero VAD with SQLite result caching.
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(...)
sampling_rate: 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 plugin using Silero VAD."
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
"""Get the plugin name identifier."""
return "silero-vad"
@property
def version(self) -> str: # Plugin version string
"Get the plugin name identifier."
def version(self) -> str: # Plugin version string
"""Get the plugin version string."""
return "1.0.0"
@property
def supported_media_types(self) -> List[str]: # Supported media types
"Get the plugin version string."
def supported_media_types(self) -> List[str]: # Supported media types
"""Get the list of supported media types."""
return ["audio", "video"]
def get_current_config(self) -> Dict[str, Any]: # Current configuration as dictionary
"Get the list of supported media types."
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 initialize(
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
"Initialize or re-configure the plugin (idempotent)."
def execute(
self,
media_path: Union[str, Path], # Path to media file to analyze
force: bool = False, # If True, ignore cache and re-run
**kwargs # Override config parameters for this run
) -> MediaAnalysisResult: # Analysis result with detected speech segments
"Run VAD on the audio file."
def is_available(self) -> bool: # True if Silero VAD is available
"""Check if Silero VAD is available."""
return SILERO_AVAILABLE
def cleanup(self) -> None
"Check if Silero VAD is available."
def cleanup(self) -> None:
"""Clean up resources."""
if self._model is not None
"Clean up resources."
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cjm_media_plugin_silero_vad-0.0.2.tar.gz.
File metadata
- Download URL: cjm_media_plugin_silero_vad-0.0.2.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fcd267cc84daf969616e8299649d3c36ab97dd08e318c249fa6feb37cb9b8c05
|
|
| MD5 |
e147f1fde345663ed9dbaea733adc811
|
|
| BLAKE2b-256 |
fc0de3c691ef73d0a44cfd5196735d6d755adf6f6c21126b18c349e081692d29
|
File details
Details for the file cjm_media_plugin_silero_vad-0.0.2-py3-none-any.whl.
File metadata
- Download URL: cjm_media_plugin_silero_vad-0.0.2-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64ad33f782315b84151c8aac843bb11a851f70d5041931bf8361795e14814296
|
|
| MD5 |
c0f811dab18682d1cb6d081123529c41
|
|
| BLAKE2b-256 |
a473c90af588fd059cb7f41d3d6f8dbd71adc0a8554b8d387c9902c886f957f8
|