Eliminating White Noise in Audio using MATLAB
May 17, 2024
Are you struggling with unwanted background noise, also known as white noise, in your audio recordings? This article will walk you through a step-by-step process on how to get rid of white noise in audio This article will walk you through a step-by-step process on how to get rid of white noise in audio This article will walk you through a step-by-step process on how to get rid of white noise in audio This article will walk you through a step-by-step process on how to get rid of white noise in audio using MATLAB – a high-performance programming language ideal for engineers and scientists.
White noise, which is a random signal with an equal intensity at different frequencies, can be quite irritating when present in audio files. To rectify this issue, follow this easy guide.
Step 1: Load the audio file
To begin with, import the audio file into MATLAB using the 'audioread' function. This command will return the audio data and the sample rate.
[audioData, sampleRate] = audioread('your_audio_file.wav');
Step 2: Convert to the frequency domain
Utilizing the Fast Fourier Transform (FFT), convert the time-domain audio signal to the frequency domain.
audioFFT = fft(audioData);
Step 3: Design a noise reduction filter
Create a low-pass or high-pass filter to remove frequencies above or below a threshold, depending on your requirements. Use the 'fir1' function, which would need the desired filter order and the normalized cut-off frequency.
filterOrder = 100;
cutoffFrequency = 0.2;
filterCoefficients = fir1(filterOrder, cutoffFrequency);
Step 4: Apply the filter
Convolve the filter coefficients with the frequency-domain audio signal to reduce the noise.
filteredAudioFFT = conv(audioFFT, filterCoefficients);
Step 5: Convert back to the time domain
Perform the inverse FFT to convert the filtered audio signal back to the time domain.
filteredAudioData = ifft(filteredAudioFFT);
Step 6: Save the filtered audio
Lastly, save the filtered audio to a new file using the 'audiowrite' function.
audiowrite('filtered_audio_file.wav', filteredAudioData, sampleRate);
By following these steps, you should now have a cleaner audio free from unwanted white noise. MATLAB is a powerful tool for engineers and scientists, and it comes in handy when dealing with complex audio signal processing tasks like this.