声纹识别SDK-FreeSR

FreeSR (A Free Library for Speaker Recognition),免费的声纹识别/性别识别SDK,支持Android/Windows/Linux等平台。

https://github.com/NonDay/FreeSR

1.实现算法:

  gmm-ubm/i-vector/x-vector

2.功能

  说话人识别(验证),包括注册/识别两个阶段 (gmm-ubm/i-vector)

  性别识别,根据语音片段判断性别(gmm-ubm/x-vector)

3.支持平台

  Windows/ Linux/ Android

4.使用方法

4.1Windows

 

 

4.2 Android

通过Android Studio 加载.so库,在项目里新建libs文件夹,根据debug/release选择对应的so库,拷贝目录 arm64-v8a、armeabi-v7a、x86、x86_64到libs文件夹下

在build.gradle文件里添加

android {

......

sourceSets{
        main{
            jniLibs.srcDirs = ['libs']
        }
    }
}

新建Package(com.freesr),将以下文件拷贝到该package目录

声纹识别SDK-FreeSR_第1张图片

可进行说话人性别识别以及说话人识别,支持gmm-ubm和ivector,更详细的方法可参考java文件:

import com.freesr.*;

static {
    System.loadLibrary("freesr");
}

//1. gener recognition
int sample_rate = 8000;
SpeakerRecognizerGMM SpkRec = new SpeakerRecognizerGMM(sample_rate);

ArrayListStr spk_models = new ArrayListStr();
ArrayListStr spk_names = new ArrayListStr();

spk_names.add("female");
spk_models.add("female.model");

spk_names.add("male");
spk_models.add("male.model");

boolean init = SpkRec.Init("freesr-gender-model.bin", spk_names, spk_models);
if(!init)
{
	// failed to init
	return ;
}
String rec_result = SpkRec.RecognizeSpeaker("english.wav");
double score = SpkRec.GetScore()

//2. speaker recognition
int sample_rate = 8000;
// SpeakerRecognizerIVector SpkRec = new SpeakerRecognizerIVector(sample_rate)
// boolean init =  SpkRec.Init("freesr-ivector-model.bin", spk_names, spk_models);
SpeakerRecognizerGMM SpkRec = new SpeakerRecognizerGMM(sample_rate);
boolean init =  SpkRec.Init("freesr-ubm-model.bin", spk_names, spk_models);
if(!init)
{
	// failed to init
	return ;
}
ArrayListStr fpaths = new ArrayListStr();
fpaths.add("english.wav");
fpaths.add("english.wav");
......
String reg_name = "spkA";
String reg_path = "spkA.model"
boolean ret = SpkRec.RegisterSpeaker(fpaths,reg_name,reg_path)
String rec_result = SpkRec.RecognizeSpeaker("english.wav");
double score = SpkRec.GetScore()

Android示例工程:https://download.csdn.net/download/u012594175/12296957

Android相关so文件下载地址:https://share.weiyun.com/5O9BdLP

地址:https://github.com/NonDay/FreeSR

你可能感兴趣的:(声纹识别)