Copyright: Dhruv Lamba
clc; close all; clear all; [bear,Fs,bits] = auread('bear_growl.au'); bear = bear(:,1); N = length(bear); time = [1:N].*(1/Fs); han = plot(time,bear); xlab = xlabel('Seconds'); ylab = ylabel('Amplitude'); grid on; set(han,'LineWidth', 2); set([xlab, ylab],'FontSize', 24, 'FontName', 'Times'); set(gca,'FontSize',20,'FontName','Times','Fontweight','Bold') [BEAR,f] = centeredFFT(bear,Fs); figure; han1 = plot(f,abs(BEAR)); axis([-8000,8000,0,max(abs(BEAR))]); grid on; xlab1=xlabel('Frequency(Hz)'); ylab1=ylabel('|X[k]|'); set(han1,'LineWidth', 2); set([xlab1, ylab1],'FontSize', 24, 'FontName', 'Times'); set(gca,'FontSize',20,'FontName','Times','Fontweight','Bold') % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % fc = 2000; fNorm = fc / ( Fs/2); [b,a] = butter(10, fNorm, 'high'); bear_hi = filtfilt(b, a, bear); figure; freqz(b,a,bits,Fs/2); grid on; % sound(x_Low,Fs,bits); % wavwrite(x_Low,Fs,bits,'x_Low_.wav'); [bear_HI,f_low] = centeredFFT(bear_hi,Fs); figure; han2=plot(f_low,abs(bear_HI)); axis([-.8e4,.8e4,0,max(abs(bear_hi))]); grid on; xlab2=xlabel('Frequency(Hz)'); ylab2=ylabel('|X[k]|)'); set(han2,'LineWidth', 2); set([xlab2, ylab2],'FontSize', 24, 'FontName', 'Times'); set(gca,'FontSize',20,'FontName','Times','Fontweight','Bold') figure; han3=plot(time,bear_hi); grid on; xlab3=xlabel('Time(sec)'); ylab3=ylabel('Amplitude'); set(han3,'LineWidth', 2); set([xlab3, ylab3],'FontSize', 24, 'FontName', 'Times'); set(gca,'FontSize',20,'FontName','Times','Fontweight','Bold') sound(bear_hi,Fs,bits); wavwrite(bear_hi,Fs,bits,'bear_filtered.wav'); % [bird,Fs,bits] = auread('bird_chirping2.au'); % % bird = bird(:,1); % bird = bird(1:N); % wavwrite(bear,Fs,bits,'bear.wav'); % sound(bear,Fs,bits); % sound(bird,Fs,bits); % forest = bird + bear; % % sound(forest,Fs,bits);