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.

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.

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

  • 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.

 

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

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).

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

 

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!

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐