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..
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
Step: 1
To modify key2noteenvm to include a second and third harmonic you can simply add two more sinusoidal ...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