Intents for Home Assistant
Project description
Energy VAD
Simple energy-based voice activity detector (VAD) with no external dependencies.
Energy threshold is calibrated from initial audio, or can be set manually.
Installation
pip install energy-vad
Example
import wave
from energy_vad import EnergyVad
vad = EnergyVad()
with wave.open("test.wav", "rb") as wav_file:
assert wav_file.getframerate() == 16000
assert wav_file.getsampwidth() == 2
assert wav_file.getnchannels() == 1
chunk = wav_file.readframes(vad.samples_per_chunk)
while len(chunk) == vad.bytes_per_chunk:
result = vad.process_chunk(chunk)
if result is None:
# calibrating
pass
elif result:
# speech
print("!", end="")
else:
# silence
print(".", end="")
chunk = wav_file.readframes(vad.samples_per_chunk)
print("")
print("Energy threshold:", vad.threshold)
# Clear calibrated threshold
vad.reset_calibration()
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
energy_vad-1.0.0.tar.gz
(4.1 kB
view details)
Built Distribution
File details
Details for the file energy_vad-1.0.0.tar.gz
.
File metadata
- Download URL: energy_vad-1.0.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27e390e7280577de4a3c6541e8aeaff0ae2b3cb834f58c8e3b10b25a95e0f755 |
|
MD5 | 8724dfc43e079d2c4ae310dead5f5c2c |
|
BLAKE2b-256 | 041fadd776bfa7ece604aa0b4ae113b134cfbb2ad17705ac49832defdd3d14ee |
File details
Details for the file energy_vad-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: energy_vad-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f17faabfdd47b51f1abbe246180313fa124af9372b09b897072b4d4270e3b9b |
|
MD5 | 5b23d0aed90389db388c47ab74e24a97 |
|
BLAKE2b-256 | 3c7cf5df8c919694b5df73e9a800b3bafdf301132c9189c468c18a1fef80a0e2 |