




已阅读5页,还剩10页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1.System Design SchemaThis system is called speech spectrum analyzer based on the development tools called TM320C6416. The software is tested on code composer studio 6416(CCS6416). The system can realize the function that It can analyse the spectrum of the speech signals inputted by fast fourier transform(FFT) algorithm, and then print the frequency by ergodic algorithm, which can help find the number of the maxmum magnitude location. In addition, the system also can paly the voice which was recoded before. The C6X is used to designate a member of Texas Instruments (TI) TMS320C6000 family of digital signal processors. The architecture of the C6x digital signal processor is very well suited for numerically intensive calculations. The FFT with the radix-2 algorithm is a efficient algorithm that is used for converting a time-domain signal into an equivalent frequency-domine signal , based on the discrete frouier transform(DFT), The FFT reduces considerably the computational requirements of the DFT. The DFT of a discrete-time signal x(nT) isThe FFT algorithm takes advantage of the periodicity and symmetry of the twiddle constants to reduce the computational requirements of the FFT. From the periodicity of W,and from the symmetry of WAn eight-point FFT is illustrated through the following exercise. We will see that flow graphs for higher-order FFT (larger N) can readily be obtained.figure1. Eight-point FFT flow graph using DITFor the reason that the speech signals recognition is quite hard ,so 512-point FFT has been adopted. After FFT algorithm finished, 512 magnitudes will be acquired. Then the maximum value will be found by the ergodic algorithm, and we can get the accurate frequency by the equation of , and then print it in CCS. Besides, I have set many flags to identify whether the frequency belongs to high frequency, or low frequency by the way of the LED turning on.2.Goal and Test Level of the system AchievedThe system can record the voice in surroundings, and then play what it records, besides, the system can also analyse the frequency of the recording voice by FFT algorithm. And t the analysed speech signal spectrum by C language can be a consistent with what is analysed by the built-in algorithm of CCS6416. I have compared the result produced by C language and the result of the CCS6416s built-in GUI FFT algorithm, and I can get the perfect accordance with just 0.002% deviation. So the system can reach to the purpose accurately. 3.Block Diagram and Flow Chart of System ImplementationThis system consists of three parts, one is speech signal acquisition module, and another is signal processing module, which is finished by STM320C6416 and FFT algorithm, and the last is speech sognal output module.Block Diagram is showed in figure2: figure2 block biagram of speech signal spectrum analysis systemFlow chat of system is shown in figure3:figure3 flow chart of speech signal spectrum analysis systemAfter burnprocess has been finished, the system is waiting. In the case of testing the switch has been pressed, the record function starts, and the record will finish in the condition that switch three has been uplifted or the buffer is been fulfilled with that can be observed if the LED three is off. And then if switch zero has been pressed, the system will begin to play what has record before, and playing is finished in the condition of switch zero is uplifted, the the FFT begin after LED one turning on. The frequency will be printed in the CCS6416, and while LED one turns off ,it means the FFT is over, and the whole function has been finished.4.the Key Point and Difficulties of System ImplementationThe key point of this system is the implement of FFT algorithm. FFT algorithm has to analyze the spectrum of speech signal accurately, which is hard for C language to implement. The difficulties of the system implementation lies on the FFT algorithms operatoring speed and accuracy. I adopted 512-point FFT analysis, and then I find the maximum magnitude by ergodic algorithm, which has to compare all 512 points with each other to find the maxmum magnitude. There is no doubt that it is time-consuming. So the system can not fulfilled the real-time capability of computing magnitude. 5.Core Code and Explanation of SystemThe code of the system is listed as follows: /record.c record/play input using external memory#include #include math.h#include dsk6416_aic23.h/codec supportUint32 fs=DSK6416_AIC23_FREQ_8KHZ;/set sampling rateUint16 inputsource=DSK6416_AIC23_INPUT_MIC; / select input unsigned long i,count,s;short bufferN;short buffer1SAMPLENUMBER;long m;float max;void InitForFFT();int INPUTSAMPLENUMBER,DATASAMPLENUMBER;float fWaveRSAMPLENUMBER,fWaveISAMPLENUMBER,wSAMPLENUMBER;float sin_tabSAMPLENUMBER,cos_tabSAMPLENUMBER;#pragma DATA_SECTION(buffer,.EXT_RAM) /buffer -external memoryvoid main() int q,t,n,m,l,tt=0; short playing = 0; DSK6416_DIP_init(); DSK6416_LED_init(); comm_poll(); /init DSK, codec, McBSP InitForFFT(); count=0; while(1) /infinite loop if(DSK6416_DIP_get(3) = 0) /if SW#3 is pressed DSK6416_LED_on(3); /turn on LED#3 buffercount+ = input_left_sample(); if(DSK6416_DIP_get(3) =1|(count=N-1) /if SW#3 is pressed DSK6416_LED_off(3); if(DSK6416_DIP_get(0)=0) /if SW#0 pressed count=0; playing = 1; while (playing = 1) DSK6416_LED_on(0); /turn on LED#0 output_left_sample(buffercount+); if(count=N-1) DSK6416_LED_off(0); for(s=50;sN/SAMPLENUMBER;s+) n=0; for(l=SAMPLENUMBER*(s-1);ls*512;l+) n=l-SAMPLENUMBER*(s-1); buffer1n=bufferl; for(q=0;qSAMPLENUMBER;q+) fWaveRq=buffer1q; fWaveIq=0.0f; FFT(fWaveR,fWaveI); max=w0; m=0; for(t=0;tSAMPLENUMBER/2;t+) if(maxwt) max=wt;m=t; /for(l=SAMPLENUMBER*(s-1);l=1046&tt513) DSK6416_LED_on(2); else if(tt0) DSK6416_LED_on(1); else DSK6416_LED_on(3); DSK6416_LED_on(1); DSK6416_LED_on(2); if(tt25) printf(%dn,tt); DSK6416_LED_off(1); DSK6416_LED_off(2); DSK6416_LED_off(3); /for(s=1;s=N-1) / while (playing = 1) playing=0; DSK6416_LED_on(0); /if(DSK6416_DIP_get(0)=0) /while(1)/main void FFT(float dataRSAMPLENUMBER,float dataISAMPLENUMBER)int x0,x1,x2,x3,x4,x5,x6,x7,x8,xx;int i,j,k,b,p,L;float TR,TI,temp;/* following code invert sequence */for ( i=0;iSAMPLENUMBER;i+ )x0=x1=x2=x3=x4=x5=x6=x7=x8=0;x0=i&0x01; x1=(i/2)&0x01; x2=(i/4)&0x01; x3=(i/8)&0x01;x4=(i/16)&0x01; x5=(i/32)&0x01; x6=(i/64)&0x01;x7=(i/128)&0x01;x8=(i/256)&0x01;/x=x0*1024+x1*512+x2*256+x3*128+x4*64+x5*32+x6*16+x7*8+x8*4+x9*2+x10;xx=x0*256+x1*128+x2*64+x3*32+x4*16+x5*8+x6*4+x7*2+x8;dataIxx=dataRi;for ( i=0;iSAMPLENUMBER;i+ )dataRi=dataIi; dataIi=0; /* following code FFT */for ( L=1;L0 ) b=b*2; i-; /* b= 2(L-1) */for ( j=0;j0 ) /* p=pow(2,7-L)*j; */p=p*2; i-;p=p*j;for ( k=j;kSAMPLENUMBER;k=k+2*b ) /* for (3) */TR=dataRk; TI=dataIk; temp=dataRk+b;dataRk=dataRk+dataRk+b*cos_tabp+dataIk+b*sin_tabp;dataIk=dataIk-dataRk+b*sin_tabp+dataIk+b*cos_tabp;dataRk+b=TR-dataRk+b*cos_tabp-dataIk+b*sin_tabp;dataIk+b=TI+temp*sin_tabp-dataIk+b*cos_tabp; /* END for (3) */ /* END for (2) */ /* END for (1) */for ( i=0;iSAMPLENUMBER;i+ ) wi=sqrt(dataRi*dataRi+dataIi*dataIi); /* END FFT */Firstly, I set the sampling fruquency as 8 Khz, and the total buffer number is 512000 which means that it can record the voice as long as 64 seconds. The core of the code includes three parts. One is the recording part, and the second is playing part, and the third is the FFT analysis part. While the DSP chip detect the switch three was pressed, then recording starts. Recording is accomplished by the fuction called input_sample., which can complete the AD sampling and store the sampled value into buffer. LED three will turn off while the buffer has been filled or the switch three is uplifted. Then if you press switch zero, then playing starts, which can paly what has been recorded. And the playing part is accomplished by the function called output_sample, which can read the discrete value in the buffer and turn in to analogy speech signal. After the palying is over, LED zero will turn off, and LED one will turn on indicating that FFT with the radix-2 analysis begins. FFT algorithm computing is accomplished by looking up to table, and the table is made up by the sine function and cosine fuction, we will get the real and imaginary parts of magnitudes. And then by the way of ergodic algorithm to find the accurate number of location of the maxmum magnitude. We will get the frequency by equation of, After the FFT finished, LED one will turn off, and the speech signal spectrum analyzer has fulfilled all function.6.Debugging Recording of System and Testing IllustrationEach time, FFT analyze 512 points. So I divide the whole buffer into lots of little buffer containing 512 points. The debugging processing mainly depends on the location of breakpoints. I set the breakpoint in the location of FFT analyze of each little buffer called buffer1, and when the code execute the location of breakpoint, I open the view of FFT analyze of CCS6416 built-in, and compared the result printed by the FFT algorithm realized by C language and the result of the view
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 健康教育培训知识题课件
- 俱乐部饮水安全培训计划课件
- 集团档案组管理办法
- 建行岗位考试题库及答案
- 2025年病理学乳腺癌组织病理学特征分析答案及解析
- 税务违法检举管理办法
- 企业安全管理培训目的课件
- 食品安全风险评估模型-洞察及研究
- 出行安全课件
- 出行安全培训课件
- CJ/T 516-2017生活垃圾除臭剂技术要求
- 大头儿子测试题及答案
- 日本所有番号分类
- T/CGCC 17-2018商业信誉评价体系
- 商场保洁服务应急预案
- 低空经济培训项目工程方案
- 国际压力性损伤-溃疡预防和治疗临床指南(2025年版)解读课件
- 外贸英语专业课件
- 心血管系统疾病相关专业医疗质量控制指标(2021年版)
- 苏教版六年级上册数学教案:19分数与分数相乘及分数乘法练习
- 2025学校食堂食品安全培训
评论
0/150
提交评论