Eliminating Noise from Signal using LMS Adaptive Filter Functionality
10 views (last 30 days)
Show older comments
Okay so I've been doing a bit of research on noise cancelation and I believe the Widrow's and Hoff's Least Mean Square (LMS) adaptive filter is the most efficient algorithm for me to implement, and is by far the easiest for me to understand. The problem is I'm having some serious trouble getting my code to perform any noise cancelation. I have tried two different approaches implementing the algorithm myself, however that ended in total disaster. And I have also tried using the built in LMS adaptive filter functionality MATLAB has to offer, but have had no success. Any help would truly be appreciated :)
Audio files:
Sources I've looked at: https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.369.7245&rep=rep1&type=pdf
Code:
%clear command window, and delete all figures and variables
clc; close all; clear;
%import voice and noise audiofiles
fileName = 'theVoice.wav';
[original, FS] = audioread(fileName);
fileName = 'theNoise.wav';
[noise, ~] = audioread(fileName);
soundFileLength = length(original);
%set LMS filter parameters and apply the filter to input signal
order = 10;
learningRate = 0.01;
lmsFilter = dsp.LMSFilter('Length', order, 'Method', 'LMS', 'StepSize', learningRate);
[~, error] = lmsFilter(noise, original);
%play filtered signal and provide plots
x = linspace(0, 6, soundFileLength);
subplot(3, 1, 1);
plot(x, original)
title('Original Audio')
subplot(3, 1, 2);
plot(x, noise)
title('Noise')
subplot(3, 1, 3);
plot(x, error)
title('Filtered Audio')
0 Comments
Answers (0)
See Also
Categories
Find more on Adaptive Filters in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!