Audio watermark, an adaptive filter approach
Due to copyright reason, only part of this project is posted here, namely, the adaptive notch filter part.

A watermark system for audio files is developed.

Matlab code:
% Adaptive Notch Filter using Least Mean Square(LMS)
% The idea is to use adaptive notch filter kill certain frequency(w0). The signal we
% killed is y = yk1 + yk2 = w1*temp_x1 + w2*temp_x2

% the key step of the LMS algorithm is the updating w1 and w2 in each step.
% these w1s and w2s' are the coffience creating by the algorithm to track
% the magnitute of the signal we want to kill, they are very important.

function [output] = anf(w0,C,u,d,theta)
% w0: frequency we want to kill, from 0 to Pi
% C: magnitute of the refference signal
% u: forgetting step in the updating w1 and w2, C*u will control the width
% of the notch filter, the smaller it's the less the width of the filter
% d: original input signal
% output1: final signal, time domain changed without change frequency domain
% output2: signal killed one certain frequency w0, without adding the yref
% y: the signal we killed
% yref: the signal we killed and change phase
% e: it's the same as output2

t = 0:1:length(d);
w1 = 0;
w2 = 0; % initialize w1 and w2 to zero
y = zeros(1,length(d)); % initialize y to zero
% Run LMS algorithm loop

for i = 1:length(d) % for each point of the input signal
yk1 = w1.*C*cos(2*pi*w0*(i-1));
yk2 = w2.*C*sin(2*pi*w0*(i-1));

yk3 = w1.*C*cos(2*pi*w0*(i-1)+theta);
yk4 = w2.*C*sin(2*pi*w0*(i-1)+theta);

y(i) = yk1+yk2;
yref(i) = (yk3+yk4);

e = d(i)-y(i); % Output difference ("error") sample

% Now update filter weights
w1=w1+2*u*e*C*cos(2*pi*w0*(i-1)); % the old weight plus 2*u*e*temp_x1(j) becomes new weight

output(i)=d(i)-y(i)+yref(i); % final output
% end loop
% normalize output, prevent overflow
output = nor(output);

More information about audio water mark, can visit Yiwen Liu's research pages at here.
Bernard Widrow's home page


Adaptive Signal Processing EE373A