Recorder library for Picovoice.
Project description
PV_Recorder
A cross platform audio recorder to read one channel and 16kHz samples.
Requirements
- Python 3
Compatibility
- Windows (amd64)
- macOS (x86_64)
- Linux (x86_64)
- Raspberry Pi:
- Zero
- 2
- 3 (32 and 64 bit)
- 4 (32 and 64 bit)
- NVIDIA Jetson Nano
- BeagleBone
Installation
pip3 install pvrecorder
Usage
Getting the list of input devices does not require an instance:
from pvrecorder import PVRecorder
devices = PVRecorder.get_audio_devices()
To start recording initialize the instance and run start:
from pvrecorder import PvRecorder
recorder = PvRecorder(device_index=-1, frame_length=512)
recorder.start()
Get the pcm frames by calling the read function:
pcm = recorder.read()
# do something with pcm
To stop recording just run stop on the instance:
recorder.stop()
Once you are done, free the used resources. You do not have to call stop before delete:
recorder.delete()
Demo
For more detailed information on how to use the pv_recorder python sdk, please that a look at demo.py.
In the following instructions, we will refer to {AUDIO_DEVICE_INDEX}
as the index of the audio device to use, and {OUTPUT_PATH}
as the path to save the audio data in wav
format.
{AUDIO_DEVICE_INDEX}
defaults to -1 and {OUTPUT_PATH}
can be empty if you wish to not save any data.
To show the available audio devices run:
python3 demo.py --show_audio_devices
To run audio recorder run:
python3 demo.py --audio_device_index {AUDIO_DEVICE_INDEX} --output_path {OUTPUT_PATH}
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
Hashes for pvrecorder-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c019ec1c888b4733a6656aefaef915dcfdc6c0a987235c0268f420f6b85cd64 |
|
MD5 | 001815c47b24aaaebfa06d73938f804e |
|
BLAKE2b-256 | 40d46cbe9a242c70b30d8a410280c9e7c8ef8909a91f9c1aa7edd15d7a8aaf0b |