基于MATLAB的数字小提琴设计_第1页
基于MATLAB的数字小提琴设计_第2页
基于MATLAB的数字小提琴设计_第3页
基于MATLAB的数字小提琴设计_第4页
基于MATLAB的数字小提琴设计_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Thedesign of a digital signal generatorand a simple digital piano based on the matlab Abstract Digitalsignal generator is a kind ofwaveform generatorbased onsoftware and hardware,can generate a variety ofbasic waveform.A variety of complexeng ineeringsignal is generated by the superposition of these basic signal,so its widely used inengineering analysis andexperiment teaching.MATLAB is a very practical engineering softwarefor data analysis andprocessing,its data acquisition toolbox provides a very convenient functions and commandsfordata inputand output,and itis convenient and practical inthe digital signal processing.This paper first introduced thedesign process of digital signal generator based on MATLAB,realized the specific methods to achieve thesimplewaveform(sine square,triangle ,slope),and then achieved a simple digital piano by the sinne.1 .Introduction With the development of computersoftware and hardware technology,more and morereal goodsfunctions can berealized by a computer.,that is what we often say. That the hardwarebecomes software can reduce the cost and make the implement modifyand simulation easier .Now there is a lot of relatively mature software such as MATLAB.Based on this consideration,I made a simpledigitalgeneratorwith MATLAB,andin order to make it linked to the practical application,I make a simple digital piano.I think it can make a certainfoundationfor future learning and work.1.1the introduction ofdigitalsignal generatorDigital signal generatorcan produce sine,square,triangle ,saw,white noise ,pulse and step etc.Digital signalscan also be called asdiscrete signal,it only give values for a functionin discretetime,and itis a sequence ofdiscontinuous temporally.The interval of discrete time is uniform,and useto express it .Thevalue ofdetermined bythe sampling frequency-Fs.In order to ensure thesampledsignalcanstay true tothe original analog signalinformation,sampling frequencymust be at least2 timesas high as the highest frequencycomponent ofthe originalsignal.This is the basicrule of sampling,called thesampling theorem.In this paper,in order tomake digital signalmore close tothe original analog signal,thesampling frequency is about 20 times higher than the original signalfrequency .The MATLAB program providesa variety of common basic signalgenerating function.This designsimulated four kinds of signals,three aredirectly using thefunctionprovided by MATLAB,only onesignal is nota called function , directlywritten.1.2the introduction of digital piano The promotion ofdigital pianoinChinabegan in eighty years twentieth Century,so far , thetone ,the quality,and theconvenience ofperformancehave reached a verymature stage,with the development of integrated circuit technology,the upgradingcankeep the originalstructureremain unchanged bythe replacement ofa simple chip.However,the digital piano haveobvious shortcomings:theconcertoproblems betwwen it and piano,orchestrarestrict the use ofdigital piano inimportantplaceinmusic,which greatlyaffect theapplication and popularization ofdigital piano.The coordination ofthe digital pianoand nonelectronic musical instrument isa pressing matter tothe current musicprofessionalsanddevelopers ofdigital piano.In this paper,I design a simple digital piano by MATLAB,to deepen the understanding of thedigital piano.2. Method2.1the realization of the digital signal generator I first analy the GUI interfaceofdigital signal generator according to the requirements of the design,and then enter the guidein the MATLABworkplace interface to open the GUIinterface.And then build a goodspecific interface of digital signal generatorin the GUI interface,andwrite the callbackfunction of eachwaveformcontrol,save the M file.Try to operate,ifthe result is correct,observe the simulation results.If thesimulation of digitalsignal generator is in correct results,check the callback functionof thecontrol key,modify andsave the M file,run again, and observe thesimulation results .2.1.1 build theGUI of the digital signal generator GUI under the environment of Matlabis a user interface composed ofwindow,cursor,buttons,menus,text and otherobjects.The user through certainmethods(such asa mouse or keyboard)select,activate thesegraphical objects,to make thecomputer producesome action orchangesuch as the realization ofcalculation,drawingetc.The operation of a graphical user interface generally havetwo parts,first of all, choose the appropriategraphicalobjects to establish thereasonable GUI interface in accordance with the requirements ofdesign, principle,and theneed ;thenwrite the callback functionof the controlsin the M fileto makethe constructed GUI interface run.The GUIinterface ofthe designof digital signal generatoruse graphicsobjects such as panel,Axes,pushbutton,Static Text, and simulatefour kinds of signal:sine ,square ,triangle ,slope.GUI interface of digitalsignal generatorare as follows:2.1.2 the basic principleof the waveform the realization of the sine wavethe mathematical expressionof sin signalsare as follows: among them: A for theamplitude,for thefrequency,for phase .In MATLAB,because theprocessing objectsarediscrete digital signal,discretizate the time variableandconstruct aonedimensiongroup: ; withthem:forthe sampling frequency.Butthevalue can not betoo large,otherwise thewaveform displaywill be very slow.the corresponding digital signal expression ofsine :After getting thediscrete values of t and y ,use plot mappingfunction toobtain the correspondingwaveform display. the realizationof square wave The mathematical expressionfor thesquaresignal:y=A 0tT/2y=-A -At0the adjustablesquare wave signal function in theamplitude,frequency,phasel can be obtained in MATLAB:the realization of triangle waveThe mathematical expressionfor thetriangle wavesignal;/T 0 tT/2/2)/T T/2tT In MATLAB,you can directlygenerate atriangle wavesignal with thefunction-sawtooth,the function can generate atriangle wavesignal of for the cycle,A for the peak,the maximum valueappeares trianglelocation.Using thisfunction, theamplitude,frequency, phase of triangle wavesignal canbeadjustable.It follows:the realization of slope waveThe mathematical expressionforobliquewave signaly=KTIn MATLAB,it can be directly usedfor programming.2.2the realization of the digital piano The realization of the digital piano is based onthe design of thedigital siginal generator,in the GUI, build a goodspecifiinterfaceof a digital piano,use sine wave produced by thedigital signal generatorto write the callback functionof each control,save the M file,operate again,observe the results of simulation .Eachkey corresponds toa certain frequency,the realization ofeach keyhas its own specificfrequency function,in order to makethe final simulation resultsbetter,choose highfrequency as thedebugging frequency.Whenthe key is pressed,first ,a corresponding key is associated with digital signal,thenthe digital signal is written into the buffer of a sound card,the corresponding frequencysoundcomes from the sound card,and display thewaveform ,when the key isloosened,the soundis stopped.2.2.1 build theGUI of the digital piano A total of 7keys: A,B,C,D,E,F,Gis contained in the design interface,because the division of the bassfrequency is not obvious,thepaperchoosed midrange frequencies,and eachkey corresponds to afrequency sine wavesignal,the signalfrequency of eachkey is 392,440,494,523,587,659,698Hz.GUI interface of the digital piano are as follows:2.2.2 the callback function of key The difference among the callback function of A,B,C,D,E,F,Gis that theirf is different,so useA key toexplain:function pushbuttonA_Callback(hObject, eventdata, handles)Fs = 8000;f=392;T =1;dt=1.0/Fs;N=T/dtt=linspace(0,T,N);y =5*sin(2*pi*f*t);plot(t,y);axis(0, 0.01, -8,8);wavplay(y,Fs);3. Result3.1the simulation result of the digital signal generator3.1.1 the simulation result of sin3.1.2 the simulation result of square3.1.3 the simulation result of triangle3.1.4 the simulation result of slope 3.2the simulation result of the digital piano 3.2.1the simulation result of A key3.2.2the simulation result of B key3.2.3the simulation result of C key3.2.4the simulation result of D key3.2.5the simulation result of E key3.2.6the simulation result of F key3.2.7the simulation result of G key4. Conclusion this paper analyed several digital signal waveform of the signal generator and used functions provided with MATLAB to displaye four signal waveform . Through designing interface module by the GUI, the final result is

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论