Speaker library for Picovoice.
Project description
PvSpeaker Binding for Python
PvSpeaker
PvSpeaker is an easy-to-use, cross-platform audio player designed for real-time speech audio processing. It allows developers to send raw PCM frames to an audio device's output stream.
Compatibility
- Python 3.8+
- Runs on Linux (x86_64), macOS (x86_64 and arm64), Windows (x86_64), and Raspberry Pi (3, 4, 5).
Installation
pip3 install pvspeaker
Usage
Initialize and start PvSpeaker
:
from pvspeaker import PvSpeaker
speaker = PvSpeaker(
sample_rate=22050,
bits_per_sample=16,
device_index=0)
speaker.start()
(or)
Use get_available_devices()
to get a list of available devices and then initialize the instance based on the index of a device:
from pvspeaker import PvSpeaker
devices = PvSpeaker.get_available_devices()
speaker = PvSpeaker(
sample_rate=22050,
bits_per_sample=16,
device_index=0)
speaker.start()
Write frames of audio:
def get_next_audio_frame():
pass
speaker.write(get_next_audio_frame())
When all frames have been written, run stop()
on the instance:
speaker.stop()
Once you are done, free the resources acquired by PvSpeaker. You do not have to call stop()
before delete()
:
speaker.delete()
Demos
pvspeakerdemo provides command-line utilities for playing audio from a file.
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
Built Distribution
File details
Details for the file pvspeaker-1.0.0.tar.gz
.
File metadata
- Download URL: pvspeaker-1.0.0.tar.gz
- Upload date:
- Size: 3.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3f7cd6efd75c206c0ec1efc9bcfb4cf8a6b8a5877569bdefedd2fe2a6d61ab4 |
|
MD5 | d61cb61cfb06b5eb4c7bde3aef7fcca6 |
|
BLAKE2b-256 | a2c6602e9ecaeb05de070f2b31316f7b47e40b98d31a6a8c2c752e3d64c68181 |
File details
Details for the file pvspeaker-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: pvspeaker-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31c34b8d04c2db6ae25950c898c2ad55536831fc67fe7fac0740a866099002ae |
|
MD5 | 3c70901b1442b600404d004262a818f3 |
|
BLAKE2b-256 | c368e9472084e055fa712a99255a26c4930376315eb51962b039b9342aa3e8e8 |