You are on page 1of 1

2017. 5. 18.

10)57

%read in the entire file


[A,count] = fread(fid,inf,'int16');
%normalize it to *just* below [-1,+1]
A = 0.99*A/max(abs(A));
%find a "power of 2" length for a fast Fourier transform
fft_length=2^(nextpow2(count));
F = fft(A,fft_length);
clear A;
%zero out everything below 50 Hz
for i = 1:round(50*fft_length/48000)
F(i) = 0;
end;
for i = round(fft_length-50*fft_length/48000):fft_length
F(i) = 0;
end;
%inverse FFT of the "corrected" FFT
A = ifft(F);
clear F;
%write the .wav file
wavwrite(A,48000,'wavefile');
fid = fclose('all')

https://courses.physics.illinois.edu/phys406/Student_Projects/Fall02/RLee/rock.txt 1/1

You might also like