EE 453 Pennsylvania State University Simulink Audio Signal Processing Lab Report

Question Description

Page

EE 453: Lab 1Introduction to Simulink: Audio Signal ProcessingSeptember 19, 2018OverviewThe purpose of this first lab is to familiarize the student with DSP developmentusing MATLAB Simulink. You will learn how to use the Simulink equivalents ofhardware measurement tools such as oscilloscopes and spectrum analyzers. Youwill then do some basic audio signal processing tasks, finishing by examiningsome common audio effects used in music.Each DSP workstation in the EE 453 lab is equipped with a computer withMATLAB Simulink installed, and headphones to be used so you don’t disturbother students.The software used in the EE 453 lab isSimulink, a component of MATLAB thatis a block diagram based development platform (similar to LabView). Simulinkallows for fast generation of DSP algorithms using an easy to learn drag-and-drop approach.1

1 System SetupBefore beginning the lab, you must make sure the system is setup as follows:•Connect your headphones to the Headphone jack on the front of the com-puter•Log on to the computer using your PSU access account.You must saveall files on your PSU W: drive. Please do not store any fileson the computer itself. It takes up hardrive space, and will bedeleted periodically. While not necessary to save the files, they will begood to have as a reference for the future labs this semester.•Download the.zipfile from Canvas containing files needed to completethe lab.2 Simulink Bench InstrumentsAs a first experiment, you will learn how to use Simulink’s spectrum analyzerand oscilloscope.1. Open up MATLAB and change the current directory to your PSU W:drive. Do this by selecting theBrowse for Foldericon located above theCURRENT FOLDER window. If you want, you may create an EE 453subdirectory on your W: drive by selecting theNew Folderbutton in theselection window.2. Typesimulinkin the MATLAB command window. You will want to opena new blank model. Once this window is open, notice the red, white andblue squares in the toolbar. This is how you access theSimulink LibraryBrowser.3. Enlarge this window so that it covers about half of your screen, but don’tcover up theSimulink Library Browserwindow. You will be dragging/-dropping blocks from various libraries into this model window to createyour various DSP algorithms. You are now ready to start building yourfirst model.2

4. The first thing is audio sources that will act as inputs to the model. IntheSimulink Libary BrowserselectDSP System toolbox?Sources?From Multimedia Fileand drag this into the model window5. After adding the block, you must set its parameters. This can be doneby double clicking on the block. Do this for theFrom Multimedia Fileblock, underFilenamebrowse until you find the audio file ”Track1.wav”downloaded from the canvas website. Accept the rest of the defaults.6. In order to play the audio file, you must add another block from the librarybrowser. The needed block isDSP System toolbox?Sinks?AudioDevice Writer. Again accept the defaults. Keep in mind the blocks mustbe connected together by clicking on the port on the block, and draggingto the next block. Test the system so far by clicking the green play buttonat the top of the Simulink file.7. We are now ready to actually analyze some signals. The first thing weare going to do is create some pure sinusoids in MATLAB. A template isgiven below:%%S c r i p t t o c r e a t e a s i n u s o i d%%I n p u t sFs = 8 0 0 0 ;%S a m p l i n g Ratef r e q = 8 0 0 ;%D e s i r e d t o n e ( Hz )f n = ’ 800Hz ’ ;%F i l e n a m eA = 0 . 1 ;%M a g n i t u d e o f s i n u s o i dT = 3 ;%L e n g t h o f s i g n a l ( s )%%S o u n d f i l et = 0 : 1 / Fs : T ;y = A?cos( 2?pi?f r e q?t ) ;a u d i o w r i t e ( s t r c a t ( f n , ’ . wav ’ ) , y , Fs ) ;Answer Q1 and Q2 on your worksheet8. Use the script above, or your own version, to create two discrete sinusoidswith?c= 0.2 and?c= 0.8. Use a sampling rate ofFs= 8000.9. In the Simulink window, we are going to place a Spectrum Analyzer inparallel with the Audio output. As the name would imply, a spectrum3

analyzer allows the user to view the frequency content (spectrum) of asignal. The spectrum analyzer is found inDSP System toolbox?Sinks?Spectrum Analyzer. The spectrum analyzer can be connectedin parallel by connecting the output port to the middle of the line betweenthe audio input and outputs.10. View the two sinusoids through the spectrum analyzer (run the simulinkfile). Verify that the peaks of the signals are at the expected frequencies.This can be done by using the file menus of the spectrum analyzerTools?Measurements?Peak Finder.Call your TA over to verify that this program is working.YourTA will sign your lab worksheet.11. Without changing the two continuous frequencies, change the samplingrate in the sinusoid creation script toFs= 4000. Pass these modifiedsinusoids through the spectrum analyzer.Answer Q3 and Q4 on your worksheet12. You will now implement an echo effect, and analyze how feedback canchange the stability of a system. In order to view this phenomenon, wewill be using the oscilloscope.13. Remove the spectrum analyzer from the current simulink file (or create anew one, keeping the audio input and output (I/O).14. The oscilloscope can be found inDSP System toolbox?Sinks?Time Scope.15. Change the input audio signal toEchoSample.wav. This audio file issampled at the standard CD sampling rate of 44.1 kHz.16. In order to implement an echo sample, we are going to want to implementthe difference equationy[n] +Ay[n??] =x[n]. The difference equationrequires three blocks:•Summing Block:Simulink library?Math Operations?Sum•Gain Block:Simulink library?Math Operations?Gain•Delay Block:DSP System Toolbox?Signal Operations?Delay4

17. To implement the difference equation, the sum block must be placed be-tween the input and output I/O. The wire connecting the sum to theoutput must then be fed into the delay block, followed by the gain block,and back into the sum block. In may be helpful to rotate the blocks, inorder to have them point in the correct direction. This can be done viaRight click + Ctrl + R.18. Double-click on the delay block and set the following parameters. Therest can be left as default.•Delay Length: 4410019. Double click on the Gain block and set the parameters. The rest can beleft as default.•Gain: 0.720. Run simulink, and observe the output. Then modify the following param-eters:•Delay (samples): 10000•Gain: 1.1Answer Q5 and Q6 on your worksheetCall your TA over to verify that this program is working.Your TA willsign your lab worksheet.5

3 Audio Signal ProcessingThis audio signal processing portion will focus more on just using the noramlMATLAB functionality of scripts and functions.1. For this first part of the experiment, you will implement a chirp signalusing MATLAB.A sinusoidal waveform can be described asx(t) =sin(?(t)). The instanta-neous frequency is taken to be the derivative of the phase,f(t) =12?d?(t)dt.A linear chirp is whenf(t) =f0+kt.2. A chirp signal is easily identified using a graph called a spectrogram. Aspectrogram gives a plot of frequency on the y-axis, and time on the x-axis.3. The chirp you implement should be as follows:t = 0 : 1 / 1 e 3 : 2 . 7 ;y = c h i r p ( t , 0 , 1 , 2 5 0 ) ;s p e c t r o g r a m ( y , 2 5 6 , 2 5 0 , 2 5 6 , 1 e3 , ’ y a x i s ’ ) ;Answer Q7 on your worksheet4. In this part of the lab, you will create two sinusoids, and find what happenswhen the two sinusoids are added together. Create two sinusoids, and addthem together in the same script, so they have the exact same phase i.e.y1(t) =sin(?1t)y2(t) =sin(?2t)y(t) =y1(t) +y2(t)5. SetFs= 1080,f1= 510 andf2= 530.6. Listen to the output usingsoundsc(y,Fs)in MATLAB7. Now changeFs= 1040, and listen to the differenceAnswer Q8 and Q9 on your worksheetCall your TA over to verify that this program is working.YourTA will sign your lab worksheet.6

8. The final task for this lab will be analyzing the following wah, phaser, andflanger effects. Based on the following MATLAB code, which implementsthe effects, answer the questions on your worksheet.9. Here is a sample of the wah effect used in musicwahsample.wav. Thefollowing is the matlab code to implement this effect.l f of r e q = 1 ;l f om i n = 2 0 0 ;l f om a x = 2 0 0 0 ;l f o = s a w t o o t h ( 2?p i?l f of r e q?( 1 : l e n g t h ( x ) ) / Fs , 0 . 5 ) ;l f o = 0 . 5?( l f om a x?l f om i n )?l f o +( l f om i n+l f om a x ) / 2 ;de pth = 2 ;y = z e r o s ( 1 , l e n g t h ( x ) ) ;f o r j =3: l e n g t h ( x )[ b , a ] = i i r p e a k ( 2?l f o ( j ) / Fs , 2?l f o ( j ) / Fs / de pt h ) ;y ( j ) = b ( 1 )?x ( j )+b ( 2 )?x ( j?1)+b ( 3 )?x ( j?2) . . .?a ( 2 )?y ( j?1)?a ( 3 )?y ( j?2 ) ;end10. Here is a sample of the phaser effect used in musicphasesample.wav. Thefollowing is the matlab code to implement this effect (2 stage phaser).l f of r e q = 1 ;l f om i n = 2 0 0 ;l f om a x = 2 0 0 0 ;l f o = s a w t o o t h ( 2?p i?l f of r e q?( 1 : l e n g t h ( x ) ) / Fs , 0 . 5 ) ;l f o = 0 . 5?( l f om a x?l f om i n )?l f o +( l f om i n+l f om a x ) / 2 ;y = z e r o s ( 1 , l e n g t h ( x ) ) ;f o r j =3: l e n g t h ( x ) ;[ b , a ] = i i r n o t c h ( 2?l f o ( j ) / Fs , 2?l f o ( j ) / Fs ) ;y ( j ) = b ( 1 )?x ( j )+b ( 2 )?x ( j?1)+b ( 3 )?x ( j?2) . . .?a ( 2 )?y ( j?1)?a ( 3 )?y ( j?2 ) ;endx = y ;y = z e r o s ( 1 , l e n g t h ( x ) ) ;f o r j =3: l e n g t h ( x ) ;[ b , a ] = i i r n o t c h ( 6?l f o ( j ) / Fs , 6?l f o ( j ) / Fs ) ;y ( j ) = b ( 1 )?x ( j )+b ( 2 )?x ( j?1)+b ( 3 )?x ( j?2) . . .?a ( 2 )?y ( j?1)?a ( 3 )?y ( j?2 ) ;end11. Here is a sample of the flanger effect used in musicflangesample.wavl f of r e q = 1 / 3 ;l f oa m p = 0 . 0 0 4 ;7

l f o = 2+s a w t o o t h ( 2?p i?l f of r e q?( 1 : l e n g t h ( x ) ) / Fs , 0 . 5 ) ;i n d e x = round ( ( 1 : l e n g t h

Get 20% Discount on This Paper
Pages (550 words)
Approximate price: -

Try it now!

Get 20% Discount on This Paper

We'll send you the first draft for approval by at
Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

Ace Writing Center has stood as the world’s leading custom essay writing services providers. Once you enter all the details in the order form under the place order button, the rest is up to us.

Essays

Essay Writing Services

At Ace Writing Center, Nowadays, students normally have extremely busy schedules. You will note that some of them have to take on some evening or weekend jobs in order to get some income that can help them to sustain in college or in the university. This can deny them a chance to write all the essays given. Others usually get bombarded with a lot of work by their lecturers. This can still delay such students from working on all their essays. However, some of them usually try to work on all these essays but end up delivering their work late. This can prevent them from graduating since most lecturers are strict on deadlines. If you want to write a business essay, the wise way is to hire an outstanding essay writing service like us, so that you can get the best results. If you are keen, you will note that many companies usually overcharge their customers. Some of them are there only to make money. And in reality, they really don’t care to build a long term commitment with students. You should not choose such companies. You should take your time and choose a reliable company to work with. Ace Writing Center is the ultimate solution for you. We have been offering our writing service for more than 7 years. This is a clear indication that you will get quality essay writing service. We have a wide range of writers who can work on any business essay that you might have. We believe in doing extensive research so that we can provide quality work to all our clients. .

Admissions

Admission and Business Papers

Have you ever had to write an admission essay for college? The majority of students face the same issues when applying to a university or college and many in such situations decide they need professional help to cope with this matter. They get in a situation when the deadline keeps coming closer but lack motivation to start because they are just not sure if their writing skills are strong enough. We have a solution for you! Ace Writing Center is the best admission essay writing service with a large professional team and years of experience in providing high-quality papers to students of all levels and faculties. The mission of our team is to help students make their dreams of entering a good college come true and that’s what we offer!.

Editing

Editing and Proofreading

Sometimes all the words for your paper just flow out of your mind and into your fingers. You type quickly at your keyboard and there they are, your beautiful words right there on the screen. But you have no idea how to polish it up. You may be wishing there was a paper writing service that offered this type of writing service. Look no more! Here at Ace Writing Center, we offer you an editing and proofreading option that you can't find anywhere else..

Coursework

College Essay Writing

In case you are familiar Ace Writing Center, you know the way to distinguish a better company from a cheap one exactly. First of all, poor service website does not have a sufficient support. We think support team is an essential part of success; it has to answer all clients’ questions and be a connecting link between clients and their writers. On our web-service you will get answers about anything you need and your writer will receive all your instructions, assignments and requirements exactly and swiftly. A writing service that we run has got a flexible pricing system that will save you from senseless wastes and many bonus systems that let you sparing money for something important for you.