【英飞凌PSoC 6 RTT开发板试用】语音识别之一:移植CMSIS-DSP库-FFT测试

一. 前言后面会基于本开发板实现语音识别,需要使用到fft等关键算法,所以先移植cmsis-dsp库,并进行fft的测试。
移植dsp算法库添加代码git clone https://github.com/arm-software/cmsis_5.git
cmsis_5\\cmsis\\dsp下是相关文件,source下是源码
将dsp文件夹复制到自己的工程目录中,只保留
include,privateinclude,source三个文件夹
source下的每个子文件夹都是一类算法,里面的每个c都对应一个计算函数,并且有一个总文件包括其中所有的单个.c,比如basicmathfunctions.c中
删除这些总的.c,避免编译重复
删除以下文件和所有的非.c和.h文件
basicmathfunctions:basicmathfunctions.c,basicmathfunctionsf16.c
bayesfunctions:bayesfunctions.c,bayesfunctionsf16.c
commontables:commontables.c,commontablesf16.c
complexmathfunctions:complexmathfunctions.c,complexmathfunctionsf16.c
controllerfunctions:controllerfunctions.c
distancefunctions:distancefunctions.c,distancefunctionsf16.c
fastmathfunctions:fastmathfunctions.c,fastmathfunctionsf16.c
filteringfunctions:filteringfunctions.c,filteringfunctionsf16.c
interpolationfunctions:interpolationfunctions.c,interpolationfunctionsf16.c
matrixfunctions:matrixfunctions.c,matrixfunctionsf16.c
quaternionmathfunctions:quaternionmathfunctions.c
statisticsfunctions:statisticsfunctions.c,statisticsfunctionsf16.c
supportfunctions:supportfunctions.c,supportfunctionsf16.c
svmfunctions:svmfunctions.c,svmfunctionsf16.c
transformfunctions:transformfunctions.c,transformfunctionsf16.c,arm_bitreversal2.s
工程设置添加相关头文件包含路径
测试复制cmsis_5\\cmsis\\dsp\\examples\\arm\\arm_fft_bin_example下的arm_fft_bin_data.c和arm_fft_bin_example_f32.c到自己的工程目录
arm_fft_bin_example_f32.c下的
int32_t main(void)改为int32_t ffttest_main(void)
并添加#define semihosting以使能printf打印,我们已经重定向实现了printf打印到串口。
由于 arm_cfft_f32(&varinstcfftf32, testinput_f32_10khz, ifftflag, dobitreverse);会修改testinput_f32_10khz的内容,所以添加一个缓存,以便能重复测试
float32_t testtmp_f32_10khz[2048]; /* process the data through the cfft/cifft module */ memcpy(testtmp_f32_10khz,testinput_f32_10khz,sizeof(testinput_f32_10khz)); arm_cfft_f32(&varinstcfftf32, testtmp_f32_10khz, ifftflag, dobitreverse); /* process the data through the complex magnitude module for calculating the magnitude at each bin */ arm_cmplx_mag_f32(testtmp_f32_10khz, testoutput, fftsize);在自己的main函数中申明并调用
int32_t ffttest_main(void); ffttest_main();编译运行可以看到串口打印success说明测试ok。
将输入输出数据打印
printf(success\\\\\\\\n); for(int i=0; i< test_length_samples; i++) { if(i< test_length_samples/2) { printf(/*%f,%f*/\\\\\\\\r\\\\\\\\n, testinput_f32_10khz[i],testoutput[i]); } else { printf(/*%f,%f*/\\\\\\\\r\\\\\\\\n, testinput_f32_10khz[i],0.0); } }使用serialstudio可视化显示,可以看到计算结果fft频率明显的峰值


通用全新自动驾驶方案出炉,激光雷达安装在挡风玻璃后方会是最佳选择?
高速PCB设计入门知识问答集
人工神经元实时谐波电流数字检测
什么是超声波焊接 超声波焊接原理
基于鞘流即插即用3D流体动力聚焦拉曼平台
【英飞凌PSoC 6 RTT开发板试用】语音识别之一:移植CMSIS-DSP库-FFT测试
真菌毒素检测仪技术参数
iphone8什么时候上市?iphone8最新消息:iphone8真机曝光,无边框设计固然漂亮,看到价格你还敢买吗?
好消息!这9款华为/荣耀老机型迎来EMUI11内测招募
蓝牙耳机哪家的音质最好,高音质蓝牙耳机推荐
51单片机模拟实现普通电子表功能的设计
华为HAE AI杰出开发者颁奖仪式举行
伺服压力机的主要特点以及应用领域的介绍
模拟开关基础及选型知识汇总
桥式电路如何实现马达正反转
利用计算机设计单片开关电源讲座
大陆集团推出新型汽车音响系统-汽车即为扬声器
有极性电感简介
分体式蓝牙耳机有哪些推荐?好用的分体式蓝牙耳机推荐
关于一颗“任劳任怨”的数字成像芯片