本文分享基于Titan Mini Board移植speex音频处理前端算法。实现AEC回声消除功能测试,分享应用Demo。
1 实现shell和文件传输
- 基于FIFO的串口驱动,移植xprintf进行标准输入输出处理,移植shell,移植xmodem实现文件传输,相关文件如下, 移植参考公众号文章和源码,这里不再赘述

2 移植speex,实现降噪和回声消除测试应用
- 参考公众号系列文章
参考https://github.com/Guineverqiu/speex_test.git
- 准备代码
git clone https://github.com/Guineverqiu/speex\_test.git
- 添加以下文件

- 项目属性中设置头文件包含路径

- 添加宏

-
设置优化-O3
-fsingle-precision-constant

-
其中
-
os_support_custom.h
-
speexecho.c需要适配
-
os_support_custom.h如下
- speexecho.c如下
#ifdef HAVE_CONFIG_H
-
编译错误 error: 'M_PI' undeclared (first use in this function)
-
src\speex_test\libspeexdsp\math_approx.h下添加
#ifndef M_PI
- shell_func.c中添加命令行
staticvoidspeexechofunc(uint8_t* param);
3 测试
-
将mic3.wav spk3.wav通过我们的shell,xmodem传输到开发板
-
核心代码如下
初始化配置,降噪,回声消除

-
执行异常,设置栈大一点
-
rtconfig.h中#define RT_MAIN_THREAD_STACK_SIZE 4096
-
测试speexecho /sdcard/mic3.wav /sdcard/spk3.wav /sdcard/out3.wav
-
打印信息和执行时间如下


- 查看生成的文件out3.wav

- 导出out3.wav

- 使用Audacity,查看波形,查看回声消除和降噪效果

4 总结
- 以上基于TitanMiniBoard移植speex音频处理前端算法。实现AEC回声消除功能测试,分享应用Demo。以上测试是从文件获取mic和spk回采数据,实践中可以实时获取对应的音频采集数据进行实时处理。
评论区
登录后即可参与讨论
立即登录