Skip to main content

A Python library for recording voice using voice actvity detection (VAD). Best for AI voice assistants.

Project description

This is my first repsitory. So, I may not have done everything properly. I expect your understanding.

bensilence

A voice recorder with voice activity detection (VAD). It starts recording when VAD detects speech and stops recording as the speaker stops talking for a second. Best use case would be AI assistants. This is just another version of rhasspy-silence. This library uses Cobra (Picovoice) for VAD, which is better than webRTC that was used in rhasspy-silence.

Installation

  1. Install the package:
    pip install bensilence 
    

Install via GitHub

  1. Clone the repository:
    git clone https://github.com/benimrans/bensilence.git
    cd bensilence
    
  2. Install dependencies:
    pip install -r requirements.txt 
    
  3. Setup:
    py setup.py install 
    

Usage/Examples

You'll need a Picovoice account to get an API key. Once you get it, you are ready to go!

from bensilence import silence

silence = silence(api_key="your_picovoice_api_key")

silence.initialize()

result, file_name = silence.record()

print(result, file_name)

Here are some variables that you may want to change:

These are the default values.

before_seconds = 1 # Adds the unrecorded parts to the recording by going back 1 second from the time the speech started.
silence_threshold = 1 # Stops recording if there's silence for 1 second. 
max_sensitivity = 2 # {1: 0.5, 2: 0.7, 3: 0.9} Value that VAD should detect to start recording.
max_recording_time = 30 # Maximum recording time.

Related

This is the reason why I made this library:

rhasspy-silence

License

MIT

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

bensilence-0.1.4.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

bensilence-0.1.4-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file bensilence-0.1.4.tar.gz.

File metadata

  • Download URL: bensilence-0.1.4.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.0

File hashes

Hashes for bensilence-0.1.4.tar.gz
Algorithm Hash digest
SHA256 afd9c1b98a45a8e94957519c612345750ed45be6c87fe61de242c1d6cbdbd924
MD5 5a4ccf4f9293b71eb061ef0e1cf5b1d7
BLAKE2b-256 4317e7168b2861503f20b388e314e3a77ad443ce9afc494e949060399fe9cc98

See more details on using hashes here.

File details

Details for the file bensilence-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: bensilence-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.0

File hashes

Hashes for bensilence-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c3f5a4bcf78f8749cc1ac31a246a10b38c0da4a160c009b8a1f676b73bed71ef
MD5 0647243b936b7b05bedf624577eb7fe2
BLAKE2b-256 e0f756f1813c721edc6d5105c3379c137253c0cf7c36127fdccdb27bdc625a02

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