A list,
Principle of wavelet transform
Wavelet transform is a time-scale (time-frequency) signal analysis method, a time-frequency localization analysis method in which the size of the window is fixed and the shape of the window can be changed, and the time window and frequency window can be changed. It is characterized by multi-resolution Analysis and has the ability to characterize local signal characteristics in both time and frequency domains.
Wavelet analysis method has high frequency resolution and low time resolution in the low frequency part, and high time partition rate and low frequency partition rate in the high frequency part, so it is known as “mathematical microscope”. It is this characteristic that makes the wavelet transform adaptive to the signal.
Wavelet analysis is as a harmonic analysis for half a century in the field of the mathematical crystallization, has been widely used in signal processing, image processing, quantum field theory, seismic exploration, speech recognition and synthesis, music, radar, CT imaging, color copies, fluid turbulence, object recognition, machine vision, mechanical fault diagnosis and monitoring, fractal and digital TV and other areas of science and technology.
In principle, wherever Fourier analysis has traditionally been used, wavelet analysis can be replaced. The advantage of wavelet analysis over Fourier transform is that it has good localization properties both in time domain and frequency domain.
In this way, the wavelet transform is regulative to the sampling step size of different frequencies in time domain: at low frequency, the wavelet transform has lower time resolution and higher frequency split rate; At high frequency, the temporal resolution of wavelet transform is high, but the rate-like resolution is low. This is consistent with the low frequency signal changes slowly and high frequency signal changes rapidly.
That’s where it’s superior to the classical Fourier transform and the STFT.
Ii. Source code
function varargout = DSP_mark(varargin)
% DSP_MARK MATLAB code for DSP_mark.fig
% DSP_MARK, by itself, creates a new DSP_MARK or raises the existing
% singleton*.
%
% H = DSP_MARK returns the handle to a new DSP_MARK or the handle to
% the existing singleton*.
%
% DSP_MARK('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in DSP_MARK.M with the given input arguments.
%
% DSP_MARK('Property'.'Value',...). creates anew DSP_MARK or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before DSP_mark_OpeningFcn gets called. An
% unrecognized property name orinvalid value makes property application % stop. All inputs are passed to DSP_mark_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 DSP_mark
% Last Modified by GUIDE v2. 5 09-Jan- 2021. 18:54:43
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @DSP_mark_OpeningFcn, ...
'gui_OutputFcn', @DSP_mark_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 DSP_mark is made visible.
function DSP_mark_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 DSP_mark (see VARARGIN)
% Choose default command line output for DSP_mark
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes DSP_mark wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = DSP_mark_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 GUIDA % -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - read the original audio -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- % cla reset; Fs=44100;
FILE1='Rihanna - Take A Bow.wav'; [y,Fs]=audioread(FILE1); % Audio signal y, sampling rate fs, sampling precision bits y_fft= FFT (y, fs); % y_fft_f=2*sqrt(y_fft.*conj(y_fft)); axes(handles.axes1); plot(y); grid on; axis tight; title('Time domain waveform of the original audio signal');
xlabel('time(s)'); ylabel('幅度');
axes(handles.axes2);
plot(abs(y_fft)); grid on; axis tight; title('Frequency domain waveform of the original audio signal');
xlabel('f(Hz)'); ylabel('幅度'); sound(y,Fs); Pushbutton press in pushbutton2. function pushbutton2_Callback(hObject, eventData, handles) % hObject handle to pushbutton2 (see GCBO) % eventdata reserved - to be defined in afuture version of MATLAB
% handles structure with handles andUser data (see GUIDATA) % -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - read watermark audio -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- % cla reset; Fs=44100;
FILE1='Rihanna - Take A Bow.wav'; [y,Fs]=audioread(FILE1); % Audio signal y, sampling rate fs, sampling accuracy bits % The original audio signal is carried out with db4 wavelet3Order wavelet decomposition [C, L]= Wavedec (y,3.'db4'); %3Level wavelet decomposition, low frequency part is similar, high frequency part is detail % extraction3Ca3 = AppCoef (C, L,'db4'.3); % The lowest frequency fraction cd3= DetCoef (C, L,3); % Sublow frequency fraction cd2= DetCoef (C, L,2);
cd1=detcoef(c,l,1); x=ca3; % Extract the lowest frequency part of tertiary wavelet decomposition % find the insertion position and detect the feature point s= Max (abs(x))*0.2;
i=find(abs(x)>s); lx=length(x(i)); % Read watermark audio FILE2='test_new.wav';
[mark,Fs]=audioread(FILE2);
mark=mark(1:lx);
mark_fft=fft(mark,Fs);
% mark_fft_f=2*sqrt(mark_fft.*conj(mark_fft)); axes(handles.axes1); plot(mark); grid on; axis tight; title('Time-domain waveform of watermark Audio Signal');
xlabel('time(s)'); ylabel('幅度');
axes(handles.axes2)
plot(abs(mark_fft)); grid on; axis tight; title('Frequency domain waveform of watermark Audio Signal');
xlabel('f(Hz)'); ylabel('幅度');
sound(mark,Fs);
% --- 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 andUser data (see GUIDATA) % -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - the watermark embedding -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- % cla reset; Fs=44100;
FILE1='Rihanna - Take A Bow.wav'; [y,Fs]=audioread(FILE1); % Audio signal y, sampling rate fs, sampling accuracy bits % The original audio signal is carried out with db4 wavelet3Order wavelet decomposition [C, L]= Wavedec (y,3.'db4'); %3Level wavelet decomposition, low frequency part is similar, high frequency part is detail % extraction3Ca3 = AppCoef (C, L,'db4'.3); % The lowest frequency fraction cd3= DetCoef (C, L,3); % Sublow frequency fraction cd2= DetCoef (C, L,2);
cd1=detcoef(c,l,1); x=ca3; % Extract the lowest frequency part of tertiary wavelet decomposition % find the insertion position and detect the feature point s= Max (abs(x))*0.2;
i=find(abs(x)>s); lx=length(x(i)); % Read watermark audio FILE2='test_new.wav'; % -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - read the original audio -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- % FILE1 ='Rihanna - Take A Bow.wav'; [y,Fs]=audioread(FILE1); % Audio signal y, sampling rate fs, sampling precision bits y_fft= FFT (y, fs); % y_fft_f=2*sqrt(y_fft.*conj(y_fft));
figure(1% Plot time domain waveform (y); grid on; axis tight; title('Time domain waveform of the original audio signal');
xlabel('time(s)'); ylabel('幅度');
figure(2% Plot frequency domain waveform (abs(y_fft)); grid on; axis tight; title('Frequency domain waveform of the original audio signal');
xlabel('f(Hz)'); ylabel('幅度'); sound(y,Fs); % % play original speech -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - read watermark audio -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- % FILE1 ='Rihanna - Take A Bow.wav'; [y,Fs]=audioread(FILE1); % audio signal y, sampling rate fs % with DB4 wavelet on the original audio signal3Order wavelet decomposition [C, L]= Wavedec (y,3.'db4'); %3Level wavelet decomposition, low frequency part is similar, high frequency part is detail % extraction3Order wavelet decomposition of low frequency coefficient and high frequency coefficient % this will return signal y at level3Ca3 = AppCoef (c, L,'db4'.3); % The lowest frequency fraction cd3= DetCoef (C, L,3); Cd2 = DETCoef (c, L,2);
cd1=detcoef(c,l,1); x=ca3; % Extract the lowest frequency part of tertiary wavelet decomposition % find the insertion position and detect the feature point s= Max (abs(x))*0.2;
i=find(abs(x)>s); lx=length(x(i)); % Read watermark audio FILE2='test_new.wav';
[mark,Fs]=audioread(FILE2);
mark=mark(1:lx);
mark_fft=fft(mark,Fs);
% mark_fft_f=2*sqrt(mark_fft.*conj(mark_fft));
figure(3) plot(mark); grid on; axis tight; title('Time-domain waveform of watermark Audio Signal');
xlabel('time(s)'); ylabel('幅度');
figure(4)
plot(abs(mark_fft)); grid on; axis tight; title('Frequency domain waveform of watermark Audio Signal');
xlabel('f(Hz)'); ylabel('幅度');
sound(mark,Fs);
Copy the code
3. Operation results
Fourth, note
Version: 2014a complete code or write plus 1564658423