Files
duix.ai/duix-ios/GJLocalDigitalDemo
songwei 45ebcc321e update
2025-07-18 14:57:42 +08:00
..
2025-07-17 18:49:12 +08:00
2025-07-17 11:02:54 +08:00
2025-07-17 11:02:54 +08:00
2025-07-17 18:23:32 +08:00
2025-07-17 11:02:54 +08:00
2024-05-16 17:22:43 +08:00
2024-05-16 17:22:43 +08:00
2025-07-18 14:57:42 +08:00
2025-07-18 14:55:32 +08:00

Silicon-based Local Edition DUIX-PRO SDK Documentation (v1.2.0)

简体中文 | English


1. Product Overview

Silicon-based Local Edition DUIX-PRO SDK is a lightweight locally deployed 2D virtual human solution for iOS platforms. It supports real-time voice-driven virtual character lip-syncing and motion responses.

1.1 Applicable Scenarios

  • Low Deployment Cost: No server dependencies, suitable for government terminals, airports, exhibition halls, etc.
  • Network-Friendly: Supports fully offline operation.
  • Diverse Functionality: Supports intelligent scenarios like guided tours, Q&A services, digital greeters, etc.

1.2 Core Features

  • Digital Human Rendering & Driving: Local rendering of virtual characters with real-time lip-sync response to voice input
  • Voice Broadcast Control: Supports audio playback, PCM streaming, and motion-broadcast synchronization
  • Motion Control System: Customizable start/stop actions and random motions

2. Terminology

Term Description
PCM Raw audio stream format (16kHz, 16bit, Mono)
WAV Audio file format suitable for short voice playback (internally PCM encoded)
Session Complete broadcast process (Push → Response → End)
DUIX-PRO Local rendering and driving manager handling model loading, render control, etc.
GJLPCMManager PCM management class for handling audio files and streaming logic

3. SDK Acquisition & Integration

  1. Drag GJLocalDigitalSDK.framework into Xcode project → Set to Embed & Sign
  2. Add AVFoundation.framework in Build Phases > Link Binary With Libraries
  3. Add microphone permission in Info.plist:
<key>NSMicrophoneUsageDescription</key>
<string>App requires microphone access to drive digital human voice broadcast</string>

4. Integration Requirements

Item Requirement
OS Version iOS 12.0+
Development Tools Xcode 12+
Supported Devices iPhone 8+
Runtime Environment Offline operation (no network required)
CPU & Memory Recommended A12+ chip, ≥3GB RAM

5. Workflow Overview

graph TD
A[Check Configuration and Model] --> B[Build DUIX Instance]
B --> C[Call init to initialize]
C --> D[Display Image / Render]
D --> E[PCM or WAV Audio Driving]
E --> F[Playback Control and Action Trigger]
F --> G[Resource Release]

6. Quick Start Example

NSInteger result = [[GJLDigitalManager manager] initBaseModel:basePath 
                                                 digitalModel:digitalPath 
                                                    showView:self.showView];
if (result == 1) {
    [[GJLDigitalManager manager] toStart:^(BOOL isSuccess, NSString *errorMsg) {
        if (isSuccess) {
            [[GJLDigitalManager manager] toStartRuning];
        } else {
            NSLog(@"Start failed: %@", errorMsg);
        }
    }];
}

Note: basePath = base resource directory, digitalPath = model directory


7. Key Interfaces & Usage

7.1 Initialization Configuration

/**
 * Initialize digital human service
 * @param basePath    Base model path (fixed)
 * @param digitalPath Digital human model path (update when replacing digital human)
 * @param showView    Digital human rendering view
 * @return Status code 1=success, 0=unauthorized, -1=failure
 */
-(NSInteger)initBaseModel:(NSString*)basePath digitalModel:(NSString*)digitalPath showView:(UIView*)showView;

7.2 Digital Human Rendering Control

/*
* Start digital human rendering
*/
-(void)toStart:(void (^) (BOOL isSuccess, NSString *errorMsg))block;
/*
* Stop rendering and release resources
*/
-(void)toStop;
/*
* Resume playback (call after pause)
*/
-(void)toPlay;
/*
* Pause digital human playback
*/
-(void)toPause;

7.3 Background Management

/**
 * Dynamically replace background
 * @param bbgPath JPG format background image path
 */
-(void)toChangeBBGWithPath:(NSString*)bbgPath;

7.4 Audio Control

/*
* Play audio stream (PCM format), refer to toSpeakWithPath in GJLPCMManager demo class for PCM conversion
* Drive digital human broadcast (PCM stream)
*/
-(void)toWavPcmData:(NSData*)audioData;
/*
* Start audio stream playback
*/
- (void)startPlaying;
/*
* Stop audio stream playback
*/
- (void)stopPlaying:(void (^)( BOOL isSuccess))success;
/*
* Set mute mode
*/
-(void)toMute:(BOOL)isMute;
/*
* Clear audio buffer
*/
-(void)clearAudioBuffer;
/*
* Pause audio stream playback
*/
-(void)toPausePcm;
/*
* Resume audio stream playback
*/
-(void)toResumePcm;
/*
* Enable/disable recording
*/
-(void)toEnableRecord:(BOOL)isEnable;

7.5 Streaming Session Management

/*
* Start streaming session
*/
-(void)toStartRuning;
/*
* Start new session (single sentence/paragraph)
*/
-(void)newSession;
/*
* End current session
*/
-(void)finishSession;
/*
* Continue session (call after finish)
*/
-(void)continueSession;

7.6 Motion Control

/*
* Enable random motions (recommended at start of first audio segment)
* Return: 0=unsupported, 1=success
*/
-(NSInteger)toRandomMotion;
/*
* Enable start motion (call at beginning of first audio segment)
* Return: 0=unsupported, 1=success
*/
-(NSInteger)toStartMotion;
/*
* End motion (call at end of last audio segment)
* isQuickly: YES=end immediately, NO=wait for motion completion
* Return: 0=unsupported, 1=success
*/
-(NSInteger)toSopMotion:(BOOL)isQuickly;

7.7 Status Queries

/*
* Get digital human model dimensions (call after initialization)
*/ 
-(CGSize)getDigitalSize;
/*
* Check authorization status (1=authorized)
*/ 
-(NSInteger)isGetAuth;

8. Callback Definitions

/*
* Digital human rendering error
* Error codes:
*    0  = Unauthorized 
*   -1 = Uninitialized 
*   50009 = Resource timeout/unconfigured
*/
@property (nonatomic, copy) void (^playFailed)(NSInteger code,NSString *errorMsg);
/*
* Audio playback ended callback
*/
@property (nonatomic, copy) void (^audioPlayEnd)(void);
/*
* Audio playback progress callback
*/
@property (nonatomic, copy) void (^audioPlayProgress)(float current,float total);

9. FAQ & Troubleshooting

Symptom Possible Cause Recommended Solution
Initialization returns -1 SDK authorization failed Check info.plist for auth fields
No rendered output showView empty or not added Ensure view is mounted in controller
No broadcast response Invalid audio format/path Verify PCM format/path validity
Premature playback stop Session not continued/buffer overflow Check continueSession usage

10. Version History

v1.2.0

  • Added PCM streaming support

v1.0.3

  • Supported transparent backgrounds
  • Optimized model decompression memory

v1.0.2

  • Supported Q&A / speech recognition / motion tagging / synthesized broadcast

v1.0.1

  • Initial version: authorization + rendering + broadcast

🔗 Open Source Dependencies

Module Description
ONNX Universal AI model format
ncnn High-performance neural network inference framework (Tencent)

For additional integration support, please contact technical support.