openharmony_ci 44488fa30c !147 merge cherry-pick-mr-146-1764126662369-auto into master
add static sdk support

Created-by: haoqingqi
Commit-by: haoqingqi;yuzhicheng
Merged-by: openharmony_ci
Description: ### 一、内容说明(相关的Issue)



### 二、建议测试周期和提测地址  
  建议测试完成时间:xxxx.xx.xx  
  投产上线时间:xxxx.xx.xx  
  提测地址:CI环境/压测环境  
  测试账号:  

### 三、变更内容
  * 3.1 关联PR列表

  * 3.2 数据库和部署说明  
    1. 常规更新 
    2. 重启unicorn
    3. 重启sidekiq
    4. 迁移任务:是否有迁移任务,没有写 "无"
    5. rake脚本:`bundle exec xxx RAILS_ENV = production`;没有写 "无"

  * 3.4 其他技术优化内容(做了什么,变更了什么)
    - 重构了 xxxx 代码
    - xxxx 算法优化


  * 3.5 废弃通知(什么字段、方法弃用?)



  * 3.6  后向不兼容变更(是否有无法向后兼容的变更?)


  
### 四、研发自测点(自测哪些?冒烟用例全部自测?)
  自测测试结论:


### 五、测试关注点(需要提醒QA重点关注的、可能会忽略的地方)
  检查点:

| 需求名称 | 是否影响xx公共模块 | 是否需要xx功能 | 需求升级是否依赖其他子产品 |
|------|------------|----------|---------------|
| xxx  | 否          | 需要       | 不需要           |
|      |            |          |               |

  接口测试:

  性能测试:

  并发测试:

  其他:



See merge request: openharmony/ai_intelligent_voice_framework!147
2025-11-27 11:41:04 +08:00
2023-07-10 15:16:35 +08:00
2025-11-26 11:11:04 +08:00
2025-11-26 11:11:04 +08:00
2023-07-08 09:39:34 +08:00
2024-09-25 17:12:34 +08:00
2025-07-15 16:33:45 +08:00
2025-04-21 20:57:20 +08:00
2025-11-26 11:20:20 +08:00
2025-07-15 11:19:19 +08:00
2023-08-14 16:12:36 +08:00
2023-07-10 15:16:35 +08:00
2023-07-10 15:16:35 +08:00

Intelligent Voice Framework

Overview

Introduction

The intelligent voice framework consists of the intelligent voice service framework and intelligent voice driver. It implements voice enrollment and voice wakeup.

Figure 1 Architecture of the intelligent voice framework

image.png

The intelligent voice service framework provides the following features:

  • System event monitoring: monitoring system events such as unlocking upon power-on and screen-on/off

  • Concurrency policy: intelligent voice service concurrency management

  • Intelligent voice service: voice enrollment, voice wakeup, and more

  • Sound trigger: Digital Signal Processor (DSP) model loading, DSP algorithm enabling/disabling, and DSP event processing

The intelligent voice driver provides the following features:

  • Engine algorithm: intelligent voice algorithm engine and event reporting

  • Device driver: DSP model loading/unloading, DSP algorithm enabling/disabling, event reporting, and hardware-related channel configuration

Basic Concepts

  • Voice enrollment: process of converting a wakeup word spoken by a user into an acoustic model and a voiceprint feature, which will be used for comparison during voice wakeup
  • Voice wakeup: process of checking whether the current speaker is a registered user and if yes, waking up the system
  • DSP chip: chip that implements digital signal processing

Directory Structure

The structure of the repository directory is as follows:

/foundation/ai/intelligent_voice_framework  # Service code of the intelligent audio framework
├── frameworks                                      # Framework code
│   ├── native                                      # Internal API implementation
│   └── js                                          # External API implementation
├── interfaces                                      # API code
│   ├── inner_api                                   # Internal APIs
│   └── kits                                        # External APIs
├── sa_profile                                      # Service configuration profile
├├── services                                        # Service code
├── LICENSE                                         # License file
├── tests                                           # Developer test
└── utils                                           # Public functions

Constraints

Currently, the intelligent voice framework supports the enrollment and wakeup of only one wakeup word.

Available APIs

APIs Used for Voice Enrollment

API Description
createEnrollIntelligentVoiceEngine(descriptor: EnrollIntelligentVoiceEngineDescriptor): EnrollIntelligentVoiceEngine Creates an enrollment engine.
init(config: EnrollEngineConfig): EnrollIntelligentVoiceEngineCallbackInfo Initializes this enrollment engine.
start(isLast: boolean): EnrollIntelligentVoiceEngineCallbackInfo Starts enrollment.
stop(): void Stops enrollment.
commit(): EnrollIntelligentVoiceEngineCallbackInfo Commits the enrollment data.
setWakeupHapInfo(info: WakeupHapInfo): void Sets the wakeup application information.
setSensibility(sensibility: SensibilityType): void Sets the sensitivity.
release(): void Releases this enrollment engine.

APIs Used for Voice Wakeup

API Description
createWakeupIntelligentVoiceEngine(descriptor: WakeupIntelligentVoiceEngineDescriptor): WakeupIntelligentVoiceEngine Creates a wakeup engine.
setWakeupHapInfo(info: WakeupHapInfo): void Sets the wakeup application information.
setSensibility(sensibility: SensibilityType): void Sets the sensitivity.
on(type: 'wakeupIntelligentVoiceEvent', callback: Callback): void Subscribes to wakeup events.
release(): void Releases this wakeup engine.

How to Develop

Voice Enrollment

The voice enrollment process is an interaction process initiated by a user through the enrollment page of an application. The main process is as follows:

  1. A user starts enrollment (creating and initializing the enrollment engine), and the enrollment page is displayed.
  2. The enrollment page asks the user to speak a wakeup word, and the user speaks the wakeup word (starting enrollment). The enrollment page asks the user to speak the wakeup word again several times.
  3. After the enrollment data is committed, the enrollment process is complete. The code snippet is as follows:
// Import the intelligentVoice module.
import intelligentVoice from '@ohos.ai.intelligentVoice';

// Obtain the intelligent audio management service.
var manager = intellVoice.getIntelligentVoiceManager();
if (manager == null) {
    console.error("Get IntelligentVoiceManager failed.");
} else {
    console.info("Get IntelligentVoiceManager success.");
    return;
}

// Create an enrollment engine.
var engine = null;
let engineDescriptor = {
    wakeupPhrase: '',                            // Set a wakeup word.
}
await intellVoice.createEnrollIntelligentVoiceEngine(engineDescriptor).then((data) => {
    engine = data;
    console.info('Create EnrollIntelligentVoice Engine finish');
}).catch((err) => {
    console.error('Create EnrollIntelligentVoice Engine failed, err: ' + err.message);
});
if (engine == null) {
    console.error('Create EnrollIntelligentVoice Engine failed');
    return;
}

// Initialize the enrollment engine.
let config = {
    language: "zh", // Chinese
    area: "CN", // China
}
engine.init(config).then((data) => {
    console.info('Init EnrollIntelligentVoice Engine finish');
}).catch((err) => {
    console.info('Init EnrollIntelligentVoice Engine failed, err: '+ err.message);
});

// Start enrollment.
let isLast = true; // The value true means that this is the last time to start enrollment, and false means the opposite. The value true is used here.
engine.start(isLast).then((data) => {
    console.info('Start enrollment finish');
}).catch((err) => {
    console.info('Start enrollment failed, err: '+ err.message);
});

// Commit the enrollment data.
engine.commit().then((data) => {
    console.info('Commit enroll result finish');
}).catch((err) => {
    console.info('Commit enroll result failed, err: '+ err.message);
});

// Deliver the voice wakeup application information.
let info = {
    bundleName: "demo", // Bundle name of the application. demo here is for reference only. Set this parameter based on your application.
    abilityName: "demo", // Ability name of the application. demo here is for reference only. Set this parameter based on your application.
}
engine.setWakeupHapInfo(info).then((data) => {
    console.info('Set wakeup hap info finish');
}).catch((err) => {
    console.info('Set wakeup hap info failed, err: '+ err.message);
});

// Release the enrollment engine.
engine.release().then((data) => {
    console.info('Release EnrollIntelligentVoice engine success.');
}).catch((err) => {
    console.info('Release EnrollIntelligentVoice engine failed, err: '+ err.message);
});

Voice Wakeup

Voice wakeup is controlled by the intelligent voice framework. Upper-layer applications only need to create a wakeup engine by calling createWakeupIntelligentVoiceEngine and then subscribe to wakeup events.

// Obtain the wakeup engine.
var engine = null;
let engineDescriptor = {
    needApAlgEngine: true, // Specify whether the framework needs to provide the AP algorithm engine.
    wakeupPhrase: '', // Set a wakeup word.
}
await intellVoice.createWakeupIntelligentVoiceEngine(engineDescriptor).then((data) => {
    engine = data;
    console.info('Create WakeupIntelligentVoice Engine finish');
}).catch((err) => {
    console.error('Create WakeupIntelligentVoice Engine failed, err: ' + err.message);
});
if (engine == null) {
    console.error('Create WakeupIntelligentVoice Engine failed');
    return;
}

// Subscribe to wakeup events.
engine.on('wakeupIntelligentVoiceEvent',(callback) => {
    console.info('wakeupIntelligentVoiceEvent CallBackInfo:')
    for (let prop in callback) {
        console.info('wakeupIntelligentVoiceEvent prop: ' + prop);
        console.info('wakeupIntelligentVoiceEvent value: ' + callback[prop]);
    }
});

Repositories Involved

intelligent_voice_framework

S
Description
No description provided
Readme 2.9 MiB
Languages
C++ 98.9%
CMake 0.5%
C 0.4%
Shell 0.2%