How to do embedding of watermark using PN sequence in audio signal using frequency hopping technique ?

6 views (last 30 days)
For my project I am refering to the paper in which these lines are mentioned:-
Watermark embedded into the audio signal in frequency domain is the pseudorandom noise sequence. Depending on which bit is to be embedded the process varies :– if bit 1 is to be embedded the value of the coefficient with lower frequency is set to be k dB above the mean value, while the value of the other coefficient is set to be k dB below the mean value. If bit 0 is to be embedded the operation is done vice versa. The fact that mean value of each sub-band remains unchanged is used when removing the watermark.
For this I have written a code but I am not getting the unchanged mean. mean is getting changed. what should be done for getting unchanged mean.
  • [f Fs]=wavread('timbaland.wav');
  • N = length(f);
  • slength = N/Fs;
  • nf=1024; %number of point in DTFT
  • Y = fft(f,nf);
  • x = randn(1, N) + cos(2*pi*100/1024*(0:N-1));
  • x(1024*ceil(end/1024)) = 0;
  • z = reshape(x, 1024, []);
  • y = 20*log10(abs(fft(z)));
  • one_count = 0;
  • zero_count = 0;
  • G=1023; % Code length
  • sd1 =randsrc(1,10,[0 1]); % Initial state of Shift register
  • PN1=[];
  • j=0;
  • sd(1)=0;
  • % First m-sequence
  • for j=1:G
  • PN1=[PN1 sd1(5)];
  • if sd1(1)==sd1(4)
  • temp1=0;
  • zero_count = minus_count + 1;
  • else temp1=1;
  • one_count = one_count + 1;
  • end
  • sd1(1)=sd1(2);
  • sd1(2)=sd1(3);
  • sd1(3)=sd1(4);
  • sd1(4)=sd1(5);
  • sd1(5)=sd1(6);
  • sd1(6)=sd1(7);
  • sd1(7)=sd1(8);
  • sd1(8)=sd1(9);
  • sd1(9)=sd1(10);
  • sd1(10)=temp1;
  • %disp(j);
  • %disp(sd1);
  • end
  • %disp(one_count);
  • %disp(zero_count);
  • g=autocorr(PN1);
  • %key
  • key=PN1;
  • [m,n]=size(y);
  • vks = [];
  • for i=1:1
  • temp= y(:,i);
  • mean1= mean(temp);
  • %disp(mean1);
  • low = 0; high = n;
  • index1 = low + (high-low) * rand;
  • index1 = round(index1);
  • if index1==0
  • index1 = 1;
  • end
  • %fprintf('Index1 = %d',index1);
  • %disp(strcat('Index1 = ', num2str(index1)));
  • fv= temp(index1,1);
  • low = 0; high = n;
  • index2 = low + (high-low) * rand;
  • index2 = round(index2);
  • %fprintf('Index2 = %d',index2);
  • if index2==0
  • index2 = 1;
  • end
  • fsv= temp(index2,1);
  • diff= mean1-20;
  • K= (diff/mean1)*100;
  • lf = 0;
  • hf = 0;
  • if (fv < mean1)
  • lf = fv;
  • hf = fsv;
  • loc1 = index1;
  • loc2 = index2;
  • else
  • lf = fsv;
  • hf = fv;
  • loc1 = index2;
  • loc2 = index1;
  • end
  • addi = 0;
  • subst = 0;
  • for j=1:length(key)
  • if(key(j) == 1)
  • disp('Bit is 1');
  • lf = mean1 + K;
  • hf = mean1 - K;
  • addi = addi + lf;
  • subst = subst + hf;
  • end
  • if(key(j) == 0)
  • disp('Bit is 0');
  • lf = mean1 - K;
  • hf = mean1 + K;
  • addi = addi + hf;
  • subst = subst + lf;
  • end
  • temp(loc1) = lf;
  • temp(loc2) = hf;
  • end
  • mean2= mean(temp);
  • %disp(mean2);
  • vks(:,i) = temp;
  • end
please tell me where i have done the mistake in this code. and also tell me that after doing fft only we get the coefficients ? Please reply as earliest possible. Thanks in advance. Link for whole document from where above lines are taken : Frequency Hopping Method for Audio Watermarking

Answers (1)

korada pavankumar
korada pavankumar on 12 Feb 2019
  • zero_count = minus_count + 1;
In this step , u are using minus count but in ur code u r not assigning any value so instead of minus count use zero count u get output.
  • zero_count = zero_count + 1;

Categories

Find more on Creating and Concatenating Matrices 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!