A brief introduction of digital watermarking technology of audio signal based on discrete wavelet transform
In recent years, digital watermarking technology has become more and more important. Digital watermarking technology is to embed some identification information directly into the digital carrier, or indirectly expressed in the signal carrier, and does not affect the use value of the original carrier. Through the information hidden in the carrier, we can judge whether the information is tampered with, which has the functions of anti-counterfeiting traceability, information security protection and copyright protection. As for the broadcast relay station, it is the transfer station of the broadcast audio, and the safety and reliability of the signal must be guaranteed before the broadcast signal is sent to thousands of households. However, most of the stations at present only use the judgment of human ear and the comparison between different information sources, which has great limitations. If using the characteristics of digital watermarking, it can effectively prevent signal interruption, protect signal security and ensure the safety of broadcast.
According to the processing technology of digital watermarking in audio signal, digital watermarking can be divided into time domain, transform domain and compression domain.
1.1 Time-domain Digital Watermarking In time-domain digital watermarking technology, watermark information is directly embedded into the audio signal, usually hidden in the signal is not important, to ensure that the embedded watermark does not affect the monitoring effect of the original audio signal. The realization of time-domain watermarking technology is relatively easy and has a small amount of calculation, simple and direct, but it is not robust, easy to crack, and poor resistance.
In digital watermarking in Transform domain, audio signals need to be transformed from time domain to Transform domain, usually including DCT, DFT, Discrete Fourier Transform (DWT), Discrete Wavelet Transform, etc. Watermark information is embedded in transform domain, and the audio time domain signal embedded with watermark is obtained by inverse transformation. The watermarking technology in transform domain is more complex than that in time domain, but the watermarking information embedded in transform domain has stronger invisibility, better concealment and better robustness than that in time domain. The research of this paper is mainly based on DWT audio signal watermark information embedding and extraction.
1.3 compressed domain digital watermarking in time domain and transform domain watermark techniques, are directly to embed the watermark signal into the uncompressed audio format, but usually in the audio signal transmission or storage needs of audio signal compression coding (such as WMA, MP3, etc.), so the compressed domain digital watermarking is watermark technology also has great practical value. Digital watermarking technology in compression domain can be roughly divided into three categories: (1) embed watermark in non-compression domain, compress audio signal and watermark information together; (2) In the compression domain, the watermark information is directly embedded into the compressed audio signal; (3) Decompress the compressed signal, embed the watermark information, and finally compress the watermark information and the decompressed audio signal together. In general, the encoding and decoding system of the compression domain watermarking technology is too complex, restricted by the compression coding format, and the redundancy of the compressed audio signal has been removed, so it is difficult to add watermarking, and the compression domain watermarking technology needs further research.
Two, some source code
function varargout = main(varargin)
% MAIN MATLAB code for main.fig
% MAIN, by itself, creates a new MAIN or raises the existing
% singleton*.
%
% H = MAIN returns the handle to a new MAIN or the handle to
% the existing singleton*.
%
% MAIN('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in MAIN.M with the given input arguments.
%
% MAIN('Property'.'Value',...). creates anew MAIN or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before main_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to main_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help main
% Last Modified by GUIDE v2. 5 15-Apr- 2021. 12:58:02
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @main_OpeningFcn, ...
'gui_OutputFcn', @main_OutputFcn, ...
'gui_LayoutFcn', [],...'gui_Callback'[]);if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before main is made visible.
function main_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to main (see VARARGIN)
% Choose default command line output for main
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes main wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = main_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
addpath('.\wavelet\')% Add wavelet Transform toolbox %% Select audio [file1, pathName]=uigetfile('*.wav'.'Please select the sample to be identified'); % fname=fullfile(pathname,file1); % audio file name [X,fs]= Audioread (fname); S =get(handles. Popupmenu1,'Value'); Handles. Axes1 % Selects the axes1
subplot(2.2.1); % subwindow plot(X); % Display audio file waveform title('Raw audio signal'); handles.X=X; % save original audio signal handle. fs=fs; % Save original audio signal frequency handles. S =s; guidata(hObject, handles); % --- Executes on button press in pushbutton2.function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)%% Select watermark [file1, pathName]=uigetfile('*.bmp'.'Please select the sample to be identified'); % fname=fullfile(pathname,file1); % select image key=35; % key parameter % number of Arnold replacements, as key Orignalmark=double(imread(fname)); % read64*64[wrow,wcol]=size(Orignalmark); % Image size wROW rows, wCOL columnsif wrow~=wcol
error('wrow~=wcol error'); End %-- Tests whether the key is out of range --------- n=check_arnold(wrow);if (key+1) >n
error('arnold key error');
end
s=get(handles.popupmenu1,'Value');
subplot(2.2.2); hold on
imshow(Orignalmark).title('Original image'); handles.Orignalmark=Orignalmark; % save original image handles. N =n; handles.s=s; guidata(hObject, handles); % --- Executes on button press in pushbutton3.function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)% % % watermark was embedded into watermark embedding -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- X=handles.X; Orignalmark=handles.Orignalmark; Fs =handles. Fs; S = % frequency handles. S; % algorithm type [wrow,wcol]=size(Orignalmark); key=35; % keyif s==2Arnoldw=arnold(Orignalmark,wrow,key); % Arnold conversion of watermark image [C, L]=wavedec(X, wavedec)2.'db4'); %
ca2=appcoef(c,l,'db4'.2); %
cd2=detcoef(c,l,2); %
cd1=detcoef(c,l,1); % lca=length(ca2); % low frequency length blocksize=fix(lca/(wrow*wcol)); 0 0 0 0 0 0 0 0 0 01,wrow*wcol); % Convert the scrambled watermark to a one-dimensional wlength=wrow*wcol; % Watermark length a=0.25; % quantization step j=1;
for i=1:wlength
Block=ca2(j:j+blocksize- 1);
[U,S,V]=svd(double(Block));
cc=floor(S(1.1)/a);
if(Arnoldw(i)==1) % embed an odd multipleif(mod(cc,2) = =0)
cc=cc+1;
end
S(1.1)=a*cc;
end
if(Arnoldw(i)==0)% is embedded in even multiplesif(mod(cc,2) = =1)
cc=cc+1;
end
S(1.1)=a*cc;
end
Blockw=U*S*V'; % reduction ca2 (j, j + blocksize- 1)=Blockw;
j=j+blocksize;
end
c1=[ca2',cd2',cd1']'; MarkedX=waverec(c1,l,'db4'); %b is the audio data after quantization embedding watermarkelseA=X; L = size(A); % Use variable L to store the length of audio A M=Orignalmark; BW = im2bw(M); % Convert image Lena.bmp into binary graph and store variable BW % to calculate watermark matrix size [M1,M2] = size(BW); % M12 is an intermediate variable to avoid calculating M1*M2 every time M12 = M1*M2; 0 0 0 0 0 0 0 0 0 01,M12); n = M12; % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % to spread spectrum watermarking signal processing, the effect is not very good for % spread spectrum coefficient2
n = M12*2;
M = zeros(n,1); % produces the key sequence Mfor k = 1 : n
if mod(k,4) = =0
M(k) = 1;
else
M(k) = 0; End % Watermark signal sequence by bit and key xor L = respectivelyceil(k/2); S(k) = bitxor(C(l),M(k)); End % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % need to embed a watermark information for N N = audio data10;
length1 = n*10; % Decompose the original audio signal into Ae and Ar parts I =1 : length1;
j = [1]; % Take rows from L to length of matrix A to construct matrix Ae Ae = A(I,j); % Ae(i,j) i = length1+1: L; % Take the length of matrix A to the first column of L row to construct matrix Ar Ar = A(I,j); % establishes cell B, where each audio data segment Ae(m) is an element of B k =1; % create cell B = cell(n,1); th = n*N; % When k is less than the length of Ae, the matrix Ae per10The row is stored in cell B as an audio data segmentwhile ( k < th )
i = k : k+9;
m = (k+9) /10;
B{m,1} = Ae(i,j);
k = k+10;
end
Copy the code
3. Operation results
Matlab version and references
1 matlab version 2014A
[1] Han Jiqing, Zhang Lei, Zheng Tieran. Speech Signal Processing (3rd edition) [M]. Tsinghua University Press, 2019. [2] LIU Ruobian. Deep Learning: Practice of Speech Recognition Technology [M]. Tsinghua University Press, 2019.