Falcon Speaker Diarization
Python API
API Reference for the Python Falcon SDK (PyPI).
pvfalcon.create()
Factory method for Falcon Speaker Diarization engine.
Parameters
access_keystr : AccessKey obtained from Picovoice Console.model_pathOptional[str] : Absolute path to the file containing model parameters (.pv).deviceOptional[str] : String representation of the device (e.g., CPU or GPU) to use. If set tobest, the most suitable device is selected automatically. If set togpu, the engine uses the first available GPU device. To select a specific GPU device, set this argument togpu:${GPU_INDEX}, where${GPU_INDEX}is the index of the target GPU. If set tocpu, the engine will run on the CPU with the default number of threads. To specify the number of threads, set this argument tocpu:${NUM_THREADS}, where${NUM_THREADS}is the desired number of threads.library_pathOptional[str] : Absolute path to Falcon's dynamic library.
Returns
Falcon: An instance of Falcon Speaker Diarization engine.
Throws
pvfalcon.available_devices()
Lists all available devices that Falcon can use for inference. Each entry in the list can be the device argument
of create() factory method or Falcon constructor.
Parameters
library_pathOptional[str] : Absolute path to Falcon's dynamic library. If not set it will be set to the default location.
Returns
- Sequence[str]: List of all available devices that Falcon can use for inference.
Throws
pvfalcon.Falcon
Class for the Falcon Speaker Diarization engine.
Falcon can be initialized either using the module level create() function
or directly using the class __init__() method.
Resources should be cleaned when you are done using the delete() method.
pvfalcon.Falcon.version
The version string of the Falcon library.
pvfalcon.Falcon.sample_rate
The audio sample rate the Falcon accepts.
pvfalcon.Falcon.__init__()
__init__ method for Falcon Speaker Diarization engine.
Parameters
access_keystr : AccessKey obtained from Picovoice Console.model_pathstr : Absolute path to the file containing model parameters (.pv).devicestr : String representation of the device (e.g., CPU or GPU) to use. If set tobest, the most suitable device is selected automatically. If set togpu, the engine uses the first available GPU device. To select a specific GPU device, set this argument togpu:${GPU_INDEX}, where${GPU_INDEX}is the index of the target GPU. If set tocpu, the engine will run on the CPU with the default number of threads. To specify the number of threads, set this argument tocpu:${NUM_THREADS}, where${NUM_THREADS}is the desired number of threads.library_pathstr : Absolute path to Falcon's dynamic library.
Returns
Falcon: An instance of Falcon Speaker Diarization engine.
Throws
pvfalcon.Falcon.delete()
Releases resources acquired by Falcon.
pvfalcon.Falcon.process()
Processes the given audio data and returns the diarization output. The audio needs to have a sample rate equal
to .sample_rate and be 16-bit linearly-encoded. This function operates on single-channel
audio.
If you wish to process data in a different sample rate or format consider
using .process_file().
Parameters
pcmSequence[int] : Audio data.
Returns
- Sequence[Segment] : Diarization output as a sequence of segments. Each segment is a tuple of
(start_sec, end_sec, speaker_tag).
Throws
pvfalcon.Falcon.process_file()
Processes a given audio file and returns the diarization output. The supported audio formats
are: 3gp (AMR), FLAC, MP3, MP4/m4a (AAC), Ogg, WAV, and WebM.
Parameters
audio_pathstr : Absolute path to the audio file.
Returns
- Sequence[Segment] : Diarization output as a sequence of segments. Each segment is a tuple of
(start_sec, end_sec, speaker_tag).
Throws
pvfalcon.list_hardware_devices()
Lists all available devices that Falcon can use for inference. Each entry in the list can be the device argument
of create() factory method or Falcon constructor.
Internal method. The higher level pvfalcon.available_devices() should be used instead.
Parameters
library_pathstr : Absolute path to Falcon's dynamic library.
Returns
- Sequence[str]: List of all available devices that Falcon can use for inference.
Throws
pvfalcon.Falcon.Segment
Named tuple for representing a speaker diarization segment.
start_secfloat : Start time of the segment in seconds.end_secfloat : End time of the segment in seconds.speaker_tagint : Speaker tag identifier - a non-negative integer that uniquely identifies a speaker.
pvfalcon.FalconError
Error thrown if an error occurs within Falcon Speaker Diarization engine.
Exceptions