I am new to matlab and I'm trying to filter the noise out of the audio. I tried some filters but can't event get close to lessening the noise.
이전 댓글 표시
[originalAudio, Fs] = audioread('original.wav');
[noisyAudio, ~] = audioread('noisy.wav');
t = (0:length(originalAudio)-1)/Fs;
figure;
subplot(2,1,1);
plot(t, originalAudio);
xlabel('Time (s)');
ylabel('Amplitude');
title('Original Audio');
subplot(2,1,2);
plot(t, noisyAudio);
xlabel('Time (s)');
ylabel('Amplitude');
title('Noisy Audio');
N = length(originalAudio);
f = Fs*(0:(N/2))/N;
originalSpec = fft(originalAudio);
noisySpec = fft(noisyAudio);
figure;
subplot(2,1,1);
plot(f, abs(originalSpec(1:N/2+1)));
xlabel('Frequency (Hz)');
ylabel('Magnitude');
title('Original Audio Spectrum');
subplot(2,1,2);
plot(f, abs(noisySpec(1:N/2+1)));
xlabel('Frequency (Hz)');
ylabel('Magnitude');
title('Noisy Audio Spectrum');
fc1 = 2000;
fc2 = 500;
[b1, a1] = butter(6, fc1/(Fs/2), 'low');
[b2, a2] = butter(6, fc2/(Fs/2), 'low');
filteredAudio1 = filter(b1, a1, noisyAudio);
filteredAudio2 = filter(b2, a2, filteredAudio1);
figure;
plot(t, filteredAudio2);
xlabel('Time (s)');
ylabel('Amplitude');
title('Filtered Audio');
filteredSpec2 = fft(filteredAudio2);
figure;
plot(f, abs(filteredSpec2(1:N/2+1)));
xlabel('Frequency (Hz)');
ylabel('Magnitude');
title('Filtered Audio Spectrum');
figure;
subplot(2,1,1);
plot(t, originalAudio);
xlabel('Time (s)');
ylabel('Amplitude');
title('Original Audio');
subplot(2,1,2);
plot(t, filteredAudio2);
xlabel('Time (s)');
ylabel('Amplitude');
title('Filtered Audio (Closest to Original)');
sound(filteredAudio2, Fs);
I have the noisy file and the original file that is attached: I need to make the noisy file as close to the original as possible.

댓글 수: 5
Sam Chak
2024년 4월 28일
.bmp, .csv, .fig, .gif, .jpg, .jpeg, .m, .mat, .mdl, .mlapp, .mlx, .sfx, .slx, .sbproj, .pdf, .png, .txt, .xls, .xlsx, .zip
Click the paperclip icon
.
Also click the indentation icon
to copy/paste your MATLAB code that shows your filter design approach.
Godwin Emmanuel
2024년 4월 28일
Star Strider
2024년 4월 28일
Use the ‘paperclip’ (just to the right of the icon) and follow the instructions. If it is a non-standard format or extension, use the zip function to enclose it in a .zip file and then post that.
Godwin Emmanuel
2024년 4월 28일
Star Strider
2024년 4월 28일
My pleasure!
채택된 답변
추가 답변 (2개)
Image Analyst
2024년 4월 28일
0 개 추천
Did you try the Data Cleaner app on the Apps tab of the tool ribbon?
Can you upload a screenshot of your noisy original data, and of the denoised signal that you say is not denoised enough?
If you have any more questions, then attach your screenshots and code with the paperclip icon after you read this:
Ivan
2024년 4월 28일
0 개 추천
are there other methods that can be used?
카테고리
도움말 센터 및 File Exchange에서 Spectral Measurements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

