feat:update ci sdkconfig

This commit is contained in:
xysun 2025-01-26 10:33:31 +08:00
parent 284b382189
commit 769b535043
31 changed files with 480 additions and 225 deletions

View File

@ -1,13 +1,14 @@
if(IDF_TARGET STREQUAL "esp32")
if((${IDF_TARGET} STREQUAL "esp32s3") OR (${IDF_TARGET} STREQUAL "esp32p4") OR (${IDF_TARGET} STREQUAL "esp32"))
set(include_dirs
src/include
esp-tts/esp_tts_chinese/include
include/esp32
"esp-tts/esp_tts_chinese/include"
"include/${IDF_TARGET}"
"src/include"
)
set(srcs
src/model_path.c
src/esp_mn_speech_commands.c
src/esp_process_sdkconfig.c
"src/model_path.c"
"src/esp_mn_speech_commands.c"
"src/esp_process_sdkconfig.c"
)
set(requires
@ -20,244 +21,320 @@ if(IDF_TARGET STREQUAL "esp32")
ENDIF (IDF_VERSION_MAJOR GREATER 4)
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${include_dirs}
REQUIRES ${requires}
PRIV_REQUIRES spi_flash)
INCLUDE_DIRS ${include_dirs}
REQUIRES ${requires}
PRIV_REQUIRES spi_flash)
target_link_libraries(${COMPONENT_TARGET} "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32")
target_link_libraries(${COMPONENT_TARGET} "-L ${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/esp32")
add_prebuilt_library(esp_audio_processor "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32/libesp_audio_processor.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(wakenet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32/libwakenet.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(multinet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32/libmultinet.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(esp_audio_front_end "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32/libesp_audio_front_end.a" PRIV_REQUIRES ${COMPONENT_NAME})
target_link_libraries(${COMPONENT_TARGET} "-Wl,--start-group"
multinet
dl_lib
c_speech_features
wakeword_model
multinet2_ch
esp_audio_processor
esp_audio_front_end
esp_tts_chinese
voice_set_xiaole
wakenet
"-Wl,--end-group")
elseif(${IDF_TARGET} STREQUAL "esp32s3")
set(include_dirs
src/include
esp-tts/esp_tts_chinese/include
include/esp32s3
)
set(srcs
src/model_path.c
src/esp_mn_speech_commands.c
src/esp_process_sdkconfig.c
)
set(requires
json
spiffs
)
IF (IDF_VERSION_MAJOR GREATER 4)
list(APPEND requires esp_partition)
ENDIF (IDF_VERSION_MAJOR GREATER 4)
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${include_dirs}
REQUIRES ${requires}
PRIV_REQUIRES spi_flash)
target_link_libraries(${COMPONENT_TARGET} "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3")
target_link_libraries(${COMPONENT_TARGET} "-L ${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/esp32s3")
add_prebuilt_library(flite_g2p "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libflite_g2p.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(esp_audio_processor "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libesp_audio_processor.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(vadnet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libvadnet.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(wakenet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libwakenet.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(multinet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libmultinet.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(esp_audio_front_end "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libesp_audio_front_end.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(hufzip "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libhufzip.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(nsnet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libnsnet.a" PRIV_REQUIRES ${COMPONENT_NAME})
target_link_libraries(${COMPONENT_TARGET} "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib/${IDF_TARGET}")
target_link_libraries(${COMPONENT_TARGET} "-L ${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/${IDF_TARGET}")
add_prebuilt_library(dl_lib "${CMAKE_CURRENT_SOURCE_DIR}/lib/${IDF_TARGET}/libdl_lib.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(c_speech_features "${CMAKE_CURRENT_SOURCE_DIR}/lib/${IDF_TARGET}/libc_speech_features.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(esp_audio_processor "${CMAKE_CURRENT_SOURCE_DIR}/lib/${IDF_TARGET}/libesp_audio_processor.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(esp_audio_front_end "${CMAKE_CURRENT_SOURCE_DIR}/lib/${IDF_TARGET}/libesp_audio_front_end.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(esp_tts_chinese "${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/${IDF_TARGET}/libesp_tts_chinese.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(voice_set_xiaole "${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/${IDF_TARGET}/libvoice_set_xiaole.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(fst "${CMAKE_CURRENT_SOURCE_DIR}/lib/${IDF_TARGET}/libfst.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(flite_g2p "${CMAKE_CURRENT_SOURCE_DIR}/lib/${IDF_TARGET}/libflite_g2p.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(multinet "${CMAKE_CURRENT_SOURCE_DIR}/lib/${IDF_TARGET}/libmultinet.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(hufzip "${CMAKE_CURRENT_SOURCE_DIR}/lib/${IDF_TARGET}/libhufzip.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(vadnet "${CMAKE_CURRENT_SOURCE_DIR}/lib/${IDF_TARGET}/libvadnet.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(wakenet "${CMAKE_CURRENT_SOURCE_DIR}/lib/${IDF_TARGET}/libwakenet.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(nsnet "${CMAKE_CURRENT_SOURCE_DIR}/lib/${IDF_TARGET}/libnsnet.a" PRIV_REQUIRES ${COMPONENT_NAME})
idf_component_get_property(esp_dsp_lib espressif__esp-dsp COMPONENT_LIB)
target_link_libraries(${COMPONENT_TARGET} "-Wl,--start-group"
hufzip
set(sr_libs
dl_lib
fst
c_speech_features
$<TARGET_FILE:${esp_dsp_lib}>
c_speech_features
esp_audio_front_end
esp_audio_processor
multinet
flite_g2p
esp_tts_chinese
voice_set_xiaole
fst
flite_g2p
hufzip
multinet
nsnet
vadnet
wakenet
"-Wl,--end-group")
wakenet)
set(MVMODEL_EXE ${COMPONENT_PATH}/model/movemodel.py)
idf_build_get_property(build_dir BUILD_DIR)
set(image_file ${build_dir}/srmodels/srmodels.bin)
add_custom_command(
OUTPUT ${image_file}
COMMENT "Move and Pack models..."
COMMAND python ${MVMODEL_EXE} -d1 ${SDKCONFIG} -d2 ${COMPONENT_PATH} -d3 ${build_dir}
DEPENDS ${SDKCONFIG}
VERBATIM)
add_custom_target(srmodels_bin ALL DEPENDS ${image_file})
add_dependencies(flash srmodels_bin)
partition_table_get_partition_info(size "--partition-name model" "size")
partition_table_get_partition_info(offset "--partition-name model" "offset")
if("${size}" AND "${offset}")
esptool_py_flash_to_partition(flash "model" "${image_file}")
else()
set(message "Failed to find model in partition table file"
"Please add a line(Name=model, Size>recommended size in log) to the partition file.")
if(${IDF_TARGET} STREQUAL "esp32")
add_prebuilt_library(multinet2_ch "${CMAKE_CURRENT_SOURCE_DIR}/lib/${IDF_TARGET}/libmultinet2_ch.a" PRIV_REQUIRES ${COMPONENT_NAME})
list(APPEND sr_libs multinet2_ch)
endif()
elseif(${IDF_TARGET} STREQUAL "esp32p4")
set(include_dirs
src/include
esp-tts/esp_tts_chinese/include
include/esp32p4
)
set(srcs
src/model_path.c
src/esp_mn_speech_commands.c
src/esp_process_sdkconfig.c
)
set(requires
json
spiffs
)
IF (IDF_VERSION_MAJOR GREATER 4)
list(APPEND requires esp_partition)
ENDIF (IDF_VERSION_MAJOR GREATER 4)
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${include_dirs}
REQUIRES ${requires}
PRIV_REQUIRES spi_flash)
target_link_libraries(${COMPONENT_TARGET} "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32p4")
target_link_libraries(${COMPONENT_TARGET} "-L ${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/esp32p4")
add_prebuilt_library(flite_g2p "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32p4/libflite_g2p.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(esp_audio_processor "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32p4/libesp_audio_processor.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(wakenet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32p4/libwakenet.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(vadnet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32p4/libvadnet.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(multinet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32p4/libmultinet.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(esp_audio_front_end "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32p4/libesp_audio_front_end.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(hufzip "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32p4/libhufzip.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(nsnet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32p4/libnsnet.a" PRIV_REQUIRES ${COMPONENT_NAME})
idf_component_get_property(esp_dsp_lib espressif__esp-dsp COMPONENT_LIB)
target_link_libraries(${COMPONENT_TARGET} "-Wl,--start-group"
hufzip
dl_lib
fst
c_speech_features
$<TARGET_FILE:${esp_dsp_lib}>
esp_audio_front_end
esp_audio_processor
multinet
flite_g2p
esp_tts_chinese
voice_set_xiaole
wakenet
vadnet
nsnet
${sr_libs}
"-Wl,--end-group")
set(MVMODEL_EXE ${COMPONENT_PATH}/model/movemodel.py)
idf_build_get_property(build_dir BUILD_DIR)
set(image_file ${build_dir}/srmodels/srmodels.bin)
add_custom_command(
OUTPUT ${image_file}
COMMENT "Move and Pack models..."
COMMAND python ${MVMODEL_EXE} -d1 ${SDKCONFIG} -d2 ${COMPONENT_PATH} -d3 ${build_dir}
DEPENDS ${SDKCONFIG}
VERBATIM)
if(CONFIG_IDF_TARGET_ESP32S3 OR CONFIG_IDF_TARGET_ESP32P4)
set(MVMODEL_EXE ${COMPONENT_PATH}/model/movemodel.py)
idf_build_get_property(build_dir BUILD_DIR)
set(image_file ${build_dir}/srmodels/srmodels.bin)
add_custom_target(srmodels_bin ALL DEPENDS ${image_file})
add_dependencies(flash srmodels_bin)
add_custom_command(
OUTPUT ${image_file}
COMMENT "Move and Pack models..."
COMMAND python ${MVMODEL_EXE} -d1 ${SDKCONFIG} -d2 ${COMPONENT_PATH} -d3 ${build_dir}
DEPENDS ${SDKCONFIG}
VERBATIM)
partition_table_get_partition_info(size "--partition-name model" "size")
partition_table_get_partition_info(offset "--partition-name model" "offset")
add_custom_target(srmodels_bin ALL DEPENDS ${image_file})
add_dependencies(flash srmodels_bin)
if("${size}" AND "${offset}")
esptool_py_flash_to_partition(flash "model" "${image_file}")
else()
set(message "Failed to find model in partition table file"
"Please add a line(Name=model, Size>recommended size in log) to the partition file.")
partition_table_get_partition_info(size "--partition-name model" "size")
partition_table_get_partition_info(offset "--partition-name model" "offset")
if("${size}" AND "${offset}")
esptool_py_flash_to_partition(flash "model" "${image_file}")
else()
set(message "Failed to find model in partition table file"
"Please add a line(Name=model, Size>recommended size in log) to the partition file.")
endif()
endif()
elseif(${IDF_TARGET} STREQUAL "esp32s2")
set(requires
elseif((${IDF_TARGET} STREQUAL "esp32s2") OR (${IDF_TARGET} STREQUAL "esp32c3") OR (${IDF_TARGET} STREQUAL "esp32c6"))
set(requires
spiffs
)
IF (IDF_VERSION_MAJOR GREATER 4)
list(APPEND requires esp_partition)
ENDIF (IDF_VERSION_MAJOR GREATER 4)
IF (IDF_VERSION_MAJOR GREATER 4)
list(APPEND requires esp_partition)
ENDIF (IDF_VERSION_MAJOR GREATER 4)
idf_component_register(SRCS .
INCLUDE_DIRS esp-tts/esp_tts_chinese/include
REQUIRES ${requires}
PRIV_REQUIRES spi_flash)
idf_component_register(SRCS .
INCLUDE_DIRS esp-tts/esp_tts_chinese/include
REQUIRES ${requires}
PRIV_REQUIRES spi_flash)
target_link_libraries(${COMPONENT_TARGET} INTERFACE "-L ${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/esp32s2")
target_link_libraries(${COMPONENT_TARGET} INTERFACE "-Wl,--start-group"
esp_tts_chinese
voice_set_xiaole
"-Wl,--end-group")
elseif(${IDF_TARGET} STREQUAL "esp32c3")
set(requires
spiffs
)
target_link_libraries(${COMPONENT_TARGET} INTERFACE "-L ${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/${IDF_TARGET}")
add_prebuilt_library(esp_tts_chinese "${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/${IDF_TARGET}/libesp_tts_chinese.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(voice_set_xiaole "${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/${IDF_TARGET}/libvoice_set_xiaole.a" PRIV_REQUIRES ${COMPONENT_NAME})
target_link_libraries(${COMPONENT_TARGET} INTERFACE "-Wl,--start-group"
esp_tts_chinese
voice_set_xiaole
"-Wl,--end-group")
IF (IDF_VERSION_MAJOR GREATER 4)
list(APPEND requires esp_partition)
ENDIF (IDF_VERSION_MAJOR GREATER 4)
idf_component_register(SRCS .
INCLUDE_DIRS esp-tts/esp_tts_chinese/include
REQUIRES ${requires}
PRIV_REQUIRES spi_flash)
target_link_libraries(${COMPONENT_TARGET} INTERFACE "-L ${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/esp32c3")
target_link_libraries(${COMPONENT_TARGET} INTERFACE "-Wl,--start-group"
esp_tts_chinese
voice_set_xiaole
"-Wl,--end-group")
elseif(${IDF_TARGET} STREQUAL "esp32c6")
set(requires
spiffs
)
IF (IDF_VERSION_MAJOR GREATER 4)
list(APPEND requires esp_partition)
ENDIF (IDF_VERSION_MAJOR GREATER 4)
idf_component_register(SRCS .
INCLUDE_DIRS esp-tts/esp_tts_chinese/include
REQUIRES ${requires}
PRIV_REQUIRES spi_flash)
target_link_libraries(${COMPONENT_TARGET} INTERFACE "-L ${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/esp32c6")
target_link_libraries(${COMPONENT_TARGET} INTERFACE "-Wl,--start-group"
esp_tts_chinese
voice_set_xiaole
"-Wl,--end-group")
endif()
# elseif(${IDF_TARGET} STREQUAL "esp32s3")
# set(include_dirs
# src/include
# esp-tts/esp_tts_chinese/include
# include/esp32s3
# )
# set(srcs
# src/model_path.c
# src/esp_mn_speech_commands.c
# src/esp_process_sdkconfig.c
# )
# set(requires
# json
# spiffs
# )
# IF (IDF_VERSION_MAJOR GREATER 4)
# list(APPEND requires esp_partition)
# ENDIF (IDF_VERSION_MAJOR GREATER 4)
# idf_component_register(SRCS ${srcs}
# INCLUDE_DIRS ${include_dirs}
# REQUIRES ${requires}
# PRIV_REQUIRES spi_flash)
# target_link_libraries(${COMPONENT_TARGET} "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3")
# target_link_libraries(${COMPONENT_TARGET} "-L ${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/esp32s3")
# add_prebuilt_library(flite_g2p "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libflite_g2p.a" PRIV_REQUIRES ${COMPONENT_NAME})
# add_prebuilt_library(esp_audio_processor "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libesp_audio_processor.a" PRIV_REQUIRES ${COMPONENT_NAME})
# add_prebuilt_library(vadnet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libvadnet.a" PRIV_REQUIRES ${COMPONENT_NAME})
# add_prebuilt_library(wakenet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libwakenet.a" PRIV_REQUIRES ${COMPONENT_NAME})
# add_prebuilt_library(multinet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libmultinet.a" PRIV_REQUIRES ${COMPONENT_NAME})
# add_prebuilt_library(esp_audio_front_end "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libesp_audio_front_end.a" PRIV_REQUIRES ${COMPONENT_NAME})
# add_prebuilt_library(hufzip "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libhufzip.a" PRIV_REQUIRES ${COMPONENT_NAME})
# add_prebuilt_library(nsnet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libnsnet.a" PRIV_REQUIRES ${COMPONENT_NAME})
# idf_component_get_property(esp_dsp_lib espressif__esp-dsp COMPONENT_LIB)
# target_link_libraries(${COMPONENT_TARGET} "-Wl,--start-group"
# hufzip
# dl_lib
# fst
# c_speech_features
# $<TARGET_FILE:${esp_dsp_lib}>
# esp_audio_front_end
# esp_audio_processor
# multinet
# flite_g2p
# esp_tts_chinese
# voice_set_xiaole
# nsnet
# vadnet
# wakenet
# "-Wl,--end-group")
# set(MVMODEL_EXE ${COMPONENT_PATH}/model/movemodel.py)
# idf_build_get_property(build_dir BUILD_DIR)
# set(image_file ${build_dir}/srmodels/srmodels.bin)
# add_custom_command(
# OUTPUT ${image_file}
# COMMENT "Move and Pack models..."
# COMMAND python ${MVMODEL_EXE} -d1 ${SDKCONFIG} -d2 ${COMPONENT_PATH} -d3 ${build_dir}
# DEPENDS ${SDKCONFIG}
# VERBATIM)
# add_custom_target(srmodels_bin ALL DEPENDS ${image_file})
# add_dependencies(flash srmodels_bin)
# partition_table_get_partition_info(size "--partition-name model" "size")
# partition_table_get_partition_info(offset "--partition-name model" "offset")
# if("${size}" AND "${offset}")
# esptool_py_flash_to_partition(flash "model" "${image_file}")
# else()
# set(message "Failed to find model in partition table file"
# "Please add a line(Name=model, Size>recommended size in log) to the partition file.")
# endif()
# elseif(${IDF_TARGET} STREQUAL "esp32p4")
# set(include_dirs
# src/include
# esp-tts/esp_tts_chinese/include
# include/esp32p4
# )
# set(srcs
# src/model_path.c
# src/esp_mn_speech_commands.c
# src/esp_process_sdkconfig.c
# )
# set(requires
# json
# spiffs
# )
# IF (IDF_VERSION_MAJOR GREATER 4)
# list(APPEND requires esp_partition)
# ENDIF (IDF_VERSION_MAJOR GREATER 4)
# idf_component_register(SRCS ${srcs}
# INCLUDE_DIRS ${include_dirs}
# REQUIRES ${requires}
# PRIV_REQUIRES spi_flash)
# target_link_libraries(${COMPONENT_TARGET} "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32p4")
# target_link_libraries(${COMPONENT_TARGET} "-L ${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/esp32p4")
# add_prebuilt_library(flite_g2p "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32p4/libflite_g2p.a" PRIV_REQUIRES ${COMPONENT_NAME})
# add_prebuilt_library(esp_audio_processor "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32p4/libesp_audio_processor.a" PRIV_REQUIRES ${COMPONENT_NAME})
# add_prebuilt_library(wakenet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32p4/libwakenet.a" PRIV_REQUIRES ${COMPONENT_NAME})
# add_prebuilt_library(vadnet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32p4/libvadnet.a" PRIV_REQUIRES ${COMPONENT_NAME})
# add_prebuilt_library(multinet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32p4/libmultinet.a" PRIV_REQUIRES ${COMPONENT_NAME})
# add_prebuilt_library(esp_audio_front_end "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32p4/libesp_audio_front_end.a" PRIV_REQUIRES ${COMPONENT_NAME})
# add_prebuilt_library(hufzip "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32p4/libhufzip.a" PRIV_REQUIRES ${COMPONENT_NAME})
# add_prebuilt_library(nsnet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32p4/libnsnet.a" PRIV_REQUIRES ${COMPONENT_NAME})
# idf_component_get_property(esp_dsp_lib espressif__esp-dsp COMPONENT_LIB)
# target_link_libraries(${COMPONENT_TARGET} "-Wl,--start-group"
# hufzip
# dl_lib
# fst
# c_speech_features
# $<TARGET_FILE:${esp_dsp_lib}>
# esp_audio_front_end
# esp_audio_processor
# multinet
# flite_g2p
# esp_tts_chinese
# voice_set_xiaole
# wakenet
# vadnet
# nsnet
# "-Wl,--end-group")
# set(MVMODEL_EXE ${COMPONENT_PATH}/model/movemodel.py)
# idf_build_get_property(build_dir BUILD_DIR)
# set(image_file ${build_dir}/srmodels/srmodels.bin)
# add_custom_command(
# OUTPUT ${image_file}
# COMMENT "Move and Pack models..."
# COMMAND python ${MVMODEL_EXE} -d1 ${SDKCONFIG} -d2 ${COMPONENT_PATH} -d3 ${build_dir}
# DEPENDS ${SDKCONFIG}
# VERBATIM)
# add_custom_target(srmodels_bin ALL DEPENDS ${image_file})
# add_dependencies(flash srmodels_bin)
# partition_table_get_partition_info(size "--partition-name model" "size")
# partition_table_get_partition_info(offset "--partition-name model" "offset")
# if("${size}" AND "${offset}")
# esptool_py_flash_to_partition(flash "model" "${image_file}")
# else()
# set(message "Failed to find model in partition table file"
# "Please add a line(Name=model, Size>recommended size in log) to the partition file.")
# endif()
# elseif(${IDF_TARGET} STREQUAL "esp32s2")
# set(requires
# spiffs
# )
# IF (IDF_VERSION_MAJOR GREATER 4)
# list(APPEND requires esp_partition)
# ENDIF (IDF_VERSION_MAJOR GREATER 4)
# idf_component_register(SRCS .
# INCLUDE_DIRS esp-tts/esp_tts_chinese/include
# REQUIRES ${requires}
# PRIV_REQUIRES spi_flash)
# target_link_libraries(${COMPONENT_TARGET} INTERFACE "-L ${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/esp32s2")
# target_link_libraries(${COMPONENT_TARGET} INTERFACE "-Wl,--start-group"
# esp_tts_chinese
# voice_set_xiaole
# "-Wl,--end-group")
# elseif(${IDF_TARGET} STREQUAL "esp32c3")
# set(requires
# spiffs
# )
# IF (IDF_VERSION_MAJOR GREATER 4)
# list(APPEND requires esp_partition)
# ENDIF (IDF_VERSION_MAJOR GREATER 4)
# idf_component_register(SRCS .
# INCLUDE_DIRS esp-tts/esp_tts_chinese/include
# REQUIRES ${requires}
# PRIV_REQUIRES spi_flash)
# target_link_libraries(${COMPONENT_TARGET} INTERFACE "-L ${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/esp32c3")
# target_link_libraries(${COMPONENT_TARGET} INTERFACE "-Wl,--start-group"
# esp_tts_chinese
# voice_set_xiaole
# "-Wl,--end-group")
# elseif(${IDF_TARGET} STREQUAL "esp32c6")
# set(requires
# spiffs
# )
# IF (IDF_VERSION_MAJOR GREATER 4)
# list(APPEND requires esp_partition)
# ENDIF (IDF_VERSION_MAJOR GREATER 4)
# idf_component_register(SRCS .
# INCLUDE_DIRS esp-tts/esp_tts_chinese/include
# REQUIRES ${requires}
# PRIV_REQUIRES spi_flash)
# target_link_libraries(${COMPONENT_TARGET} INTERFACE "-L ${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/esp32c6")
# target_link_libraries(${COMPONENT_TARGET} INTERFACE "-Wl,--start-group"
# esp_tts_chinese
# voice_set_xiaole
# "-Wl,--end-group")
# endif()

View File

@ -0,0 +1,90 @@
// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License
#ifndef _ESP_WEBRTC_H_
#define _ESP_WEBRTC_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include "sr_ringbuf.h"
#include "esp_log.h"
#include "esp_agc.h"
#include "esp_ns.h"
#include "esp_heap_caps.h"
typedef struct {
void* ns_handle;
void* agc_handle;
int frame_size;
int sample_rate;
int16_t *buff;
int16_t *out_data;
sr_ringbuf_handle_t rb;
}webrtc_handle_t;
/**
* @brief Creates an instance of webrtc.
*
* @warning frame_length can supports be 10 ms, 20 ms, 30 ms, 32 ms.
*
* @param frame_length_ms The length of the audio processing
* @param ns_mode The mode of NS. -1 means NS is disabled. 0: Mild, 1: Medium, 2: Aggressive
* @param agc_mode The model of AGC
* @param agc_gain The gain of AGC. default is 9
* @param agc_target_level The target level of AGC. default is -3 dbfs
* @param sample_rate The sample rate of the audio.
*
* @return
* - NULL: Create failed
* - Others: The instance of webrtc
*/
webrtc_handle_t* webrtc_create(
int frame_length_ms,
int ns_mode,
agc_mode_t agc_mode,
int agc_gain,
int agc_target_level,
int sample_rate);
/**
* @brief Feed samples of an audio stream to the webrtc and get the audio stream after Noise suppression.
*
* @param handle The instance of NS.
* @param in_data An array of 16-bit signed audio samples.
* @param out_size The sample size of output data
* @param enable_ns Enable noise suppression
* @param enable_agc Enable automatic gain control
*
* @return data after noise suppression
*/
int16_t* webrtc_process(webrtc_handle_t *handle, int16_t *indata, int *size, bool enable_ns, bool enable_agc);
/**
* @brief Free the webrtc instance
*
* @param handle The instance of webrtc.
*
* @return None
*
*/
void webrtc_destroy(webrtc_handle_t *handle);
#ifdef __cplusplus
}
#endif
#endif //_ESP_NS_H_

View File

@ -0,0 +1,90 @@
// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License
#ifndef _ESP_WEBRTC_H_
#define _ESP_WEBRTC_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include "sr_ringbuf.h"
#include "esp_log.h"
#include "esp_agc.h"
#include "esp_ns.h"
#include "esp_heap_caps.h"
typedef struct {
void* ns_handle;
void* agc_handle;
int frame_size;
int sample_rate;
int16_t *buff;
int16_t *out_data;
sr_ringbuf_handle_t rb;
}webrtc_handle_t;
/**
* @brief Creates an instance of webrtc.
*
* @warning frame_length can supports be 10 ms, 20 ms, 30 ms, 32 ms.
*
* @param frame_length_ms The length of the audio processing
* @param ns_mode The mode of NS. -1 means NS is disabled. 0: Mild, 1: Medium, 2: Aggressive
* @param agc_mode The model of AGC
* @param agc_gain The gain of AGC. default is 9
* @param agc_target_level The target level of AGC. default is -3 dbfs
* @param sample_rate The sample rate of the audio.
*
* @return
* - NULL: Create failed
* - Others: The instance of webrtc
*/
webrtc_handle_t* webrtc_create(
int frame_length_ms,
int ns_mode,
agc_mode_t agc_mode,
int agc_gain,
int agc_target_level,
int sample_rate);
/**
* @brief Feed samples of an audio stream to the webrtc and get the audio stream after Noise suppression.
*
* @param handle The instance of NS.
* @param in_data An array of 16-bit signed audio samples.
* @param out_size The sample size of output data
* @param enable_ns Enable noise suppression
* @param enable_agc Enable automatic gain control
*
* @return data after noise suppression
*/
int16_t* webrtc_process(webrtc_handle_t *handle, int16_t *indata, int *size, bool enable_ns, bool enable_agc);
/**
* @brief Free the webrtc instance
*
* @param handle The instance of webrtc.
*
* @return None
*
*/
void webrtc_destroy(webrtc_handle_t *handle);
#ifdef __cplusplus
}
#endif
#endif //_ESP_NS_H_

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/esp32/libfst.a Normal file

Binary file not shown.

BIN
lib/esp32/libhufzip.a Normal file

Binary file not shown.

Binary file not shown.

BIN
lib/esp32/libnsnet.a Normal file

Binary file not shown.

BIN
lib/esp32/libvadnet.a Normal file

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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,7 @@
# 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="esp32s3"
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
CONFIG_PARTITION_TABLE_CUSTOM=y
@ -11,8 +12,6 @@ CONFIG_SPIRAM=y
CONFIG_ESP_TASK_WDT_EN=n
CONFIG_ESP_TASK_WDT_INIT=n
CONFIG_ESP_MAIN_TASK_STACK_SIZE=10240
# esp32s3
CONFIG_SPIRAM_MODE_OCT=y
CONFIG_SPIRAM_SPEED_80M=y
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y

View File

@ -1,6 +1,7 @@
# 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="esp32s3"
CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y

View File

@ -1,6 +1,7 @@
# 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="esp32p4"
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
CONFIG_PARTITION_TABLE_CUSTOM=y
@ -11,8 +12,6 @@ CONFIG_SPIRAM=y
CONFIG_ESP_TASK_WDT_EN=n
CONFIG_ESP_TASK_WDT_INIT=n
CONFIG_ESP_MAIN_TASK_STACK_SIZE=10240
# esp32p4
CONFIG_COMPILER_OPTIMIZATION_PERF=y
CONFIG_ESP32P4_REV_MIN_0=y
CONFIG_SPIRAM=y

View File

@ -1,6 +1,7 @@
# 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="esp32p4"
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
CONFIG_PARTITION_TABLE_CUSTOM=y
@ -9,7 +10,6 @@ CONFIG_SPIRAM=y
CONFIG_ESP_TASK_WDT_EN=n
CONFIG_ESP_TASK_WDT_INIT=n
CONFIG_ESP_MAIN_TASK_STACK_SIZE=10240
# esp32p4
CONFIG_COMPILER_OPTIMIZATION_PERF=y
CONFIG_ESP32P4_REV_MIN_0=y
CONFIG_SPIRAM_SPEED_200M=y

View File

@ -1,6 +1,7 @@
# 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="esp32s3"
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
CONFIG_PARTITION_TABLE_CUSTOM=y
@ -8,8 +9,6 @@ CONFIG_SR_WN_WN9_HILEXIN=y
CONFIG_SPIRAM=y
CONFIG_ESP_TASK_WDT_EN=n
CONFIG_ESP_TASK_WDT_INIT=n
# esp32s3
CONFIG_SPIRAM_MODE_OCT=y
CONFIG_SPIRAM_SPEED_80M=y
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y