mirror of
https://github.com/espressif/esp-sr.git
synced 2025-09-15 15:28:44 +08:00
feat: esp32 support wakenet9
This commit is contained in:
parent
5a9740bad3
commit
f133066f3d
@ -69,7 +69,7 @@ if((${IDF_TARGET} STREQUAL "esp32s3") OR (${IDF_TARGET} STREQUAL "esp32p4") OR (
|
||||
"-Wl,--end-group")
|
||||
|
||||
|
||||
if(CONFIG_IDF_TARGET_ESP32S3 OR CONFIG_IDF_TARGET_ESP32P4)
|
||||
if(CONFIG_PARTITION_TABLE_CUSTOM)
|
||||
set(MVMODEL_EXE ${COMPONENT_PATH}/model/movemodel.py)
|
||||
idf_build_get_property(build_dir BUILD_DIR)
|
||||
set(image_file ${build_dir}/srmodels/srmodels.bin)
|
||||
|
||||
@ -52,32 +52,8 @@ choice SR_VADN_MODEL_LOAD
|
||||
depends on IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32P4
|
||||
endchoice
|
||||
|
||||
choice SR_WN_MODEL_LOAD
|
||||
prompt "Select wake words"
|
||||
default SR_WN_WN5_HILEXIN
|
||||
depends on IDF_TARGET_ESP32
|
||||
help
|
||||
Select the Wake Words to be loaded.
|
||||
|
||||
config SR_WN_WN5_HILEXIN
|
||||
bool "Hi,Lexin (wn5_hilexin)"
|
||||
|
||||
config SR_WN_WN5X3_HILEXIN
|
||||
bool "Hi,Lexin (wn5_hilexinX3)"
|
||||
|
||||
config SR_WN_WN5_NIHAOXIAOZHI
|
||||
bool "nihaoxiaozhi (wn5_nihaoxiaozhi)"
|
||||
|
||||
config SR_WN_WN5X3_NIHAOXIAOZHI
|
||||
bool "nihaoxiaozhi (wn5_nihaoxiaozhiX3)"
|
||||
|
||||
config SR_WN_WN5X3_NIHAOXIAOXIN
|
||||
bool "nihaoxiaoxin (wn5_nihaoxiaoxinX3)"
|
||||
|
||||
endchoice
|
||||
|
||||
menu "Load Multiple Wake Words"
|
||||
depends on IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32P4
|
||||
depends on IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32P4 || IDF_TARGET_ESP32
|
||||
|
||||
config SR_WN_WN9_HILEXIN
|
||||
bool "Hi,乐鑫 (wn9_hilexin)"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -126,7 +126,7 @@ typedef struct {
|
||||
afe_agc_mode_t
|
||||
agc_mode; // The AGC mode for ASR. and the gain generated by AGC acts on the audio after far linear gain.
|
||||
int agc_compression_gain_db; // Compression gain in dB (default 9)
|
||||
int agc_target_level_dbfs; // Target level in -dBfs of envelope (default -3)
|
||||
int agc_target_level_dbfs; // Target level in -dBfs of envelope (default 3, means target level is -3 dBFS)
|
||||
|
||||
/********** General AFE(Audio Front End) parameter **********/
|
||||
afe_pcm_config_t pcm_config; // Config the channel num of original data which is fed to the afe feed function.
|
||||
|
||||
@ -24,83 +24,6 @@ const esp_wn_iface_t *esp_wn_handle_from_name(const char *model_name);
|
||||
*/
|
||||
char* esp_wn_wakeword_from_name(const char *model_name);
|
||||
|
||||
// /**
|
||||
// * @brief Get the model coeff from model name
|
||||
// *
|
||||
// * @Warning: retuen model_coeff_getter_t, when chip is ESP32,
|
||||
// * return string for other chips
|
||||
// *
|
||||
// * @param model_name The name of model
|
||||
// * @returns The handle of wakenet
|
||||
// */
|
||||
// void *esp_wn_coeff_from_name(char *model_name);
|
||||
|
||||
|
||||
#if defined CONFIG_USE_WAKENET
|
||||
/*
|
||||
Configure wake word to use based on what's selected in menuconfig.
|
||||
*/
|
||||
#if CONFIG_SR_WN_WN5_HILEXIN
|
||||
#include "hilexin_wn5.h"
|
||||
#define WAKENET_MODEL_NAME "wn5_hilexin"
|
||||
#define WAKENET_COEFF get_coeff_hilexin_wn5
|
||||
|
||||
#elif CONFIG_SR_WN_WN5X2_HILEXIN
|
||||
#include "hilexin_wn5X2.h"
|
||||
#define WAKENET_MODEL_NAME "wn5_hilexinX2"
|
||||
#define WAKENET_COEFF get_coeff_hilexin_wn5X2
|
||||
|
||||
|
||||
#elif CONFIG_SR_WN_WN5X3_HILEXIN
|
||||
#include "hilexin_wn5X3.h"
|
||||
#define WAKENET_MODEL_NAME "wn5_hilexinX3"
|
||||
#define WAKENET_COEFF get_coeff_hilexin_wn5X3
|
||||
|
||||
|
||||
#elif CONFIG_SR_WN_WN5_NIHAOXIAOZHI
|
||||
#include "nihaoxiaozhi_wn5.h"
|
||||
#define WAKENET_MODEL_NAME "wn5_nihaoxiaozhi"
|
||||
#define WAKENET_COEFF get_coeff_nihaoxiaozhi_wn5
|
||||
|
||||
|
||||
#elif CONFIG_SR_WN_WN5X2_NIHAOXIAOZHI
|
||||
#include "nihaoxiaozhi_wn5X2.h"
|
||||
#define WAKENET_MODEL_NAME "wn5_nihaoxiaozhiX2"
|
||||
#define WAKENET_COEFF get_coeff_nihaoxiaozhi_wn5X2
|
||||
|
||||
|
||||
#elif CONFIG_SR_WN_WN5X3_NIHAOXIAOZHI
|
||||
#include "nihaoxiaozhi_wn5X3.h"
|
||||
#define WAKENET_MODEL_NAME "wn5_nihaoxiaozhiX3"
|
||||
#define WAKENET_COEFF get_coeff_nihaoxiaozhi_wn5X3
|
||||
|
||||
|
||||
#elif CONFIG_SR_WN_WN5X3_NIHAOXIAOXIN
|
||||
#include "nihaoxiaoxin_wn5X3.h"
|
||||
#define WAKENET_MODEL_NAME "wn5_nihaoxiaoxinX3"
|
||||
#define WAKENET_COEFF get_coeff_nihaoxiaoxin_wn5X3
|
||||
|
||||
|
||||
#elif CONFIG_SR_WN_WN5X3_HIJESON
|
||||
#include "hijeson_wn5X3.h"
|
||||
#define WAKENET_MODEL_NAME "wn5_hijesonX3"
|
||||
#define WAKENET_COEFF get_coeff_hijeson_wn5X3
|
||||
|
||||
#elif CONFIG_SR_WN_WN5_CUSTOMIZED_WORD
|
||||
#include "customized_word_wn5.h"
|
||||
#define WAKENET_MODEL_NAME "wn5_customizedword"
|
||||
#define WAKENET_COEFF get_coeff_customizedword_wn5
|
||||
|
||||
#else
|
||||
#define WAKENET_MODEL_NAME "NULL"
|
||||
#define WAKENET_COEFF "COEFF_NULL"
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define WAKENET_MODEL_NAME "NULL"
|
||||
#define WAKENET_COEFF "COEFF_NULL"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -246,75 +246,6 @@ void srmodel_spiffs_deinit(srmodel_list_t *models)
|
||||
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
srmodel_list_t *srmodel_config_init()
|
||||
{
|
||||
if (static_srmodels == NULL) {
|
||||
static_srmodels = srmodel_list_alloc();
|
||||
} else {
|
||||
return static_srmodels;
|
||||
}
|
||||
|
||||
srmodel_list_t *models = static_srmodels;
|
||||
models->num = 2;
|
||||
models->model_name = malloc(models->num * sizeof(char *));
|
||||
models->model_info = malloc(models->num * sizeof(char *));
|
||||
for (int i = 0; i < models->num; i++) {
|
||||
models->model_name[i] = (char *) calloc(MODEL_NAME_MAX_LENGTH, sizeof(char));
|
||||
models->model_info[i] = NULL;
|
||||
}
|
||||
|
||||
// If wakenet is selected in menuconfig, load the wakenet model
|
||||
if (strcmp(WAKENET_MODEL_NAME, "NULL") == 0) {
|
||||
models->num --;
|
||||
free(models->model_name[models->num]);
|
||||
} else {
|
||||
strcpy(models->model_name[0], WAKENET_MODEL_NAME);
|
||||
}
|
||||
|
||||
// If multinet is selected in menuconfig, load the multinet model
|
||||
if (strcmp(MULTINET_MODEL_NAME, "NULL") == 0) {
|
||||
models->num --;
|
||||
free(models->model_name[models->num]);
|
||||
} else {
|
||||
strcpy(models->model_name[models->num - 1], MULTINET_MODEL_NAME);
|
||||
}
|
||||
|
||||
// could not find any avaliable models, return NULL
|
||||
if (models->num == 0) {
|
||||
free(models->model_name);
|
||||
free(models);
|
||||
models = NULL;
|
||||
}
|
||||
|
||||
return models;
|
||||
}
|
||||
|
||||
void srmodel_config_deinit(srmodel_list_t *models)
|
||||
{
|
||||
if (models != NULL) {
|
||||
if (models->num > 0) {
|
||||
for (int i = 0; i < models->num; i++) {
|
||||
free(models->model_name[i]);
|
||||
if (models->model_info[i] != NULL) {
|
||||
free(models->model_info[i]);
|
||||
}
|
||||
}
|
||||
free(models->model_name);
|
||||
free(models->model_info);
|
||||
}
|
||||
free(models);
|
||||
}
|
||||
// models is static_srmodels
|
||||
static_srmodels = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
model_coeff_getter_t *srmodel_get_model_coeff(char *model_name)
|
||||
{
|
||||
model_coeff_getter_t *gettercb = (model_coeff_getter_t *)&WAKENET_COEFF;
|
||||
return gettercb;
|
||||
}
|
||||
|
||||
static uint32_t read_int32(char *data)
|
||||
{
|
||||
@ -596,9 +527,6 @@ srmodel_list_t *esp_srmodel_init(const char *partition_label)
|
||||
{
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
return srmodel_config_init();
|
||||
#else
|
||||
|
||||
#ifdef CONFIG_MODEL_IN_SDCARD
|
||||
// Read model data from SD card
|
||||
@ -620,7 +548,6 @@ srmodel_list_t *esp_srmodel_init(const char *partition_label)
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#else
|
||||
return srmodel_sdcard_init(partition_label);
|
||||
#endif
|
||||
@ -629,13 +556,7 @@ srmodel_list_t *esp_srmodel_init(const char *partition_label)
|
||||
void esp_srmodel_deinit(srmodel_list_t *models)
|
||||
{
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
return srmodel_config_deinit(models);
|
||||
#else
|
||||
return srmodel_mmap_deinit(models);
|
||||
#endif
|
||||
|
||||
#else
|
||||
return srmodel_sdcard_deinit(models);
|
||||
#endif
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
# Espressif ESP32 Partition Table
|
||||
# Name, Type, SubType, Offset, Size
|
||||
factory, app, factory, 0x010000, 8000k
|
||||
model, data, spiffs, , 1200K,
|
||||
|
||||
|
15
test_apps/esp-sr/sdkconfig.ci.esp32
Normal file
15
test_apps/esp-sr/sdkconfig.ci.esp32
Normal file
@ -0,0 +1,15 @@
|
||||
# This file was generated using idf.py save-defconfig. It can be edited manually.
|
||||
# Espressif IoT Development Framework (ESP-IDF) 5.5.0 Project Minimal Configuration
|
||||
#
|
||||
CONFIG_IDF_TARGET="esp32"
|
||||
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_esp32.csv"
|
||||
CONFIG_SR_WN_WN9_HILEXIN=y
|
||||
CONFIG_SPIRAM=y
|
||||
CONFIG_SPIRAM_SPEED_80M=y
|
||||
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
|
||||
CONFIG_ESP_INT_WDT_TIMEOUT_MS=1000
|
||||
CONFIG_COMPILER_OPTIMIZATION_PERF=y
|
||||
15
test_apps/esp-sr/sdkconfig.ci.esp32_wn9
Normal file
15
test_apps/esp-sr/sdkconfig.ci.esp32_wn9
Normal file
@ -0,0 +1,15 @@
|
||||
# This file was generated using idf.py save-defconfig. It can be edited manually.
|
||||
# Espressif IoT Development Framework (ESP-IDF) 5.5.0 Project Minimal Configuration
|
||||
#
|
||||
CONFIG_IDF_TARGET="esp32"
|
||||
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_esp32.csv"
|
||||
CONFIG_SR_WN_WN9_HILEXIN=y
|
||||
CONFIG_SPIRAM=y
|
||||
CONFIG_SPIRAM_SPEED_80M=y
|
||||
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
|
||||
CONFIG_ESP_INT_WDT_TIMEOUT_MS=1000
|
||||
CONFIG_COMPILER_OPTIMIZATION_PERF=y
|
||||
@ -5,7 +5,7 @@ CONFIG_IDF_TARGET="esp32"
|
||||
CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16
|
||||
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_esp32.csv"
|
||||
CONFIG_SR_MN_CN_MULTINET2_SINGLE_RECOGNITION=y
|
||||
|
||||
Loading…
Reference in New Issue
Block a user