clear all; close all;
[y,Fs] = audioread('music.mp3');

N = length(y); % total number of samples
k = [1:1:N]';
k1 = [1:floor((N-1)/2)+1]';
k2 = [floor((N-1)/2)+2:N]';

fft_y = fft(y);
fft_y_new = fft_y;

Truncated_freq_high = 3000;
Truncated_freq_low = 300;

filter_win = [(k1<Truncated_freq_high*N/Fs).*(k1>=Truncated_freq_low*N/Fs);...
    ((N-k2-1)<Truncated_freq_high*N/Fs).*((N-k2-1)>=Truncated_freq_low*N/Fs)];

fft_y_new(k,1) = filter_win.*fft_y(k,1);
fft_y_new(k,2) = filter_win.*fft_y(k,2);

y_new = real(ifft(fft_y_new));

audiowrite('music_new.mp4',y_new,Fs);