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
Android API

API Reference for the Bat Android SDK (bat-android)

package: ai.picovoice.bat


Bat

public class Bat { }

Class for the Bat Spoken Language Identification engine.

Bat must be initialized using the Builder() Class. Resources should be cleaned when you are done using the delete() function.


Bat.getAvailableDevices()

public static String[] getAvailableDevices() throws BatException

Lists all available devices that Bat can use for inference. Each entry in the list can be used as the device argument when initializing Bat.

Returns

  • String[]: Array of all available devices that Bat can be used for inference.

Throws

  • BatException: If an error occurs while getting available devices.

Bat.delete()

public void delete()

Releases resources acquired by Bat.


Bat.getFrameLength()

public int getFrameLength()

Getter for required number of audio samples per frame.

Returns

  • int: Required number of audio samples per frame.

Bat.getSampleRate()

public int getSampleRate()

Getter for required audio sample rate for PCM data.

Returns

  • int: Required audio sample rate for PCM data.

Bat.getVersion()

public String getVersion()

Getter for version.

Returns

  • String: Current Bat version.

Bat.process()

public HashMap<BatLanguages, Float> process(short[] pcm) throws BatException

Processes given audio data and returns language detection scores.

Parameters

  • pcm short[] : A frame of audio samples.

Returns

  • HashMap<BatLanguages, Float>: Inferred Language detection scores.

Throws

  • BatException: If there is an error while processing.

Bat.Builder

public static class Builder { }

Builder for creating an instance of Bat.


Bat.Builder.build()

public Bat build(Context context) throws BatException

Creates an instance of Bat Spoken Language Identification engine.

Parameters

  • context Context : The Android app context.

Returns

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

Throws

  • BatException: If an error occurs while creating an instance of Bat Spoken Language Identification engine.

Bat.Builder.setAccessKey()

public Bat.Builder setAccessKey(String accessKey)

Sets the AccessKey of the builder.

Parameters

  • accessKey String : AccessKey obtained from Picovoice Console.

Returns

  • Bat.Builder: Modified Bat.Builder object.

Bat.Builder.setModelPath()

public Bat.Builder setModelPath(String modelPath)

Sets the model path of the builder.

Parameters

  • modelPath String : Path to the file containing model parameters (.pv). Can be either a path that is relative to the project's assets folder or an absolute path to the file on device.

Returns

  • Bat.Builder: Modified Bat.Builder object.

Bat.Builder.setDevice()

public Bat.Builder setDevice(String device)

Sets the device of the builder. If not set it will be set to the default device.

Parameters

  • device String : 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.

Returns

  • Bat.Builder: Modified Bat.Builder object.

Bat.Builder.setVoiceThreshold()

public Bat.Builder setVoiceThreshold(float voiceThreshold)

Setter for the voice threshold. If not set it will be set to the default value.

Parameters

  • voiceThreshold 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.Builder: Modified Bat.Builder object.

BatLanguages

public enum BatLanguages { }

Enum containing languages for the Bat Spoken Language Identification engine.


BatLanguages.numLanguages

public static final int numLanguages;

Number of languages in BatLanguages.


BatLanguages.fromValue()

public static BatLanguages fromValue(int _value)

Returns an instance of BatLanguages given the integer value of the enumeration.

Parameters

  • _value int : Enum integer value.

Returns

  • BatLanguages: Corresponding BatLanguages enum.

BatException

public class BatException extends Exception { }

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

Exceptions:

public class BatActivationException extends BatException { }
public class BatActivationLimitException extends BatException { }
public class BatActivationRefusedException extends BatException { }
public class BatActivationThrottledException extends BatException { }
public class BatIOException extends BatException { }
public class BatInvalidArgumentException extends BatException { }
public class BatInvalidStateException extends BatException { }
public class BatKeyException extends BatException { }
public class BatMemoryException extends BatException { }
public class BatRuntimeException extends BatException { }
public class BatStopIterationException extends BatException { }

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Bat Spoken Language Identification Android API
  • Bat
  • getAvailableDevices()
  • delete()
  • getFrameLength()
  • getSampleRate()
  • getVersion()
  • process()
  • Bat.Builder
  • build()
  • setAccessKey()
  • setModelPath()
  • setDevice()
  • setVoiceThreshold()
  • BatLanguages
  • numLanguages
  • fromValue()
  • BatException
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.