% This m-file was written by Justin Zito and Steven Wright to extract only % the snare and cymbal sounds from a single channel recording with two instruments. close all clear all clc [aa8,fs,nbits]=wavread('funky2.wav'); taa8=(1:length(aa8))/fs; figure plot(taa8,aa8); xlabel('Time (sec)'); ylabel('Amplitude'); title('Original Recording') % figure % subplot(2,1,1); % plot(abs(fft(aa8,fs))); % title('Magnitude Spectrum of Phoneme /aa8/ by J. Zito'); % xlabel('Frequency (Hz)'); % ylabel('Amplitude'); % % subplot(2,1,2); % plot(20*log(abs(fft(aa8,fs)))); % title('Magnitude Spectrum of Phoneme /aa8/ by J. Zito'); % xlabel('Frequency (Hz)'); % ylabel('Amplitude'); %aa8=aa8'; N=3; scale=44100; Wn1=[140/scale 190/scale]; Wn2=[290/scale 360/scale]; Wn3=[580/scale 710/scale]; Wn4=[14000/scale 22049/scale]; % cymbals and snare only Wn5=[1/scale 11000/scale]; % [B1,A1] = BUTTER(N,Wn1);%,'stop'); [B2,A2] = BUTTER(N,Wn2);%,'stop'); [B3,A3] = BUTTER(N,Wn3);%,'stop'); [B4,A4] = BUTTER(N,Wn4);%,'stop'); [B5,A5] = BUTTER(N,Wn5);%,'stop'); i = [1 zeros(1,102)]; i2 = repmat([i],1,100); i3 = ifft(i2); Y1 = filter(B1,A1,aa8); Y2 = filter(B2,A2,aa8); Y3 = filter(B3,A3,aa8); Y4 = filter(B4,A4,aa8); Y5 = filter(B5,A5,aa8); %Y6 = filter(B6,A6,aa8); %Y7 = filter(B7,A7,aa8); %Y9 = filter(B9,A9,aa8); Y = Y4; t=(1:length(Y))/fs; figure subplot(2,1,1); plot(t,Y); subplot(2,1,2); plot(abs(fft(Y,fs))); Ytweek = 1*Y1+.7*Y2+.3*Y3; %Yn=randn(size(Y,1),size(Y,2))*.0001; %Y=Y+Yn; % t=(1:length(Y1+Y2+Y3))/fs; % figure % subplot(2,1,1); % plot(t,y); % subplot(2,1,2); % plot(abs(fft(y,fs))); %Y=Y*10; soundsc(Y,fs); %wavwrite(Y,fs,nbits,'cymbals.wav'); taa8=(1:length(Y))/fs; figure plot(taa8,Y); xlabel('Time (sec)'); ylabel('Amplitude'); title('Final Drum Track')