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

API Reference for the Bat iOS SDK (Cocoapod)


Bat

public class Bat { }

Class for the Bat Spoken Language Identification engine. Resources should be cleaned when you are done using the delete() function.


Bat.getAvailableDevices()

public static func getAvailableDevices() throws -> [String]

Retrieves a list of devices that can be specified when constructing Bat.

Returns

  • [String] : An array of available devices.

Throws

  • BatError: If an error occurs while retrieving the devices.

Bat.init()

init method for Bat Spoken Language Identification engine.

public init(
accessKey: String,
modelPath: String? = nil,
device: String? = nil,
voiceThreshold: Float = 0.4) throws -> Bat

Parameters

  • accessKey String : The AccessKey obtained from Picovoice Console.
  • modelPath String? : Absolute path to file containing model parameters (.pv).
  • 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 to cpu, 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.
  • 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. Default is 0.4 second.

Throws

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

Bat.delete()

Releases resources acquired by the Bat engine.

public func delete()

Bat.process()

Processes a frame of audio and returns language detection scores.

public func process(_ pcm: [Int16]) throws -> [BatLanguages: Float32]? {

Parameters

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

Returns

  • [BatLanguages: Float32]? : Detection score for each supported language. The scores are in the range [0, 1] with 1 being maximum confidence in a detection. If nil is returned, Bat did not detect usable voice in the frame.

Throws

  • BatError: If there is an error while processing.

Bat.frameLength

public static let frameLength: UInt32

The number of audio samples per frame that Bat accepts.


Bat.sampleRate

public static let sampleRate: UInt32

The audio sample rate that Bat accepts.


Bat.version

public static let version: String

Current Bat version.


BatLanguages

public enum BatLanguages: Int, CaseIterable { }

Enum containing languages for the Bat Spoken Language Identification engine.


BatLanguages.numLanguages()

public static func numLanguages() -> Int

Number of languages in BatLanguages.

Returns

  • Int : Number of languages.

BatLanguages.toString()

public func toString() -> String

String representation of BatLanguages enum value.

Returns

  • String : Enum value string representation.

BatLanguages.fromString()

public static func fromString(_ language: String) -> BatLanguages?

Returns BatLanguages enum value given string representation.

Parameters

  • _ language String : String representation of enum value.

Returns

  • BatLanguages? : BatLanguages enum value or nil if string representation is not valid.

BatError

public class BatError : LocalizedError { }

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

public class BatMemoryError : BatError {}
public class BatIOError : BatError {}
public class BatInvalidArgumentError : BatError {}
public class BatStopIterationError : BatError {}
public class BatKeyError : BatError {}
public class BatInvalidStateError : BatError {}
public class BatRuntimeError : BatError {}
public class BatActivationError : BatError {}
public class BatActivationLimitError : BatError {}
public class BatActivationThrottledError : BatError {}
public class BatActivationRefusedError : BatError {}

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Bat Spoken Language Identification iOS API
  • Bat
  • getAvailableDevices()
  • init()
  • delete()
  • process()
  • frameLength
  • sampleRate
  • version
  • BatLanguages
  • numLanguages()
  • toString()
  • fromString()
  • 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.