API | 설명 |
+ (int)initWithModelPath:(NSString*)modelPath; | SDK를 초기화합니다. 이 API를 호출할 때 모델 파일의 경로를 전달합니다. 0은 초기화에 성공했음을 나타냅니다. |
+ (NSArray )parseAudio:(NSArray )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"} |
+ (int)releaseSdk | 리소스를 해제합니다. 더 이상 기능을 사용할 필요가 없을 때 이 API를 호출하십시오. |
// Audio-to-Expression sdk 초기화NSString *path = [[NSBundle mainBundle] pathForResource:@"audio2exp" ofType:@"bundle"];int ret = [Audio2ExpApi initWithModelPath:path];// 음성 데이터를 52개 blendshape 데이터로 변환NSArray *emotionArray = [Audio2ExpApi parseAudio:floatArr];// 릴리스 sdk[Audio2ExpApi releaseSdk];// Tencent Effect sdk xmgaic과 결합해 사용// 해당 리소스를 사용하여 뷰티필터 sdk 초기화self.beautyKit = [[XMagic alloc] initWithRenderSize:previewSize assetsDict:assetsDict];// avatar 소재 로딩[self.beautyKit loadAvatar:bundlePath exportedAvatar:nil completion:nil];// 52개의 blendshape 데이터를 뷰티필터 sdk에 전달하여 효과 확인[self.beautyKit updateAvatarByExpression:emotionArray];
TXCAudioRecorder
를 참고하십시오.VoiceViewController
및 관련 클래스를 참고하십시오.
문제 해결에 도움이 되었나요?