Picovoice Wordmark
Start Free
Introduction
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSNode.jsPythonWeb
SummaryPicovoice picoLLMGPTQ
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-TextWhisper Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeWeb
SummaryPicovoice CheetahAzure Real-Time Speech-to-TextAmazon Transcribe StreamingGoogle Streaming ASRMoonshine StreamingVosk StreamingWhisper.cpp Streaming
FAQ
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSNode.jsPythonWeb
SummaryAmazon PollyAzure TTSElevenLabsOpenAI TTSPicovoice Orca
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
SummaryPicovoice KoalaMozilla RNNoise
Introduction
AndroidCiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidCNode.jsPythoniOSWeb
SummaryPicovoice EaglepyannoteSpeechBrainWeSpeaker
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
SummaryPicovoice FalconAmazon TranscribeAzure Speech-to-TextGoogle Speech-to-Textpyannote
Introduction
AndroidArduinoCChrome.NETEdgeFirefoxFlutteriOSJavaLinuxmacOSMicrocontrollerNode.jsPythonRaspberry PiReactReact NativeSafariWebWindows
AndroidC.NETFlutteriOSJavaMicrocontrollerNode.jsPythonReactReact NativeWeb
SummaryPicovoice PorcupineSnowboyPocketSphinx
Wake Word TipsFAQ
Introduction
AndroidArduinoCChrome.NETEdgeFirefoxFlutteriOSJavaLinuxmacOSMicrocontrollerNode.jsPythonRaspberry PiReactReact NativeSafariWebWindows
AndroidC.NETFlutteriOSJavaMicrocontrollerNode.jsPythonReactReact NativeWeb
SummaryPicovoice RhinoGoogle DialogflowAmazon LexIBM WatsonMicrosoft LUIS
Expression SyntaxFAQ
Introduction
AndroidArduinoC.NETiOSLinuxmacOSMicrocontrollerNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSMicrocontrollerNode.jsPythonWeb
SummaryPicovoice CobraWebRTC VADSilero VAD
FAQ
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
Introduction
AndroidC.NETFlutteriOSNode.jsPythonReact NativeWeb
AndroidC.NETFlutteriOSNode.jsPythonReact NativeWeb
Introduction
C.NETNode.jsPython
C.NETNode.jsPython
FAQGlossary

Bat Spoken Language Identification
Python API

API Reference for the Bat Python SDK (PyPI).


pvbat.create()

def create(
access_key: str,
model_path: Optional[str] = None,
device: Optional[str] = None,
library_path: Optional[str] = None,
voice_threshold: float = 0.4) -> Bat

Factory method for Bat Spoken Language Identification engine.

Parameters

  • access_key str : AccessKey obtained from Picovoice Console.
  • model_path Optional[str] : Absolute path to the file containing model parameters (.pv).
  • device Optional[str] : String representation of the device (e.g., CPU or GPU) to use. If set to best, the most suitable device is selected automatically. If set to gpu, the engine uses the first available GPU device. To select a specific GPU device, set this argument to gpu:${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 to cpu:${NUM_THREADS}, where ${NUM_THREADS} is the desired number of threads.
  • library_path Optional[str] : Absolute path to Bat's dynamic library.
  • voice_threshold float : Sensitivity threshold for detecting voice. The value should be a number within [0, 1]. A higher threshold increases detection confidence at the cost of potentially missing frames of voice.

Returns

  • Bat : An instance of Bat Spoken Language Identification engine.

Throws

  • BatError

pvbat.available_devices()

def available_devices(library_path: Optional[str] = None) -> Sequence[str]

Lists all available devices that Bat can use for inference. Each entry in the list can be the device argument of create() factory method or Bat constructor.

Parameters

  • library_path Optional[str] : Absolute path to Bat's dynamic library. If not set it will be set to the default location.

Returns

  • Sequence[str]: List of all available devices that Bat can use for inference.

Throws

  • BatError

pvbat.Bat

class Bat(object)

Class for the Bat Spoken Language Identification engine. Bat 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.


pvbat.Bat.version

self.version: str

The version string of the Bat library.


pvbat.Bat.__init__()

def __init__(
self,
access_key: str,
model_path: str,
device: str,
voice_threshold: float,
library_path: str) -> Bat

__init__ method for Bat Spoken Language Identification engine.

Parameters

  • access_key str : AccessKey obtained from Picovoice Console.
  • model_path str : Absolute path to the file containing model parameters (.pv).
  • device str : String representation of the device (e.g., CPU or GPU) to use. If set to best, the most suitable device is selected automatically. If set to gpu, the engine uses the first available GPU device. To select a specific GPU device, set this argument to gpu:${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 to cpu:${NUM_THREADS}, where ${NUM_THREADS} is the desired number of threads.
  • voice_threshold float : Sensitivity threshold for detecting voice. The value should be a number within [0, 1]. A higher threshold increases detection confidence at the cost of potentially missing frames of voice.
  • library_path str : Absolute path to Bat's dynamic library.

Returns

  • Bat: An instance of Bat Spoken Language Identification engine.

Throws

  • BatError

pvbat.Bat.delete()

def delete(self)

Releases resources acquired by Bat.


pvbat.Bat.process()

def process(self, pcm: Sequence[int]) -> Optional[Dict[BatLanguages, float]]:

Processes a frame of audio and returns detection scores for each supported language.

Parameters

  • pcm Sequence[int] : A frame of audio samples.

Returns

  • Optional[Dict[BatLanguages, float]] : Dictionary of language to detection score. The scores are in the range [0, 1] with 1 being maximum confidence in a perfect match. If None is returned, Bat did not detect usable voice in the frame.

Throws

  • BatError

pvbat.Bat.BatLanguages

class BatLanguages(Enum):
UNKNOWN = 0
DE = 1
EN = 2
ES = 3
FR = 4
IT = 5
JA = 6
KO = 7
PT = 8

Bat languages enum.


pvbat.list_hardware_devices()

def list_hardware_devices(library_path: str) -> Sequence[str]:

Lists all available devices that Bat can use for inference. Each entry in the list can be the device argument of create() factory method or Bat constructor.

Internal method. The higher level pvbat.available_devices() should be used instead.

Parameters

  • library_path str : Absolute path to Bat's dynamic library.

Returns

  • Sequence[str]: List of all available devices that Bat can use for inference.

Throws

  • BatError

pvbat.BatError

class BatError(Exception)

Error thrown if an error occurs within Bat Spoken Language Identification engine.

Exceptions

class BatActivationError(BatError)
class BatActivationLimitError(BatError)
class BatActivationRefusedError(BatError)
class BatActivationThrottledError(BatError)
class BatIOError(BatError)
class BatInvalidArgumentError(BatError)
class BatInvalidStateError(BatError)
class BatKeyError(BatError)
class BatMemoryError(BatError)
class BatRuntimeError(BatError)
class BatStopIterationError(BatError)

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Bat Spoken Language Identification Python API
  • pvbat.create()
  • pvbat.available_devices()
  • pvbat.Bat
  • version
  • __init__()
  • delete()
  • process()
  • BatLanguages
  • pvbat.list_hardware_devices()
  • pvbat.BatError
Voice AI
  • picoLLM On-Device LLM
  • Leopard Speech-to-Text
  • Cheetah Streaming Speech-to-Text
  • Orca Text-to-Speech
  • Koala Noise Suppression
  • Eagle Speaker Recognition
  • Falcon Speaker Diarization
  • Porcupine Wake Word
  • Rhino Speech-to-Intent
  • Cobra Voice Activity Detection
Resources
  • Docs
  • Console
  • Blog
  • Use Cases
  • Playground
Contact
  • Contact Sales
Company
  • About us
  • Careers
Follow Picovoice
  • LinkedIn
  • GitHub
  • X
  • YouTube
  • AngelList
Subscribe to our newsletter
Terms of Use
Privacy Policy
© 2019-2026 Picovoice Inc.