Package: pveagle
Eagle Binding for PythonEagle Speaker Recognition EngineMade in Vancouver, Canada byPicovoiceEagle is an on-device speaker recognition engine. Eagle is:Private; All voice processing runs locally.Cross-Platform:Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64)Android and iOSChrome, Safari, Firefox, and EdgeRaspberry Pi (5, 4, 3) and NVIDIA Jetson NanoCompatibilityPython 3.7 or higherRuns on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64), Raspberry Pi (5, 4, 3), and NVIDIA Jetson Nano.Installationpip3 install pveagleAccessKeyEagle requires a valid PicovoiceAccessKeyat initialization.AccessKeyacts as your credentials when using Eagle
SDKs. You can get yourAccessKeyfor free. Make sure to keep yourAccessKeysecret.
Signup or Login toPicovoice Consoleto get yourAccessKey.UsageEagle has two distinct steps: Enrollment and Recognition. In the enrollment step, Eagle analyzes a series of
utterances from a particular speaker to learn their unique voiceprint. This step produces anEagleProfileobject,
which can be stored and utilized during inference. During the Recognition step, Eagle compares the incoming frames of
audio to the voiceprints of all enrolled speakers in real-time to determine the similarity between them.Speaker EnrollmentCreate an instance of the profiler:importpveagle# AccessKey obtained from Picovoice Console (https://console.picovoice.ai/)access_key="${ACCESS_KEY}"eagle_profiler=pveagle.create_profiler(access_key)EagleProfileris responsible for processing and enrolling PCM audio data, with the valid audio sample rate determined
byeagle_profiler.sample_rate. The audio data must be 16-bit linearly-encoded and single-channel.When passing samples toeagle_profiler.enroll, the number of samples must be at
leasteagle_profiler.min_enroll_samplesto ensure sufficient data for enrollment. The percentage value
obtained from this process indicates the progress of enrollment, while the feedback value can be utilized to determine
the status of the enrollment process.defget_next_enroll_audio_data(num_samples):passpercentage=0.0whilepercentage<100.0:percentage,feedback=eagle_profiler.enroll(get_next_enroll_audio_data(eagle_profiler.min_enroll_samples))print(feedback.name)After the percentage reaches 100%, the enrollment process is considered complete. While it is possible to continue
providing additional audio data to the profiler to improve the accuracy of the voiceprint, it is not necessary to do so.
Moreover, if the audio data submitted is unsuitable for enrollment, the feedback value will indicate the reason, and the
enrollment progress will remain unchanged.speaker_profile=eagle_profiler.export()Theeagle_profiler.export()function produces anEagleProfileobject, which can be converted into a binary form
using theEagleProfile.to_bytes()method. This binary representation can be saved and subsequently retrieved using
theEagleProfile.from_bytes()method.To reset the profiler and enroll a new speaker, theeagle_profiler.reset()method can be used. This method clears all
previously stored data, making it possible to start a new enrollment session with a different speaker.Finally, when done be sure to explicitly release the resources:eagle_profiler.delete()Speaker RecognitionCreate an instance of the engine with one or more speaker profiles from theEagleProfiler:eagle=pveagle.create_recognizer(access_key,speaker_profile)When initialized,eagle.sample_ratespecifies the valid sample rate for Eagle. The expected length of a frame, or the
number of audio samples in an input array, is defined byeagle.frame_length.Like the profiler, Eagle is designed to work with single-channel audio that is encoded using 16-bit linear PCM.defget_next_audio_frame():passwhileTrue:scores=eagle.process(get_next_audio_frame())Thescoresarray contains floating-point numbers that indicate the similarity between the input audio frame and the
enrolled speakers. Each value in the array corresponds to a specific enrolled speaker, maintaining the same order as the
speaker profiles provided during initialization. The values in the array range from 0.0 to 1.0, where higher values
indicate a stronger degree of similarity.Finally, when done be sure to explicitly release the resources:eagle.delete()Demospveagledemoprovides command-line utilities for processing real-time
audio (i.e. microphone) and files using Eagle.