Answered step by step
Verified Expert Solution
Question
1 Approved Answer
To demonstrate the effect of the harmonics, let's write a program to generate the fundamental and harmonics for a trumpet and compare it to a
To demonstrate the effect of the harmonics, let's write a program to generate the fundamental and harmonics for a trumpet and compare it to a recording of a real trumpet from the file Trumpet.wav, which should be in your P:MATLAB folder. The amplitudes of the harmonics of the original trumpet recording are given below Harmonic (n Amplitude 0.014447 0.192465 0.690787 .000000 0.603843 0.235496 0.128556 0.067857 0.027369 0.011039 4 10 The fundamental frequency of the original recording is fo 293.4 Hz and the sampling rate is fs 44100 Hz. The fundamental frequency fo corresponds to the first harmonic (n-1) in the table above. You can generate this fundamental term as follows A [0.014447 0.192465 0.690787 1.000000 0.603843 .. . 0.235496 0.128556 0.067857 0.0273690.011039]; fo - 293.4 fs44100 T1/fs fundamental frequency (Hz) sampling rate (Hz) % sampling interval (sec) generate sample times for 2 seconds x1-A(1)*cos (2*p1*1*tott); % fundamental soundsc(x1,fs) % send to speakers term Compare the sound of the fundamental term to the original recording (Trumpet.wav). Do they sound similar? Exercise 4: Write a program that uses a loop to add each of the harmonics with the amplitudes shown above and to send the result to the speaker after each harmonic is added. Put the pause command inside the loop after the soundsc command, so that the program will stop until the user presses a key. Also print the value of the harmonic number to the screen so you can tell how many harmonics have been added. Does the sum of the harmonics sound closer to the original as more harmonics are added
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started