--- /dev/null
+#ifndef ASR_FN_ASR_H_
+#define ASR_FN_ASR_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int Wanson_ASR_Init();
+int Wanson_ASR_Reset(int domain);
+int Wanson_ASR_Recog(short* buf, int buf_len, const char** text, float* score);
+void Wanson_ASR_Release();
+
+/// @brief 是否使用了内置的音频流程
+/// @return 0 没有使用
+int wanson_audio_type_get();
+
+/// @brief 录音缓存初始化
+/// @param size 最小2*1024
+void wanson_audio_buf_init(unsigned int size);
+
+/// @brief 录音缓存释放
+void wanson_audio_buf_deinit();
+
+/// @brief 录音数据长度获取
+/// @return size(byte)
+int wanson_audio_data_len_get();
+
+/// @brief 录音数据获取
+/// @param read_buf 存放数据的buf
+/// @param len 读取的数据长度
+/// @return size(byte)
+int wanson_audio_data_read(char* read_buf, int len);
+
+/// @brief 录音数据写缓存
+/// @param write_buf 音频数据
+/// @param len byte
+void wanson_audio_data_push(short* write_buf, int len);
+
+/// @brief 降噪初始化
+/// @return 0:成功 -1:失败
+int wanson_ans_init();
+
+/// @brief 降噪开辟的内存释放
+void wanson_ans_deinit();
+
+/// @brief 获取降噪是否开启的状态
+/// @return 1:表示开启 ,0:表示未开降噪
+int wanson_ans_status_get();
+
+
+/// @brief 当前ANS的方式
+/// @param 0 读数据的时候做ans 1:写数据的时候做ans
+void wanson_ans_type_set(unsigned char type);
+
+/// @brief 当前ANS的方式
+/// @return 0 读数据的时候做ans 1:写数据的时候做ans
+int wanson_ans_type_get();
+
+/// @brief 分组初始化
+/// @return 分组数
+int wanson_group_para_init();
+
+/// @brief 模型buf获取
+/// @return 起始地址
+const char* wanson_group_model_data_get();
+
+/// @brief 分组设置
+/// @param count 分组下标,注意从0开始
+/// @return 0 成功,-1 失败
+int wanson_group_index_set(unsigned short count);
+
+
+/// @brief 语音识别分组获取(注意不是模型分组)
+int wanson_kws_group_index_get();
+
+#define CMD_SCORE_LOG 1
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+#ifndef _ASR_SCORE_H_
+#define _ASR_SCORE_H_
+
+/**************************************************************************
+ * Copyright (C) 2023 Wanson
+ **************************************************************************
+ *
+ * Description : asr_score.h
+ * Author : tang pei
+ * Date : 2025.08.22 10:38
+ *
+ **************************************************************************/
+
+/**
+*Features:
+*Modify the threshold for identifying an instruction
+*wake_score : Instructions and threshold for wakeword grouping
+*cmd_score : Instructions and threshold for command group
+*
+*1、When initializing the program, call the following API
+* extern int wanson_threshold_update(void* custom_wake_ptr, unsigned short custom_wake_size, void* custom_cmd_ptr, unsigned short custom_cmd_size);
+* if (wanson_threshold_update(&wake_score, sizeof(wake_score), &cmd_score, sizeof(cmd_score)) < 0) {
+* printf("wanson_threshold_update Failed!");
+* }
+*
+*2、Declare the function "void wanson_score_display_set(unsigned char value);"
+* And after the voice initialization is completed, call "wanson_score_display_set(1);"
+* to display the score of the current voice recognition result.
+*
+*3、When the score of the voice recognition result is greater than the recognition command score predefined in "asr_score.h", it indicates a successful recognition.
+* The function "int Wanson_ASR_Recog(short* buf, int buf_len, const char** text, float* score);" will return the recognition result and save it in "text".
+**/
+
+
+#define ASR_CMD_LEN 20 //Please do not modify
+
+typedef struct {
+ int score;
+ char cmd[ASR_CMD_LEN];
+}asr_score_t;
+
+
+#endif
\ No newline at end of file
--- /dev/null
+/******************************************************************************
+ * @file voice_app.c.c
+ * @author Tangp
+ * @date: 29.January 2021
+ * @version: V1.0
+ * @copyright Shanghai Wanson Elec Technology Co.,Ltd. All rights reserved.
+ ******************************************************************************/
+
+#include "voice_config.h"
+#include "asr_score.h"
+#include "voice_app.h"
+#include "bk_app.h"
+#if (USR_KWS_ALG == KWS_HZ)
+
+const asr_score_t wake_score[] = {
+ {8300,"接听电话"},
+ {8300,"挂断电话"},
+ {8300,"小度同学"},
+ {8300,"小乐小乐"},
+ {8300,"小艾小艾"},
+ {8300,"小艾退下"},
+ {8300,"小艾再见"},
+ {8300,"小爱同学"},
+ {8300,"打开助手"},
+ {8300,"你好助手"},
+
+};
+
+const asr_score_t cmd_score[] = {
+ {-2400, "接听电话"},
+ {-2400, "挂断电话"},
+ {-2400, "小度同学"},
+ {-2400, "小乐小乐"},
+ {-2400, "小艾小艾"},
+ {-2400, "小艾退下"},
+ {-2400, "小艾再见"},
+ {-2400, "小爱同学"},
+ {-2400, "打开助手"},
+ {-2400, "你好助手"},
+ {-2400, "增大音量"},
+ {-2400, "减小音量"},
+ {-2400, "上一首"},
+ {-2400, "下一首"},
+ {-2400, "播放音乐"},
+ {-2400, "继续播放"},
+ {-2400, "暂停播放"},
+ {-2400, "停止播放"},
+ {-2400, "切换到英文"},
+ {-2400, "升级模式"},
+ {-2400, "再见"},
+ {-2400, "不聊了"},
+ {-2400, "站起来"},
+ {-2400, "站立"},
+ {-2400, "坐下"},
+ {-2400, "趴下"},
+ {-2400, "转个圈"},
+ {-2400, "打个滚"},
+ {-2400, "去尿尿"},
+ {-2400, "尿尿去"},
+ {-2400, "去睡觉"},
+ {-2400, "睡觉去"},
+ {-2400, "装死"},
+ {-2400, "秀一个"},
+ {-2400, "跳个舞"},
+ {-2400, "跳舞"},
+ {-2400, "来个绝活"},
+ {-2400, "倒立旋转"},
+ {-2400, "前进"},
+ {-2400, "后退"},
+ {-2400, "左转"},
+ {-2400, "向左转"},
+ {-2400, "右转"},
+ {-2400, "向右转"},
+ {-2400, "过来"},
+ {-2400, "走开"},
+ {-2400, "滚开"},
+ {-2400, "滚蛋"},
+ {-2400, "匍匐前进"},
+ {-2400, "滑步"},
+ {-2400, "我讨厌你"},
+ {-2400, "打开灯光"},
+ {-2400, "关闭灯光"},
+ {-2400, "调亮灯光"},
+ {-2400, "调暗灯光"},
+ {-2400, "七彩模式"},
+ {-2400, "音乐模式"},
+ {-2400, "白色灯光"},
+ {-2400, "黄色灯光"},
+ {-2400, "自然灯光"},
+ {-2400, "红色灯光"},
+ {-2400, "绿色灯光"},
+ {-2400, "蓝色灯光"},
+ {-2400, "橙色灯光"},
+ {-2400, "青色灯光"},
+ {-2400, "紫色灯光"},
+ {-2400, "开始配网"},
+ {-2400, "停止配网"},
+ {-2400, "开开"},
+ {-2400, "关关"},
+ {-2400, "定时"},
+ {-2400, "取消"},
+ {-2400, "打开关闭"},
+ {-2400, "关闭打开"},
+ {-2400, "打开火焰"},
+ {-2400, "关闭火焰"},
+ {-2400, "打开电视"},
+ {-2400, "关闭电视"},
+ {-2400, "打开空调"},
+ {-2400, "关闭空调"},
+
+};
+
+#define N 480
+static short PcmBuf1[N] = { 0 };
+
+u8 data_update_flag;
+u8 wakeup_flag = 0;
+static uint32_t asr_wakeup_tick_timer = 0;
+static uint32_t asr_wakeup_timers = VOICE_WAKEUP_TIMEOUT;
+
+
+// void set_wakeup_tiems(unsigned int value)
+// {
+// asr_wakeup_timers = value;
+// }
+
+uint8_t get_wakeup_status()
+{
+ return wakeup_flag;
+}
+void set_wakeup_status(uint8_t value)
+{
+ wakeup_flag = value;
+}
+
+/*----------------------------------------------------------------------------*/
+/**@brief asr睡眠定时器
+ @param
+ @return 无
+ @note
+*/
+/*----------------------------------------------------------------------------*/
+
+static void asr_timer_loop(void)
+{
+ static int cnt = 0;
+ cnt++;
+ if (cnt >= 10) // 1S
+ {
+ cnt = 0;
+ if (wakeup_flag) {
+
+ asr_wakeup_tick_timer++;
+ } else {
+ asr_wakeup_tick_timer = 0;
+ }
+ }
+}
+
+/*----------------------------------------------------------------------------*/
+/**@brief 定时器计数清零
+ @param
+ @return 无
+ @note
+*/
+/*----------------------------------------------------------------------------*/
+void asr_timer_cnt_clear(void)
+{
+ asr_wakeup_tick_timer = 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**@brief asr定时器初始化
+ @param
+ @return 无
+ @note
+*/
+/*----------------------------------------------------------------------------*/
+static void asr_timer_init(void)
+{
+ asr_wakeup_tick_timer = 0;
+ wakeup_flag = 0;
+
+ // priv:私有参数
+ // func:定时扫描回调函数
+ // msec:定时时间, 单位:毫秒
+ sys_s_hi_timer_add(NULL, asr_timer_loop, 100);
+}
+
+/**
+ * @brief 唤醒时间是否超时
+ * @param[in] 唤醒时间
+ * @return 0:未超时 1:超时
+ */
+int32_t asr_is_timeout(unsigned int timeOut)
+{
+ return asr_wakeup_tick_timer > timeOut ? 1 : 0;
+}
+
+int wanson_kws_algorithm_init()
+{
+ if (Wanson_ASR_Init() < 0) {
+ printf("Wanson_ASR_Init Failed!\n");
+ return -1;
+ }
+ Wanson_ASR_Reset(1);
+ printf("Wanson_ASR_Init OK!\n");
+
+ if (wanson_threshold_update(&wake_score, sizeof(wake_score), &cmd_score, sizeof(cmd_score)) < 0) {
+ printf("wanson_threshold_update Failed!");
+ }
+
+ wanson_score_display_set(1);
+ return 0;
+}
+
+void wanson_kws_algorithm_deinit()
+{
+ Wanson_ASR_Release();
+}
+
+int wanson_app_proc()
+{
+
+ if (wakeup_flag && asr_is_timeout(asr_wakeup_timers)) { //退出唤醒
+ app_timerout_init();
+ }
+}
+
+int wanson_algorithm_recog(void* data, int len)
+{
+ const char* text;
+ float score;
+ int rs = 0;
+
+ if (tone_get_status()) { // 正在播放提示音
+ if (get_call_status() != BT_CALL_INCOMING) {
+ return -1;
+ }
+ }
+ rs = Wanson_ASR_Recog(data, len, &text, &score); //识别计算函数,有识别结果rs返回1
+ if (rs == 1) {
+ printf("ASR Result: %s\n", text);
+ }
+ return rs;
+}
+
+#endif
\ No newline at end of file
--- /dev/null
+#ifndef _VOICE_APP_H_
+#define _VOICE_APP_H_
+
+
+//void set_wakeup_tiems(unsigned int value);
+uint8_t get_wakeup_status();
+void set_wakeup_status(uint8_t value);
+/**-----------------------------------Information------------------------------
+**
+** 功能:唤醒定时器
+**
+**----------------------------------------------------------------------------*/
+/**
+ * @brief 定时器计数清零
+ @param
+ @return 无
+ @note
+*/
+void asr_timer_cnt_clear(void);
+/**-----------------------------------Information------------------------------
+**----------------------------------------------------------------------------*/
+int app_kws_threshold_index_get();
+void app_kws_threshold_timer_update(unsigned char value);
+void app_kws_threshold_set(unsigned char value);
+int app_kws_group_set(unsigned char value);
+
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null
+#ifndef _VOICE_CONFIG_H_
+#define _VOICE_CONFIG_H_
+
+#include "includes.h"
+#include "tone_player.h"
+#include "app_task.h"
+#include "tone_player.h"
+#include "asm\mcpwm.h"
+#include "btstack/avctp_user.h"
+
+#include "asr.h"
+#include "voice_app.h"
+#include "smart_voice/smart_voice.h"
+
+
+#include "key_event_deal.h"
+#include "dev_manager.h"
+#include "media/file_decoder.h"
+
+/**-----------------------------------Information------------------------------
+**
+** 功能:语音识别
+**
+**----------------------------------------------------------------------------*/
+
+#define PALY_INTERRUPT 1
+#define PALY_NOT_INTERRUPT 0
+
+//唤醒时间,单位(秒):10s
+#define VOICE_WAKEUP_TIMEOUT 5
+
+//唤醒词长度 = 汉字个数 * 3 + 1 /取最长指令
+//这里写得16,即最大支持5个字的识别指令
+#define ASR_CMD_LEN 50
+
+
+#endif