Falcon Speaker Diarization
Android API
API Reference for the Android Falcon SDK (falcon-android)
package: ai.picovoice.falcon
Falcon
Class for the Falcon Speaker Diarization engine.
Falcon must be initialized using the Builder() Class. Resources should be cleaned when you are done using the delete()
function.
Falcon.delete()
Releases resources acquired by Falcon
.
Falcon.getSampleRate()
Getter for required audio sample rate for PCM data.
Returns
int
: Required audio sample rate for PCM data.
Falcon.getVersion()
Getter for version.
Returns
String
: CurrentFalcon
version.
Falcon.process()
Processes given audio data and returns speaker segments. The incoming audio needs to have a sample rate equal to .getSampleRate()
and be 16-bit linearly-encoded.
Furthermore, Falcon
operates on single channel audio. If you wish to process data in a different sample rate or format consider using .processFile()
.
Parameters
pcm
short[] : A frame of audio samples.
Returns
FalconSegment[]
: Diarization output as an array of segments and their associated metadata.
Throws
FalconException
: If there is an error while processing the audio frame.
Falcon.processFile()
Processes a given audio file and returns speaker segments.
Parameters
path
String : Absolute path to the audio file on device. The supported audio file formats are:3gp (AMR)
,FLAC
,MP3
,MP4/m4a (AAC)
,Ogg
,WAV
andWebM
.
Returns
FalconSegment[]
: Diarization output as an array of segments and their associated metadata.
Throws
FalconException
: If there is an error while processing the audio file.
Falcon.Builder
Builder for creating an instance of Falcon
.
Falcon.Builder.build()
Creates an instance of Falcon
Speaker Diarization engine.
Parameters
context
Context : The Android app context.
Returns
Falcon
: An instance of Falcon Speaker Diarization engine.
Throws
FalconException
: If an error occurs while creating an instance of Falcon Speaker Diarization engine.
Falcon.Builder.setAccessKey()
Sets the AccessKey of the builder.
Parameters
accessKey
String : AccessKey obtained from Picovoice Console.
Returns
Falcon.Builder
: Modified Falcon.Builder object.
Falcon.Builder.setModelPath()
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'sassets
folder or an absolute path to the file on device.
Returns
Falcon.Builder
: Modified Falcon.Builder object.
FalconException
Exception thrown if an error occurs within Falcon
Speaker Diarization engine.
Exceptions:
FalconSegment
Class that contains segment metadata from the diarization result returned from Falcon.process()
and Falcon.processFile()
.
Parameters
startSec
float : Start of segment in seconds.endSec
float : End of segment in seconds.speakerTag
int : A non-negative integer identifying unique speakers.
FalconSegment.getStartSec()
Getter for the start of segment in seconds.
Returns
float
: Start of segment in seconds.
FalconSegment.getEndSec()
Getter for the end of segment in seconds.
Returns
float
: End of segment in seconds.
FalconSegment.getSpeakerTag()
Getter for the speaker tag.
Returns
int
: Speaker tag associated with speaker.