diff --git a/TP3_8/DiogoEliseu_TP3_8_Relatorio.pdf b/TP3_8/DiogoEliseu_TP3_8_Relatorio.pdf new file mode 100644 index 0000000..e6827be Binary files /dev/null and b/TP3_8/DiogoEliseu_TP3_8_Relatorio.pdf differ diff --git a/TP3_8/canto1_butterworh_2nd_order.flac b/TP3_8/DiogoEliseu_TP3_8_canto1_filtrado/canto1_butterworh_2nd_order.flac similarity index 100% rename from TP3_8/canto1_butterworh_2nd_order.flac rename to TP3_8/DiogoEliseu_TP3_8_canto1_filtrado/canto1_butterworh_2nd_order.flac diff --git a/TP3_8/canto1_butterworth.flac b/TP3_8/DiogoEliseu_TP3_8_canto1_filtrado/canto1_butterworth.flac similarity index 100% rename from TP3_8/canto1_butterworth.flac rename to TP3_8/DiogoEliseu_TP3_8_canto1_filtrado/canto1_butterworth.flac diff --git a/TP3_8/canto1_high_pass.flac b/TP3_8/DiogoEliseu_TP3_8_canto1_filtrado/canto1_high_pass.flac similarity index 100% rename from TP3_8/canto1_high_pass.flac rename to TP3_8/DiogoEliseu_TP3_8_canto1_filtrado/canto1_high_pass.flac diff --git a/TP3_8/Canto1.mp3 b/TP3_8/input/Canto1.mp3 similarity index 100% rename from TP3_8/Canto1.mp3 rename to TP3_8/input/Canto1.mp3 diff --git a/TP3_8/Canto2.mp3 b/TP3_8/input/Canto2.mp3 similarity index 100% rename from TP3_8/Canto2.mp3 rename to TP3_8/input/Canto2.mp3 diff --git a/TP3_8/Canto3.mp3 b/TP3_8/input/Canto3.mp3 similarity index 100% rename from TP3_8/Canto3.mp3 rename to TP3_8/input/Canto3.mp3 diff --git a/TP3_8/trash/DiogoEliseu_TP3_8_butter.m b/TP3_8/trash/DiogoEliseu_TP3_8_butter.m deleted file mode 100644 index 8f50b96..0000000 --- a/TP3_8/trash/DiogoEliseu_TP3_8_butter.m +++ /dev/null @@ -1,50 +0,0 @@ -%% Inicialização do ambiente -clear; close all; clc - -%% Exercício 8 -% Input -[y, Fs] = audioread("Canto1.mp3"); % Signal and Sampling Frequency -signal = y(:,1); -Fn = Fs/2; % Nyquist Frequency (Hz) -%Ts = 1/Fs; -L = length(signal); % Signal Length - -% Find the noise -FTsignal = fft(signal)/L; % Fourier Transform -Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector -Iv = 1:numel(Fv); % Index Vector -figure(1) -% x is Hz, y is amplitude -plot(Fv, abs(FTsignal(Iv))*2) -grid - -% Butterworth Low-Pass Order 7 -%[num, den] = butter(7, fc, 'low'); %order, cutoff frequency, type -%[SOS,G] = tf2sos(num, den); % Convert To Second-Order-Section For Stability -%figure(1) -%freqz(SOS, 4096, Fs) % Check Filter Performance -%s_filtered = filtfilt(SOS, G, signal); - -fcutlow = 3000; -fcuthigh = 3500; -Wp = [fcutlow fcuthigh]/Fn; % Passband Frequency (Normalised) -Ws = [fcutlow*0.95 fcuthigh/0.95]/Fn; % Stopband Frequency (Normalised) -Rp = 30; % Passband Ripple (dB) -Rs = 30; % Stopband Ripple (dB) -%[n,Wn] = buttord(Wp,Ws,Rp,Rs); % Filter Order -n=2; -Wn=3200/Fn; -[z,p,k] = butter(n, Wn, 'low'); % Filter Design -[sosbp,gbp] = zp2sos(z, p, k); % Convert To Second-Order-Section For Stability -%freqz(sosbp, 2^20, Fs) % Filter Bode Plot -signal_filtered = filtfilt(sosbp, gbp, signal); % Filter Signal -figure(2) -subplot(2,1,1) -plot(signal) -subplot(2,1,2) -plot(signal_filtered); - - - -% output -audiowrite('restored.flac', signal_filtered, Fs); \ No newline at end of file diff --git a/TP3_8/trash/DiogoEliseu_TP3_8_cheb.m b/TP3_8/trash/DiogoEliseu_TP3_8_cheb.m deleted file mode 100644 index a6ae5d9..0000000 --- a/TP3_8/trash/DiogoEliseu_TP3_8_cheb.m +++ /dev/null @@ -1,45 +0,0 @@ -%% Inicialização do ambiente -clear; close all; clc - -%% Exercício 8 -[y, Fs] = audioread("Canto1.mp3"); % Signal and Sampling Frequency -s = y(:,1); -L = length(s); - -Fn = Fs/2; % Nyquist Frequency -Wp = [150 5800]/Fn; % Normalised Passband -Ws = [ 50 6100]/Fn; % Normalised Stopband -Rp = 1; % Passband Ripple (dB) -Rs = 30; % Stopband Ripple (dB) -[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs); % Chebyshev Type II Order -[b,a] = cheby2(n,Rs,Ws); % IIR Filter Coefficients -[SOS,G] = tf2sos(b,a); % Convert To Second-Order-Section For Stability -figure(1) -freqz(SOS, 4096, Fs) % Check Filter Performance - -s_filtered = filtfilt(SOS, G, s); - -fcuts = [680 690 710 720 1190 1205 1210 1220 6000 6100]; % Frequency Vector -mags = [1 0 1 0 1 0]; % Magnitude (Defines Passbands & Stopbands) -devs = [0.05 0.01 0.05 0.01 0.05 0.01]; % Allowable Deviations -[n,Wn,beta,ftype] = kaiserord(fcuts,mags,devs,Fs); -n = n + rem(n,2); -hh = fir1(n,Wn,ftype,kaiser(n+1,beta),'scale'); -figure(2) -freqz(hh,1, 4096, Fs) % Filter Bode Plot -filt_sig = filtfilt(hh, 1, s); % Filter Signal -FTS = fft(s)/L; % FFT Of Original Signal -FTFS = fft(filt_sig)/L; % FFT Of Filtered Signal -Fv = linspace(0, 1, fix(L/2)+1)*Fn; % FFT Frequency Vector -Iv = 1:length(Fv); % Index Vector -[pks,Frs] = findpeaks(abs(FTS(Iv))*2, Fv, 'MinPeakHeight',0.1); % Find Pure Tone Frequencies -figure(3) -semilogy(Fv, (abs(FTS(Iv)))*2) -hold on -plot(Fv, (abs(FTFS(Iv)))*2) -hold off -grid -axis([0 2500 ylim]) - -% output -audiowrite('restored.flac', s_filtered, Fs); \ No newline at end of file diff --git a/TP3_8/trash/DiogoEliseu_TP3_8_filterDesigner.m b/TP3_8/trash/DiogoEliseu_TP3_8_filterDesigner.m deleted file mode 100644 index 79b0f4d..0000000 --- a/TP3_8/trash/DiogoEliseu_TP3_8_filterDesigner.m +++ /dev/null @@ -1,30 +0,0 @@ -%% Inicialização do ambiente -clear; close all; clc - -%% Exercício 8 -% Input -[y, Fs] = audioread("Canto1.mp3"); % Signal and Sampling Frequency -signal = y(:,1); -Fn = Fs/2; % Nyquist Frequency (Hz) -%Ts = 1/Fs; -L = length(signal); % Signal Length - -% Find the noise -FTsignal = fft(signal)/L; % Fourier Transform -Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector -Iv = 1:numel(Fv); % Index Vector -figure(1) -% x is Hz, y is amplitude -plot(Fv, abs(FTsignal(Iv))*2) -grid - -% Filter -signal_filtered = filter(nd_designed_sexy,signal); -figure(2) -subplot(2,1,1) -plot(signal) -subplot(2,1,2) -plot(signal_filtered); - -% output -audiowrite('restored.flac', signal_filtered, Fs); \ No newline at end of file diff --git a/TP3_8/trash/butterworth_filter.jpg b/TP3_8/trash/butterworth_filter.jpg deleted file mode 100644 index f5c93c0..0000000 Binary files a/TP3_8/trash/butterworth_filter.jpg and /dev/null differ diff --git a/TP3_8/trash/butterworth_filter_2nd_order.jpg b/TP3_8/trash/butterworth_filter_2nd_order.jpg deleted file mode 100644 index 74875a8..0000000 Binary files a/TP3_8/trash/butterworth_filter_2nd_order.jpg and /dev/null differ diff --git a/TP3_8/trash/db_ft_signal_filtered.jpg b/TP3_8/trash/db_ft_signal_filtered.jpg deleted file mode 100644 index bff36d7..0000000 Binary files a/TP3_8/trash/db_ft_signal_filtered.jpg and /dev/null differ diff --git a/TP3_8/trash/designed_sexy.m b/TP3_8/trash/designed_sexy.m deleted file mode 100644 index 98bd895..0000000 --- a/TP3_8/trash/designed_sexy.m +++ /dev/null @@ -1,23 +0,0 @@ -function Hd = designed_sexy -%DESIGNED_SEXY Returns a discrete-time filter object. - -% MATLAB Code -% Generated by MATLAB(R) 9.8 and Signal Processing Toolbox 8.4. -% Generated on: 28-Dec-2020 08:55:51 - -% Butterworth Lowpass filter designed using FDESIGN.LOWPASS. - -% All frequency values are in Hz. -Fs = 44100; % Sampling Frequency - -Fpass = 3200; % Passband Frequency -Fstop = 6900; % Stopband Frequency -Apass = 1; % Passband Ripple (dB) -Astop = 80; % Stopband Attenuation (dB) -match = 'stopband'; % Band to match exactly - -% Construct an FDESIGN object and call its BUTTER method. -h = fdesign.lowpass(Fpass, Fstop, Apass, Astop, Fs); -Hd = design(h, 'butter', 'MatchExactly', match); - -% [EOF] diff --git a/TP3_8/trash/ft_signal.jpg b/TP3_8/trash/ft_signal.jpg deleted file mode 100644 index 55fc303..0000000 Binary files a/TP3_8/trash/ft_signal.jpg and /dev/null differ diff --git a/TP3_8/trash/high_pass_filter.jpg b/TP3_8/trash/high_pass_filter.jpg deleted file mode 100644 index 7306c9c..0000000 Binary files a/TP3_8/trash/high_pass_filter.jpg and /dev/null differ diff --git a/TP3_8/trash/high_pass_filter2.jpg b/TP3_8/trash/high_pass_filter2.jpg deleted file mode 100644 index 428d464..0000000 Binary files a/TP3_8/trash/high_pass_filter2.jpg and /dev/null differ diff --git a/TP3_8/trash/marked_ft_signal.jpg b/TP3_8/trash/marked_ft_signal.jpg deleted file mode 100644 index 2b8302a..0000000 Binary files a/TP3_8/trash/marked_ft_signal.jpg and /dev/null differ diff --git a/TP3_8/trash/nd_designed_sexy.m b/TP3_8/trash/nd_designed_sexy.m deleted file mode 100644 index 3d40047..0000000 --- a/TP3_8/trash/nd_designed_sexy.m +++ /dev/null @@ -1,27 +0,0 @@ -function Hd = nd_designed_sexy -%ND_DESIGNED_SEXY Returns a discrete-time filter object. - -% MATLAB Code -% Generated by MATLAB(R) 9.8 and DSP System Toolbox 9.10. -% Generated on: 28-Dec-2020 11:09:34 - -% Butterworth Bandpass filter designed using FDESIGN.BANDPASS. - -% All frequency values are in Hz. -Fs = 48000; % Sampling Frequency - -Fstop1 = 730; % First Stopband Frequency -Fpass1 = 3000; % First Passband Frequency -Fpass2 = 5000; % Second Passband Frequency -Fstop2 = 6800; % Second Stopband Frequency -Astop1 = 50; % First Stopband Attenuation (dB) -Apass = 0.0005; % Passband Ripple (dB) -Astop2 = 50; % Second Stopband Attenuation (dB) -match = 'passband'; % Band to match exactly - -% Construct an FDESIGN object and call its BUTTER method. -h = fdesign.bandpass(Fstop1, Fpass1, Fpass2, Fstop2, Astop1, Apass, ... - Astop2, Fs); -Hd = design(h, 'butter', 'MatchExactly', match); - -% [EOF] diff --git a/TP3_8/trash/plot_ft_signal.jpg b/TP3_8/trash/plot_ft_signal.jpg deleted file mode 100644 index d2cd230..0000000 Binary files a/TP3_8/trash/plot_ft_signal.jpg and /dev/null differ diff --git a/TP3_8/trash/plot_ft_signal_filtered.jpg b/TP3_8/trash/plot_ft_signal_filtered.jpg deleted file mode 100644 index b277d37..0000000 Binary files a/TP3_8/trash/plot_ft_signal_filtered.jpg and /dev/null differ diff --git a/TP3_8/trash/plot_ft_signal_filtered_2nd_order.jpg b/TP3_8/trash/plot_ft_signal_filtered_2nd_order.jpg deleted file mode 100644 index ef5c272..0000000 Binary files a/TP3_8/trash/plot_ft_signal_filtered_2nd_order.jpg and /dev/null differ