context.getFilesDir() + "/my_models_dir/audio2exp"
와 같은 app의 개인 디렉터리로 모델 파일을 복사합니다. 그 다음 Audio2ExpApi의 init(String modelPath)
API를 호출하여 context.getFilesDir() + "/my_models_dir"
을 전달합니다.
SDK 패키지에서 모델 파일을 찾을 수 있습니다.
API | 설명 |
public int Audio2ExpApi.init(String modelPath); | SDK를 초기화합니다. 이 API를 호출할 때 모델 파일의 경로를 전달합니다. 0은 초기화에 성공했음을 나타냅니다. |
public float[] Audio2ExpApi.parseAudio(float[] inputData); | 입력은 오디오이며 1채널이어야 하며 샘플링 레이트는 16K여야 합니다. 배열 길이는 267(샘플링 포인트 267개)입니다. 출력은 52개의 blendshape에 해당하는 52개의 요소가 있는 float 배열입니다. 요소의 값 범위는 0에서 1까지이며 순서는 Apple에서 지정합니다. {"eyeBlinkLeft","eyeLookDownLeft","eyeLookInLeft","eyeLookOutLeft","eyeLookUpLeft","eyeSquintLeft","eyeWideLeft","eyeBlinkRight","eyeLookDownRight","eyeLookInRight","eyeLookOutRight","eyeLookUpRight","eyeSquintRight","eyeWideRight","jawForward","jawLeft","jawRight","jawOpen","mouthClose","mouthFunnel","mouthPucker","mouthRight","mouthLeft","mouthSmileLeft","mouthSmileRight","mouthFrownRight","mouthFrownLeft","mouthDimpleLeft","mouthDimpleRight","mouthStretchLeft","mouthStretchRight","mouthRollLower","mouthRollUpper","mouthShrugLower","mouthShrugUpper","mouthPressLeft","mouthPressRight","mouthLowerDownLeft","mouthLowerDownRight","mouthUpperUpLeft","mouthUpperUpRight","browDownLeft","browDownRight","browInnerUp","browOuterUpLeft","browOuterUpRight","cheekPuff","cheekSquintLeft","cheekSquintRight","noseSneerLeft","noseSneerRight","tongueOut"} |
public int Audio2ExpApi.release(); | 리소스를 해제합니다. 더 이상 기능을 사용할 필요가 없을 때 이 API를 호출하십시오. |
@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);findViewById(R.id.button).setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View view) {TELicenseCheck.getInstance().setTELicense(MainActivity.this, licenseUrl, licenseKey, new TELicenseCheckListener() {@Overridepublic void onLicenseCheckFinish(int errorCode, String s) {Log.d(TAG, "onLicenseCheckFinish: errorCode = "+errorCode+",msg="+s);if (errorCode == TELicenseCheck.ERROR_OK) {//license check successAudio2ExpApi audio2ExpApi = new Audio2ExpApi();int err = audio2ExpApi.init(MainActivity.this.getFilesDir() +"/models");Log.d(TAG, "onLicenseCheckFinish: err="+err);//TODO start record and parse audio data} else {// license check failed}}});}});}
com.tencent.demo.avatar.audio.AudioCapturer
를 참고하십시오.com.tencent.demo.avatar.activity.Audio2ExpActivity
및 관련 클래스를 참고하십시오.
문제 해결에 도움이 되었나요?