in = [ 1; 0 ]; % Dirac Impulse Fs = 44100; in = [in; zeros(3*Fs,1)]; % Space for reverb % Define delay parameters %Hadamard Matrix as feedback matrix H = 0.75*hadamard(16); feedbackGain =[0.1,-0.15,-0.2,0.25,-0.3,0.35,0.4,-0.45,-0.5,0.55,0.6,-0.65,-0.7,-0.75,-0.8,0.85]; %0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85 wetGain = [0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7]; % adjust to control wet signal level % Convert delay time to samples delaySamples = [101,233, 439,613, 853,1163, 1453,1667 , 1801,2053, 2269,2647, 3001,3607, 4153,4591]; %0.02s, 0.03, 0.04, 0.05 881, 1009, 1321,1511, 1777, 1999, 2203, 2351 %101, 439, 853, 1453 , 1801, 2269, 3001, 4153 %Summe delays = 30644 % delaySamples = [1200, 1800, 2200,2500]; % Create an empty array to store delayed audio delayedAudio = zeros(size(in)); delayedAudio2 = zeros(size(in)); delayedAudio3 = zeros(size(in)); delayedAudio4 = zeros(size(in)); delayedAudio5 = zeros(size(in)); delayedAudio6 = zeros(size(in)); delayedAudio7 = zeros(size(in)); delayedAudio8 = zeros(size(in)); delayedAudio9 = zeros(size(in)); delayedAudio10 = zeros(size(in)); delayedAudio11 = zeros(size(in)); delayedAudio12 = zeros(size(in)); delayedAudio13 = zeros(size(in)); delayedAudio14 = zeros(size(in)); delayedAudio15 = zeros(size(in)); delayedAudio16 = zeros(size(in)); delayedAudios =[delayedAudio,delayedAudio2,delayedAudio3,delayedAudio4,delayedAudio5,delayedAudio6,delayedAudio7,delayedAudio8,delayedAudio9,delayedAudio10,delayedAudio11,delayedAudio12,delayedAudio13,delayedAudio14,delayedAudio15,delayedAudio16]; delayedAudios(1,:) = 1; % Apply delay effect for i = 1:length(in)-2*max(delaySamples) for k = 1:16 if delayedAudios(i+delaySamples(k),k) == 0 delayedAudios(i+delaySamples(k),k) = feedbackGain(k)*delayedAudios(i,k); end end for k = 1:16 for j = 1:16 if delayedAudios(i+delaySamples(j)+delaySamples(k),k) == 0 && k~= j delayedAudios(i+delaySamples(j)+delaySamples(k),k) = H(j,k)*delayedAudios(i+delaySamples(j),j); end end end end %Original and Mix together for k = 1:16 delayedAudios(:,k) = wetGain(k)*delayedAudios(:,k); end %outputAudioM = delayedAudios(:,16) + delayedAudios(:,15) + delayedAudios(:,14) + delayedAudios(:,13) + delayedAudios(:,12) +delayedAudios(:,11) +delayedAudios(:,10) +delayedAudios(:,9)+delayedAudios(:,8) +delayedAudios(:,7) +delayedAudios(:,6) +delayedAudios(:,5) +delayedAudios(:,4) +delayedAudios(:,3) +delayedAudios(:,2 )+delayedAudios(:,1); outputAudioM = sum(delayedAudios,2); outputAudioM(1) = outputAudioM(1)*0.02; %Low pass filtering + phase adjusting d = designfilt('lowpassfir','FilterOrder',4 ,'CutoffFrequency',2000,'SampleRate', Fs); y = filtfilt(d,outputAudioM); % %Write the output audio to a new file and plot audiowrite('output_audio_with_delay.wav', y, Fs); plot(y); % Play the output audio sound(y,Fs);
% Process samples from an audio file afr = dsp.AudioFileReader("FunkyDrums-44p1-stereo-25secs.mp3",PlayCount=Inf); % The filter r = audioexample.FreeverbReverberator; % Play the result adw = audioDeviceWriter(SampleRate=afr.SampleRate); while ~isDone(afr) x = afr(); % read an input frame y = r(x); % filter the frame. the filter retains states between consecutive calls adw(y); % listen ot the output frame end
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.