An Example of Azure Speaker Recognition API

Java source codes in GitHub: testAzureSpeakerRecognitionAPI

If you are looking for a demo, please click here.

Currently, the documents about Speaker Recognition API are not good enough. Besides, the sample codes of Java cannot be used directly.

An Example of Azure Speaker Recognition API

Basically, there are three steps to use Speaker Recognition API. 

  • Create profile
  • Create enrollment
  • Identification

To run the source codes, steps include:

  • Create Cognitive Services in Azure and copy Subscription key to "Authentication.java".
  • Run "CreateProfile.java" and copy profile id from response to "Authentication.java".
  • Run "CreateEnrollment.java" with specific audio file and save operation id in response header.

An Example of Azure Speaker Recognition API

  • Run "GetOperationStatus.java" with specific operation id.

An Example of Azure Speaker Recognition API

  • Create more than one profile and upload more audio files for each profile, run "Identification.java" with a new audio file. Similarly, save operation id in response header.
  • Again, run "GetOperationStatus.java" with specific operation id.

An Example of Azure Speaker Recognition API

 

As for audio file, the format must meet the following requirements.

An Example of Azure Speaker Recognition API

It took me nearly 2 hours to find a way to create a valid audio file.

  • Use default sound recorder to crate a audio file(WMA).

An Example of Azure Speaker Recognition API

An Example of Azure Speaker Recognition API

An Example of Azure Speaker Recognition API

An Example of Azure Speaker Recognition API

  • After that, use Wav Sample Rate Converter to change sample format.

An Example of Azure Speaker Recognition API

 

Finally, the duration of an audio file shouldn't be too long (between 30s and 40s) otherwise the size may be too large and exceptions will probably occur when creating erollment. 

 

Cheers!An Example of Azure Speaker Recognition API