Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
MATLAB Answers
See Also
MATLAB Answers
Vote 1 Answer
Follow 1 how to filter noise?
Can you help remove the noise from this audio file? 1 Answer
Asked by Christopher Vergara on 17 Sep 2017
Latest activity Commented on by Star Strider on 20 Sep 2017 Filter specific frequencies in an
Accepted Answer by Star Strider audio file
503 views (last 30 days)
1 Answer
I'm having trouble removing the noise heard from this audio file audio_sample.wav.
Entire Website
I've attempted to use the "butter" function to experiment with removing certain frequencies in an effort to
reduce the noise as much as possible.
You will need to have the audio file in the search path your MATLAB is using. Basic Spectral Analysis
The code will play my "current solution".
Thanks for any help. Documentation
Deep
plot(t1,filtered_sound)
title('Time Domain Representation - Filtered Sound')
xlabel('Time (seconds)')
ylabel('Amplitude') Learning for
xlim([0 t1(end)])
m1 = length(sample_data); % Original sample length. Signal
n1 = pow2(nextpow2(m1)); % Transforming the length so that the number of
% samples is a power of 2. This can make the transform computation
https://www.mathworks.com/matlabcentral/answers/357022-can-you-help-remove-the-noise-from-this-audio-file 1/4
6/19/2019 Can you help remove the noise from this audio file? - MATLAB Answers - MATLAB Central
% significantly faster,particularly for sample sizes with large prime
% factors. Processing
y1 = fft(filtered_sound, n1);
f = (0:n1-1)*(sample_rate/n1); with MATLAB
amplitude = abs(y1)/n1;
subplot(2,2,4) Download white
plot(f(1:floor(n1/2)),amplitude(1:floor(n1/2))) paper
title('Frequency Domain Representation - Filtered Sound')
xlabel('Frequency')
ylabel('Amplitude')
0 Comments
Sign in to comment.
1 Answer
Vote
2
Link
Answer by Star Strider on 18 Sep 2017
Accepted Answer
It is not possible to eliminate broadband noise with a frequency-selective filter. You have to use wavelets to
effectively de-noise it.
I got reasonable results with this filter, and using the filtfilt function:
4 Comments
Hide 1 older comment
Christopher Vergara on 18 Sep 2017
https://www.mathworks.com/matlabcentral/answers/357022-can-you-help-remove-the-noise-from-this-audio-file 2/4
6/19/2019 Can you help remove the noise from this audio file? - MATLAB Answers - MATLAB Central
Therefore I analyzed the first 3.44s of audio_sample.wav and displayed its frequency
components using the FFT.
Given that I have the frequency components of the:
• Unfiltered Audio, and
What is the method of subtracting the frequency components of the noise from the entire
frequency spectrum of audio_sample.wav?
If you have the unfiltered noise, just subtract it from the signal+noise in the time domain. That
should produce a clean signal.
https://www.mathworks.com/matlabcentral/answers/357022-can-you-help-remove-the-noise-from-this-audio-file 3/4
6/19/2019 Can you help remove the noise from this audio file? - MATLAB Answers - MATLAB Central
The noise spectrum you plotted seems to be correlated to the frequency content of your
signal. That is going to complicate any frequency-based filtering approach.
You could theoretically design a bandstop filter that simulates the inverse of the noise signal.
The easiest way to do that would be to ‘smooth’ it in the frequency domain with a Savitzsky-
Golay filter (the sgolayfilt function), and the use the inverse of that (subtract it from the
maximum) and the firls function (or related functions) to produce a filter that approximates and
specifically filters that noise. You will have to experiment with that to get the result you want.
The best option to remove broadband noise (that is not frequency-limited) is to use wavelets.
Thanks Star Strider. I ended up taking a low filter to the signal and then using your
recommended method of wavelets to try and reduce as much of the noise as possible whilst
preserving as much of the music.
As always, my pleasure.
Sign in to comment.
mathworks.com
© 1994-2019 The MathWorks, Inc. MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See mathworks.com/trademarks for a list of additional
trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders.
https://www.mathworks.com/matlabcentral/answers/357022-can-you-help-remove-the-noise-from-this-audio-file 4/4