Bat Spoken Language Identification
iOS API
API Reference for the Bat iOS SDK (Cocoapod)
Bat
Class for the Bat Spoken Language Identification engine.
Resources should be cleaned when you are done using the delete() function.
Bat.getAvailableDevices()
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.
Parameters
accessKeyString : The AccessKey obtained from Picovoice Console.modelPathString? : Absolute path to file containing model parameters (.pv).deviceString? : 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.voiceThresholdFloat : 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.
Bat.process()
Processes a frame of audio and returns language detection scores.
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
nilis returned, Bat did not detect usable voice in the frame.
Throws
BatError: If there is an error while processing.
Bat.frameLength
The number of audio samples per frame that Bat accepts.
Bat.sampleRate
The audio sample rate that Bat accepts.
Bat.version
Current Bat version.
BatLanguages
Enum containing languages for the Bat Spoken Language Identification engine.
BatLanguages.numLanguages()
Number of languages in BatLanguages.
Returns
- Int : Number of languages.
BatLanguages.toString()
String representation of BatLanguages enum value.
Returns
- String : Enum value string representation.
BatLanguages.fromString()
Returns BatLanguages enum value given string representation.
Parameters
_ languageString : String representation of enum value.
Returns
- BatLanguages? :
BatLanguagesenum value ornilif string representation is not valid.
BatError
Error thrown if an error occurs within Bat Spoken Language Identification engine.