Question: Write a MATLAB function to implement the ADSR envelope and use the function to refine synthesized music notes. Your deliverables include: 1) MATLAB function for

Write a MATLAB function to implement the ADSR envelope and use the function to refine synthesized music notes. Your deliverables include: 1) MATLAB function for ADSR implementation; 2) A short piece of synthesized music without note refinement; 3) The same music after applying ADSR envelope. Can you please type it out and not write it out by hand

ALSO DO NOT POST THIS

"Function to generate ADSR envelope function[a]=adsr_gen(target,gain,duration) fs=16000; a=zeros(fs,1); duration=round(duration./1000.*fs); start=2; stop=duration(1); %attack phase for n=(start:stop) a(n)=target(1)*gain(1)+(1-gain(1))*a(n-1); end %Sustain phase start=stop+1; stop=start+duration(2); for n=(start:stop) a(n)=target(2)*gain(2)+(1-gain(2))*a(n-1); end %Release phase start=stop + 1; stop=sum(duration); for n=(start:stop) a(n)=target(3)*gain(3)+(1-gain(3))*a(n-1); end B.Function to generate sinusoid function[x]=singen(f,fs,N) n=(0:N-1); x=sin(2*pi*f/fs*n); C. Composer/Player code function [] = sound_play(f) target=[0.99999;0.25;0]; gain=[0.005;0.0004;0.00075]; duration=[250;1250;500]; fs=16000; tot_dur=floor(sum(duration)/fs); [adsr]=adsr_gen(target,gain,duration); figure(1) plot(adsr); x=singen(f,fs,length(adsr)); figure(2) plot(x); b=adsr.';"

THERE ARE ERRORS IN ALL THREE PARTS

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!