Metadata-Version: 2.4
Name: speechgate-rs
Version: 0.1.0
Requires-Dist: numpy>=1.24
Summary: Rust speech gate with Python bindings
Author: di-osc
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# speechgate-rs

Rust implementation of the FASR energy speech gate with Python bindings.

```python
import numpy as np
from speechgate_rs import EnergySpeechGate

audio = np.zeros(16000, dtype=np.float32)
gate = EnergySpeechGate(base_thresh=0.008, max_thresh=0.035)
mask = gate.compute_keep_mask(audio, sample_rate=16000)
gated = gate.apply_array(audio, sample_rate=16000)
```

The binding keeps the same energy-gate semantics as the Python `EnergySpeechGate`
implementation in `fasr-service-realtime`: adaptive RMS thresholding, short
voice-burst removal, short silence-gap filling, padding, silence pass windows,
and fade envelopes.

For performance-sensitive checks, build the native extension in release mode:

```bash
env -u CONDA_PREFIX VIRTUAL_ENV=.venv maturin develop --release
uv run pytest tests -q
```

The test suite includes a NumPy reference implementation and verifies that the
Rust binding returns identical masks/gated output/compacted output while running
faster than the NumPy reference on the benchmark audio.

