Eagle Speaker Recognition
iOS API
API Reference for the Eagle iOS SDK (Cocoapods)
EagleProfiler
Profiler class for the Eagle speaker recognition engine.
EagleProfiler.getAvailableDevices()
Retrieves a list of devices that can be specified when constructing EagleProfiler.
Returns
- [String] : An array of available devices.
Throws
EagleError: If an error occurs while retrieving the devices.
EagleProfiler.init()
Constructor for the EagleProfiler class
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.minEnrollmentChunksInt Minimum number of chunks to be processed before enroll returns 100%. The value should be a number greater than or equal to 1. A higher number results in more accurate profiles at the cost of needing more data to create the profile.voiceThresholdFloat Sensitivity threshold for detecting voice. The value should be a number within [0, 1]. A higher threshold increases detection confidence values at the cost of potentially missing frames of voice.
Throws
EagleError: If an error occurs while creating an instance of EagleProfiler.
EagleProfiler.delete()
Releases resources acquired by EagleProfiler.
EagleProfiler.enroll()
Enrolls a speaker.
Parameters
pcm[Int16] : An array of audio samples. The audio needs to have a sample rate equal to.sampleRateand be single-channel, 16-bit linearly-encoded. In addition it must be exactly.frameLengthsamples long.
Returns
Float: The percentage of enrollment completed.
Throws
EagleError: If an error occurs while processing the pcm array.
EagleProfiler.flush()
Marks the end of the audio stream, flushes internal state of the object and returns the percentage of enrollment completed.
Returns
Float: The percentage of enrollment completed.
Throws
EagleError: If an error occurs while processing the stored data array.
EagleProfiler.export()
Exports the speaker profile. The exported profile can be used in Eagle or stored for later use.
Returns
EagleProfile: AnEagleProfileobject.
Throws
EagleError: If an error occurs while exporting the speaker profile.
EagleProfiler.reset()
Resets EagleProfiler and removes all enrollment data. It must be called before enrolling a new speaker.
Throws
EagleError: If an error occurs while exporting the speaker profile.
EagleProfiler.frameLength
The audio frame length in PCM samples that EagleProfiler accepts.
EagleProfiler.sampleRate
The audio sample rate that EagleProfiler accepts.
EagleProfiler.version
EagleProfiler version string.
EagleProfile
The class representing a speaker profile after enrollment by EagleProfiler. Returned by EagleProfiler.export().
EagleProfile.init()
Constructor.
Parameters
profileBytes[UInt8] : A byte array that was previously obtained viagetBytes().
EagleProfile.getBytes()
Gets a binary representation of the profile.
Returns
[UInt8]: A byte array of the profile.
Eagle
Recognizer class for the Eagle speaker recognition engine.
Eagle.getAvailableDevices()
Retrieves a list of devices that can be specified when constructing Eagle.
Returns
- [String] : An array of available devices.
Throws
EagleError: If an error occurs while retrieving the devices.
Eagle.init()
Constructors for the Eagle class
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 values at the cost of potentially missing frames of voice.
Throws
EagleError: If an error occurs while creating an instance of Eagle.
Eagle.delete()
Releases resources acquired by Eagle.
Eagle.process()
Processes given audio data and returns speaker likelihood scores.
Parameters
pcm[Int16] : An array of audio samples. The audio needs to have a sample rate equal to.sampleRateand be single-channel, 16-bit linearly-encoded. In addition it must be at leastminProcessSamples()samples long.speakerProfiles[EagleProfile] : An array ofEagleProfileobjects obtained fromEagleProfiler.
Returns
[Float]?: Similarity scores for each enrolled speaker. The scores are in the range [0, 1] with 1 being a perfect match. A result ofnilindicates that there was not enough voice in the audio sample to recognize a speaker.
Throws
EagleError: If an error occurs while processing the pcm array.
Eagle.reset()
Resets the internal state of the Eagle engine.
It is best to call before processing a new sequence of audio (e.g. a new voice interaction).
This ensures that the accuracy of the engine is not affected by a change in audio context.
Throws
EagleError: If an error occurs while resetting.
Eagle.minProcessSamples()
Getter for the minimum length of the input pcm required by process().
Returns
Int: Minimum number of samples required for a call toprocess().
Throws
EagleError: If an error occurs.
Eagle.sampleRate
The audio sample rate that Eagle accepts.
Eagle.version
Eagle version string.
EagleError
Error type thrown by the Eagle iOS SDK.