Question: Modify key2note_env.m to include a second and third harmonic. Be sure to apply the envelope to all three components of the note. Choose the relative

Modify key2note_env.m to include a second and third harmonic. Be sure to apply the envelope to all three components of the note. Choose the relative amplitude of the second and third harmonics so the note sounds good to you, but remember that the relative amplitudes must be less than one. Call your new function key2note_fancy.m. (Using Matlab)

Here is the key2note_env.m:

X represents the amplitude, and getADSR is the function that synthesizes the envelope to the key2note_env..

function [xx, tt] = key2note_env (X, keynum, dur, fs) % KEY2NOTE Produce

You can choose the amplitude of the second and third harmonics less than 1.
 

function [xx, tt] = key2note_env (X, keynum, dur, fs) % KEY2NOTE Produce a sinusoidal waveform corresponding to a % given piano key number % usage: xx = key2note (X, keynum, dur, fs) % XX = the output sinusoidal waveform % X = complex amplitude for the sinusoid, X = A*exp(j*phi). % keynum = the piano keyboard number of the desired note % dur = the duration (in seconds) of the output note % fs = sampling frequency tt = 0: (1/fs): dur; freq = 440*2^((1/12) * (keynum-49)); XX = real (x*exp(1j*2*pi*freq*tt)).* (getADSR (dur*fs+1));

Step by Step Solution

3.36 Rating (168 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To modify key2noteenvm to include a second and third harmonic you can simply add two more sinusoidal ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Business Writing Questions!