SlideShare a Scribd company logo
Results Review of Detecting of Human Errors Algorithm for audio files
Author: Minh Anh Nguyen
Email: minhanhnguyen@q.com
Purpose
The purpose of this analysis is to determine if the method of comparing two audio files can be
used for detecting of human errors for channel-not-loaded-correctly issue. There are many
algorithms which can be used to compare two audio files. These algorithms are: Discrete Fourier
Transform (DFT), Short Time Fourier Transform (STFT), Wavelet, and Fast Fourier Transform
(FFT). In this project, FFT algorithm is used to compare two audio files.
Why use FFT
The fast Fourier transform (FFT) is an algorithm for converting a time-domain signal into a
frequency-domain representation of the relative amplitude of different frequency regions in the
signal. The FFT is an implementation of the Fourier transform. The Fourier transform is one of
the most useful mathematical tools for many fields of science and engineering. The Fourier
transform displays the frequency components within a time series of data. The result of the FFT
contains the frequency data and the complex transformed result. The FFT works perfectly when
analyzing exactly one cycle of a tone.
How FFT works
The FFT takes a chunk of time called a frame (number of samples) and considers that chunk to
be a single period of a repeating waveform. Most sounds are locally stationary, which means that
the sound does look like a regularly repeating function in a short period of time.
The FFT is the one-dimensional Fourier transform. If assuming a signal is saved as an array in
the variable X, then preforming fft(X) will return the Fourier transform of X as a vector of the
same size as X. However, the values returned by fft(X) are frequencies.
Applications of the FFT
There are many applications of FFT. The FFT algorithm tends to be better suited to analyzing
digital audio recordings than for filtering or synthesizing sounds. The FFT is used to determine
the frequency of a signal, to try to recognize different kinds of sound, etc.
Problem with FFT
The FFT function automatically places some restrictions on the time series to generate a
meaningful, accurate frequency response. The FFT function uses (n/2) log2 (n), it requires that
the length of the time series or total number of data points precisely equal to a 2n. Therefore, FFT
can only calculate with a fixed length waveform such as 512 points, or 1024 points, or 2048
points, etc. Another problem with using the FFT for processing sounds is that the digital
recordings must be broken up into chunks of n samples, where n always has to be an integer
power of 2. When the audio is broken up into chunks like this and processed with the FFT, the
filtered result will have discontinuities which cause a clicking sound in the output at each chunk
boundary. For example, if the recording has a sampling rate of 44,100 Hz, and the blocks have a
size n = 1024, then there will be an audible click every 1024 /(44,100 Hz) = 0.0232 seconds,
which is extremely annoying to say the least. The input signal must be repeats periodically and
that the periodic length is equal to the length of the actual input; otherwise leakage will occur
and cause both the amplitude and position of a frequency measurement to be inaccurate.
Techniquesfor comparing two audio files
Step 1: Load audio files
– Read in two audio files into the workspace.
Step2: Truncate both signals so that their durations are equivalent.
Step 3: Perform FFT
– Compute normalized energy spectral density (ESD) from DFT's two signals
Step 4: Compute mean-square-error (MSE)
– Compute mean-square-error (MSE) between normalized ESD's of two signals
– Two perfectly identical signals will obviously have MSE of zero.
Step 5: Display error message on the monitor/computer screen, if MSE value is not zero.
Flow chart for comparing two audiofiles
Figure1. Flow chart for comparing two audio files
Audio test in Simulation mode
The following steps are the procedure to perform audio test in simulation mode
1. Make sure audio files are loaded into the workspace without any issues.
2. Plot and listen to audio files, make sure a correct file is loaded.
3. Verify that the FFT value is correct.
4. Positive test: load two audio files which have 2 different signals and verify that
the test results show the difference.
5. Negative test: load two audio files which have 2 similar signals and verify that the
test result show the same thing or match.
Software
Matlab R2015b
Labview 2014
Summaryof Results
The following figure illustrates the difference between the displays of the FFT of the repeats
periodically input signals and the results of the techniques and flow chart for comparing two
audio files above.
Figure2. Matlab results for comparing two audio files which are identical
Figure3. Matlab results for comparing two audio files which are not identical
Figure4. Matlab results for comparing two audio files which are not identical
Figure5. Labview results for comparing two audio files which are identical
Figure6. Labview results for comparing two audio files which are not identical
These results showed that the method of comparing two audio files can be used for detecting of
human errors for channel-not-loaded-correctly issue. FFT of a time domain signal takes the
samples and calculate a new set of numbers representing the frequencies, amplitudes, and phases
of the sine waves that make up the sound.
Matlab Code for comparing two audio files.
% MatLab Code:
% Author: Minh Anh Nguyen (minhanhnguyen@q.com)
% Expects a .wav soundfile as input.
% usage: Soundfunction('myfile.wav')
% This function will read in two wav files, perform fft, and compare these
files. it
% will display on the screen whether or not the file are identifcal.
% this function is also perfom autocorrelation
% This beginning part just defines the function to be used in MatLab: takes a
% "wav" sound file as an input, and spits out a graph.
function [Soundfunction] = Soundfunction( file1, file2 );
clf % Clears the graphic screen.
close all;% Close all figures (except those of imtool.)
clc;% Clear the command window.
fontSize = 20;
fontSize1 = 14;
% Reads in the sound files, into a big array called y1 and y2.
%y = wavread( file );
[y1, fs1]= audioread( file1 );
[y2, fs2]= audioread( file2 );
% Normalize y1; that is, scale all values to its maximum. Note how simple it
is
% to do this in MatLab.
yn1 = y1/max(abs(y1));
yn2 = y1/max(abs(y1));
sound1 = y1;
sound2 = y2;
%% Do not modify here
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%% time of sound
N = length(sound1); % number of points to analyze
ls = size (sound1); % find the length of the data per second
nbits = 2^(length(sound1));
t1 = (0:1:length(sound1)-1)/fs1; %% time1
fx = fs1*(0:N/2-1)/N; %Prepare freq data for plot
T1 = 1/fs1 % period between each sample
N2 = length(sound2);
ls2 = size (sound2); % find the length of the data per second
t2 = (0:1:length(sound2)-1)/fs2;
fx2 = fs2*(0:N2/2-1)/N2; %Prepare freq data for plot
T2 = 1/fs2 % period between each sample
%%%%% cut signal for comparing
% cut signal to same length
voice1 = y1(fs1*1 : fs1*9);
voice2 = y2(fs2*1 : fs2*9);
%% find new length
N2x = length(voice2);
N1x = length(voice1);
% find new time
t1x = (0:1:length(voice1)-1)/fs1;
t2x = (0:1:length(voice2)-1)/fs2;
%% find new frequency
f2x = fs2*(0:N2x/2-1)/N2x;
f1x = fs1*(0:N1x/2-1)/N1x;
%% fft of cut signal
NFFT1x = 2 ^ nextpow2(N1x);
Y1x = fft(voice1, NFFT1x)/ N1x;
f1xx = (fs1/ 2 * linspace(0, 1, NFFT1x / 2+1))'; % Vector containing
frequencies in Hz
STFFT1x = ( 2 * abs(Y1x(1: NFFT1x / 2+1))); % Vector containing corresponding
amplitudes
NFFT2x = 2 ^ nextpow2(N2x);
Y2x = fft(voice2, NFFT2x) / N2x;
f2xx = (fs2 / 2 * linspace(0, 1, NFFT2x / 2+1))'; % Vector containing
frequencies in Hz
STFFT2x = ( 2 * abs(Y2x(1: NFFT2x / 2+1))); % Vector containing corresponding
amplitudes
%% plot for the cut signal
%% plot for the cut signal
figure; subplot (3,2,1); plot(t1x, voice1);
str1=sprintf('Plot Sound1 with sampling rate = %d Hz and number sample = %d',
fs1, N1x);
title(str1);
xlabel('time (sec)'); ylabel('relative signal strength'); grid on;
subplot (3,2,2); plot(t2x, voice2);
str2=sprintf('Plot Sound2 with sampling rate = %d Hz and number sample = %d',
fs2, N2x);
title(str2); xlabel('time (sec)','Fontsize', fontSize); ylabel('relative
signal strength','Fontsize', fontSize); grid on;
%% fft of cut signal
subplot (3,2,3); plot(f1xx, STFFT1x); title ('Single-sided Power spectrum for
Sound1 with same length','Fontsize', fontSize1);
ylabel ('Magnitude [dB]','Fontsize', fontSize); xlabel ('frequency
[Hz]','Fontsize', fontSize); grid on;
subplot (3,2,4); plot(f2xx, STFFT2x); title ('Single-sided Power spectrum for
Sound2 with same length','Fontsize', fontSize1);
ylabel ('Magnitude [dB]','Fontsize', fontSize); xlabel ('frequency
[Hz]','Fontsize', fontSize); grid on;
%% corlation
[C1, lag1] = xcorr(abs((fft(voice1))),abs((fft(voice2)) ));
figure, plot(lag1/fs1,C1);
ylabel('Amplitude'); grid on
title('Cross-correlation between Sound1 and sound2 files')
%% calculate mean
% Calculate the MSE
D= voice1 - voice2;
MSE=mean(D.^2);
%msgbox(strcat('MSE value is= ',mat2str(),' MSE'));
msgbox(strcat('MSE value is= ',mat2str(MSE)));
if MSE ==0;
msgbox('no error. Signal are the same');
disp('Signal are the same');
else
disp('Signal are not the same');
msgbox('Test error. Please check your set up');
end
Labview Code for comparing two audio files.
The method of comparing two audio files

More Related Content

What's hot

Algorithmique et programmation en Pascal (résumé)
Algorithmique et programmation en Pascal (résumé)Algorithmique et programmation en Pascal (résumé)
Algorithmique et programmation en Pascal (résumé)
salah fenni
 
lecture07.ppt
lecture07.pptlecture07.ppt
lecture07.pptbutest
 
ٍSource Entropy - binary symmetric channe - chapter one - two
ٍSource Entropy - binary symmetric channe - chapter one - twoٍSource Entropy - binary symmetric channe - chapter one - two
ٍSource Entropy - binary symmetric channe - chapter one - two
DrMohammed Qassim
 
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time SignalsDSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
Amr E. Mohamed
 
DSP_FOEHU - MATLAB 02 - The Discrete-time Fourier Analysis
DSP_FOEHU - MATLAB 02 - The Discrete-time Fourier AnalysisDSP_FOEHU - MATLAB 02 - The Discrete-time Fourier Analysis
DSP_FOEHU - MATLAB 02 - The Discrete-time Fourier Analysis
Amr E. Mohamed
 
Gnu build system
Gnu build systemGnu build system
Gnu build system
家榮 吳
 
Network Simulator Tutorial
Network Simulator TutorialNetwork Simulator Tutorial
Network Simulator Tutorial
cscarcas
 
Depthwise separable convolution
Depthwise separable convolutionDepthwise separable convolution
Depthwise separable convolution
Dong-Won Shin
 
Repatino code - hamming code (7,4) - chapter four
Repatino code - hamming code (7,4) - chapter fourRepatino code - hamming code (7,4) - chapter four
Repatino code - hamming code (7,4) - chapter four
DrMohammed Qassim
 
Deep Learning: Recurrent Neural Network (Chapter 10)
Deep Learning: Recurrent Neural Network (Chapter 10) Deep Learning: Recurrent Neural Network (Chapter 10)
Deep Learning: Recurrent Neural Network (Chapter 10)
Larry Guo
 
CEH v9 cheat sheet notes Certified Ethical Hacker
CEH v9 cheat sheet notes  Certified Ethical HackerCEH v9 cheat sheet notes  Certified Ethical Hacker
CEH v9 cheat sheet notes Certified Ethical Hacker
David Sweigert
 
Introduction to CNN
Introduction to CNNIntroduction to CNN
Introduction to CNN
Shuai Zhang
 
Deep Learning - Overview of my work II
Deep Learning - Overview of my work IIDeep Learning - Overview of my work II
Deep Learning - Overview of my work II
Mohamed Loey
 
DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)
DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)
DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)
Ravikiran A
 
Théorie de normalisation-base de données
Théorie de normalisation-base de donnéesThéorie de normalisation-base de données
Théorie de normalisation-base de données
Yassine Badri
 
Variational Autoencoder
Variational AutoencoderVariational Autoencoder
Variational Autoencoder
Mark Chang
 
Filtrage image
Filtrage imageFiltrage image
Filtrage image
mostafadess
 

What's hot (20)

Algorithmique et programmation en Pascal (résumé)
Algorithmique et programmation en Pascal (résumé)Algorithmique et programmation en Pascal (résumé)
Algorithmique et programmation en Pascal (résumé)
 
lecture07.ppt
lecture07.pptlecture07.ppt
lecture07.ppt
 
ٍSource Entropy - binary symmetric channe - chapter one - two
ٍSource Entropy - binary symmetric channe - chapter one - twoٍSource Entropy - binary symmetric channe - chapter one - two
ٍSource Entropy - binary symmetric channe - chapter one - two
 
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time SignalsDSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
 
Lecture 21
Lecture 21Lecture 21
Lecture 21
 
DSP_FOEHU - MATLAB 02 - The Discrete-time Fourier Analysis
DSP_FOEHU - MATLAB 02 - The Discrete-time Fourier AnalysisDSP_FOEHU - MATLAB 02 - The Discrete-time Fourier Analysis
DSP_FOEHU - MATLAB 02 - The Discrete-time Fourier Analysis
 
Gnu build system
Gnu build systemGnu build system
Gnu build system
 
Network Simulator Tutorial
Network Simulator TutorialNetwork Simulator Tutorial
Network Simulator Tutorial
 
Depthwise separable convolution
Depthwise separable convolutionDepthwise separable convolution
Depthwise separable convolution
 
Repatino code - hamming code (7,4) - chapter four
Repatino code - hamming code (7,4) - chapter fourRepatino code - hamming code (7,4) - chapter four
Repatino code - hamming code (7,4) - chapter four
 
Deep Learning: Recurrent Neural Network (Chapter 10)
Deep Learning: Recurrent Neural Network (Chapter 10) Deep Learning: Recurrent Neural Network (Chapter 10)
Deep Learning: Recurrent Neural Network (Chapter 10)
 
CEH v9 cheat sheet notes Certified Ethical Hacker
CEH v9 cheat sheet notes  Certified Ethical HackerCEH v9 cheat sheet notes  Certified Ethical Hacker
CEH v9 cheat sheet notes Certified Ethical Hacker
 
Introduction to CNN
Introduction to CNNIntroduction to CNN
Introduction to CNN
 
Deep Learning - Overview of my work II
Deep Learning - Overview of my work IIDeep Learning - Overview of my work II
Deep Learning - Overview of my work II
 
DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)
DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)
DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)
 
Théorie de normalisation-base de données
Théorie de normalisation-base de donnéesThéorie de normalisation-base de données
Théorie de normalisation-base de données
 
Variational Autoencoder
Variational AutoencoderVariational Autoencoder
Variational Autoencoder
 
Recursiviteeeeeeeeee
RecursiviteeeeeeeeeeRecursiviteeeeeeeeee
Recursiviteeeeeeeeee
 
Filtrage image
Filtrage imageFiltrage image
Filtrage image
 
Lecture 09
Lecture 09Lecture 09
Lecture 09
 

Similar to The method of comparing two audio files

3 f3 3_fast_ fourier_transform
3 f3 3_fast_ fourier_transform3 f3 3_fast_ fourier_transform
3 f3 3_fast_ fourier_transformWiw Miu
 
Sampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptxSampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptx
HamzaJaved306957
 
Vidyalankar final-essentials of communication systems
Vidyalankar final-essentials of communication systemsVidyalankar final-essentials of communication systems
Vidyalankar final-essentials of communication systems
anilkurhekar
 
Res701 research methodology fft1
Res701 research methodology fft1Res701 research methodology fft1
Res701 research methodology fft1
VIT University (Chennai Campus)
 
Fourier Specturm via MATLAB
Fourier Specturm via MATLABFourier Specturm via MATLAB
Fourier Specturm via MATLABZunAib Ali
 
Performance analysis of wavelet based blind detection and hop time estimation...
Performance analysis of wavelet based blind detection and hop time estimation...Performance analysis of wavelet based blind detection and hop time estimation...
Performance analysis of wavelet based blind detection and hop time estimation...
Saira Shahid
 
Question I Part (a) 1.SOURCE CODE LISTING for numb.docx
Question I Part (a) 1.SOURCE CODE LISTING for numb.docxQuestion I Part (a) 1.SOURCE CODE LISTING for numb.docx
Question I Part (a) 1.SOURCE CODE LISTING for numb.docx
catheryncouper
 
Ensemble Empirical Mode Decomposition: An adaptive method for noise reduction
Ensemble Empirical Mode Decomposition: An adaptive method for noise reductionEnsemble Empirical Mode Decomposition: An adaptive method for noise reduction
Ensemble Empirical Mode Decomposition: An adaptive method for noise reduction
IOSR Journals
 
Ensemble Empirical Mode Decomposition: An adaptive method for noise reduction
Ensemble Empirical Mode Decomposition: An adaptive method for noise reduction Ensemble Empirical Mode Decomposition: An adaptive method for noise reduction
Ensemble Empirical Mode Decomposition: An adaptive method for noise reduction
IOSR Journals
 
N017657985
N017657985N017657985
N017657985
IOSR Journals
 
Data Compression using Multiple Transformation Techniques for Audio Applicati...
Data Compression using Multiple Transformation Techniques for Audio Applicati...Data Compression using Multiple Transformation Techniques for Audio Applicati...
Data Compression using Multiple Transformation Techniques for Audio Applicati...
iosrjce
 
igorFreire_UCI_real-time-dsp_reports
igorFreire_UCI_real-time-dsp_reportsigorFreire_UCI_real-time-dsp_reports
igorFreire_UCI_real-time-dsp_reportsIgor Freire
 
Real-time DSP Implementation of Audio Crosstalk Cancellation using Mixed Unif...
Real-time DSP Implementation of Audio Crosstalk Cancellation using Mixed Unif...Real-time DSP Implementation of Audio Crosstalk Cancellation using Mixed Unif...
Real-time DSP Implementation of Audio Crosstalk Cancellation using Mixed Unif...
CSCJournals
 
CHƯƠNG 2 KỸ THUẬT TRUYỀN DẪN SỐ - THONG TIN SỐ
CHƯƠNG 2 KỸ THUẬT TRUYỀN DẪN SỐ - THONG TIN SỐCHƯƠNG 2 KỸ THUẬT TRUYỀN DẪN SỐ - THONG TIN SỐ
CHƯƠNG 2 KỸ THUẬT TRUYỀN DẪN SỐ - THONG TIN SỐ
lykhnh386525
 
Digital Tuner
Digital TunerDigital Tuner
Digital Tunerplun
 
Solvedproblems 120406031331-phpapp01
Solvedproblems 120406031331-phpapp01Solvedproblems 120406031331-phpapp01
Solvedproblems 120406031331-phpapp01
Rimple Mahey
 
dsp.pdf
dsp.pdfdsp.pdf
dsp.pdf
Naol Worku
 
Speech Enhancement Based on Spectral Subtraction Involving Magnitude and Phas...
Speech Enhancement Based on Spectral Subtraction Involving Magnitude and Phas...Speech Enhancement Based on Spectral Subtraction Involving Magnitude and Phas...
Speech Enhancement Based on Spectral Subtraction Involving Magnitude and Phas...
IRJET Journal
 
Fast Fourier Transform Analysis
Fast Fourier Transform AnalysisFast Fourier Transform Analysis
Fast Fourier Transform Analysis
dhikadixiana
 

Similar to The method of comparing two audio files (20)

3 f3 3_fast_ fourier_transform
3 f3 3_fast_ fourier_transform3 f3 3_fast_ fourier_transform
3 f3 3_fast_ fourier_transform
 
Sampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptxSampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptx
 
Vidyalankar final-essentials of communication systems
Vidyalankar final-essentials of communication systemsVidyalankar final-essentials of communication systems
Vidyalankar final-essentials of communication systems
 
Res701 research methodology fft1
Res701 research methodology fft1Res701 research methodology fft1
Res701 research methodology fft1
 
Fourier Specturm via MATLAB
Fourier Specturm via MATLABFourier Specturm via MATLAB
Fourier Specturm via MATLAB
 
Performance analysis of wavelet based blind detection and hop time estimation...
Performance analysis of wavelet based blind detection and hop time estimation...Performance analysis of wavelet based blind detection and hop time estimation...
Performance analysis of wavelet based blind detection and hop time estimation...
 
Question I Part (a) 1.SOURCE CODE LISTING for numb.docx
Question I Part (a) 1.SOURCE CODE LISTING for numb.docxQuestion I Part (a) 1.SOURCE CODE LISTING for numb.docx
Question I Part (a) 1.SOURCE CODE LISTING for numb.docx
 
Ensemble Empirical Mode Decomposition: An adaptive method for noise reduction
Ensemble Empirical Mode Decomposition: An adaptive method for noise reductionEnsemble Empirical Mode Decomposition: An adaptive method for noise reduction
Ensemble Empirical Mode Decomposition: An adaptive method for noise reduction
 
Ensemble Empirical Mode Decomposition: An adaptive method for noise reduction
Ensemble Empirical Mode Decomposition: An adaptive method for noise reduction Ensemble Empirical Mode Decomposition: An adaptive method for noise reduction
Ensemble Empirical Mode Decomposition: An adaptive method for noise reduction
 
N017657985
N017657985N017657985
N017657985
 
Data Compression using Multiple Transformation Techniques for Audio Applicati...
Data Compression using Multiple Transformation Techniques for Audio Applicati...Data Compression using Multiple Transformation Techniques for Audio Applicati...
Data Compression using Multiple Transformation Techniques for Audio Applicati...
 
igorFreire_UCI_real-time-dsp_reports
igorFreire_UCI_real-time-dsp_reportsigorFreire_UCI_real-time-dsp_reports
igorFreire_UCI_real-time-dsp_reports
 
Real-time DSP Implementation of Audio Crosstalk Cancellation using Mixed Unif...
Real-time DSP Implementation of Audio Crosstalk Cancellation using Mixed Unif...Real-time DSP Implementation of Audio Crosstalk Cancellation using Mixed Unif...
Real-time DSP Implementation of Audio Crosstalk Cancellation using Mixed Unif...
 
12
1212
12
 
CHƯƠNG 2 KỸ THUẬT TRUYỀN DẪN SỐ - THONG TIN SỐ
CHƯƠNG 2 KỸ THUẬT TRUYỀN DẪN SỐ - THONG TIN SỐCHƯƠNG 2 KỸ THUẬT TRUYỀN DẪN SỐ - THONG TIN SỐ
CHƯƠNG 2 KỸ THUẬT TRUYỀN DẪN SỐ - THONG TIN SỐ
 
Digital Tuner
Digital TunerDigital Tuner
Digital Tuner
 
Solvedproblems 120406031331-phpapp01
Solvedproblems 120406031331-phpapp01Solvedproblems 120406031331-phpapp01
Solvedproblems 120406031331-phpapp01
 
dsp.pdf
dsp.pdfdsp.pdf
dsp.pdf
 
Speech Enhancement Based on Spectral Subtraction Involving Magnitude and Phas...
Speech Enhancement Based on Spectral Subtraction Involving Magnitude and Phas...Speech Enhancement Based on Spectral Subtraction Involving Magnitude and Phas...
Speech Enhancement Based on Spectral Subtraction Involving Magnitude and Phas...
 
Fast Fourier Transform Analysis
Fast Fourier Transform AnalysisFast Fourier Transform Analysis
Fast Fourier Transform Analysis
 

More from Minh Anh Nguyen

Chúc mừng năm mới 2018
Chúc mừng năm mới 2018Chúc mừng năm mới 2018
Chúc mừng năm mới 2018
Minh Anh Nguyen
 
Chuc Mung Nam Moi 2017- Dinh Dau
Chuc Mung Nam Moi 2017- Dinh DauChuc Mung Nam Moi 2017- Dinh Dau
Chuc Mung Nam Moi 2017- Dinh Dau
Minh Anh Nguyen
 
Happy New Year
Happy New Year Happy New Year
Happy New Year
Minh Anh Nguyen
 
Tutorial for EDA Tools
Tutorial for EDA ToolsTutorial for EDA Tools
Tutorial for EDA Tools
Minh Anh Nguyen
 
Sound and Vibration Toolkit User Manual
Sound and Vibration Toolkit User ManualSound and Vibration Toolkit User Manual
Sound and Vibration Toolkit User Manual
Minh Anh Nguyen
 
Tet trung thu -- Happy mid-autumn moon festival
Tet trung thu -- Happy mid-autumn moon festivalTet trung thu -- Happy mid-autumn moon festival
Tet trung thu -- Happy mid-autumn moon festival
Minh Anh Nguyen
 
An Introduction to HFSS:
An Introduction to HFSS:An Introduction to HFSS:
An Introduction to HFSS:
Minh Anh Nguyen
 
STUCK-OPEN FAULT ANALYSIS IN CMOS TRANSISTOR BASED COMBINATIONAL CIRCUITS
STUCK-OPEN FAULT ANALYSIS IN CMOS TRANSISTOR BASED COMBINATIONAL CIRCUITSSTUCK-OPEN FAULT ANALYSIS IN CMOS TRANSISTOR BASED COMBINATIONAL CIRCUITS
STUCK-OPEN FAULT ANALYSIS IN CMOS TRANSISTOR BASED COMBINATIONAL CIRCUITS
Minh Anh Nguyen
 
Electrocardiogram (ECG or EKG)
Electrocardiogram (ECG or EKG)Electrocardiogram (ECG or EKG)
Electrocardiogram (ECG or EKG)
Minh Anh Nguyen
 
Maxwell3 d
Maxwell3 dMaxwell3 d
Maxwell3 d
Minh Anh Nguyen
 
Simulation results of induction heating coil
Simulation results of induction heating coilSimulation results of induction heating coil
Simulation results of induction heating coil
Minh Anh Nguyen
 
Matlab code for comparing two microphone files
Matlab code for comparing two microphone filesMatlab code for comparing two microphone files
Matlab code for comparing two microphone files
Minh Anh Nguyen
 
Audio detection system
Audio detection systemAudio detection system
Audio detection system
Minh Anh Nguyen
 
Love me tender
Love me tenderLove me tender
Love me tender
Minh Anh Nguyen
 
Ni myRio and Microphone
Ni myRio and MicrophoneNi myRio and Microphone
Ni myRio and Microphone
Minh Anh Nguyen
 
Results Review of iphone and Detecting of Human Errors Algorithm
Results Review of iphone and Detecting of Human Errors AlgorithmResults Review of iphone and Detecting of Human Errors Algorithm
Results Review of iphone and Detecting of Human Errors Algorithm
Minh Anh Nguyen
 
Results Review of Microphone Prototype and LabView Detecting of Human Errors ...
Results Review of Microphone Prototype and LabView Detecting of Human Errors ...Results Review of Microphone Prototype and LabView Detecting of Human Errors ...
Results Review of Microphone Prototype and LabView Detecting of Human Errors ...
Minh Anh Nguyen
 
The method of comparing two image files
 The method of comparing two image files The method of comparing two image files
The method of comparing two image files
Minh Anh Nguyen
 
A message for my uncle on father's day
A message for my uncle on father's dayA message for my uncle on father's day
A message for my uncle on father's day
Minh Anh Nguyen
 
CENTRIFUGE LOADING HUMAN FACTORS
CENTRIFUGE LOADING HUMAN FACTORSCENTRIFUGE LOADING HUMAN FACTORS
CENTRIFUGE LOADING HUMAN FACTORS
Minh Anh Nguyen
 

More from Minh Anh Nguyen (20)

Chúc mừng năm mới 2018
Chúc mừng năm mới 2018Chúc mừng năm mới 2018
Chúc mừng năm mới 2018
 
Chuc Mung Nam Moi 2017- Dinh Dau
Chuc Mung Nam Moi 2017- Dinh DauChuc Mung Nam Moi 2017- Dinh Dau
Chuc Mung Nam Moi 2017- Dinh Dau
 
Happy New Year
Happy New Year Happy New Year
Happy New Year
 
Tutorial for EDA Tools
Tutorial for EDA ToolsTutorial for EDA Tools
Tutorial for EDA Tools
 
Sound and Vibration Toolkit User Manual
Sound and Vibration Toolkit User ManualSound and Vibration Toolkit User Manual
Sound and Vibration Toolkit User Manual
 
Tet trung thu -- Happy mid-autumn moon festival
Tet trung thu -- Happy mid-autumn moon festivalTet trung thu -- Happy mid-autumn moon festival
Tet trung thu -- Happy mid-autumn moon festival
 
An Introduction to HFSS:
An Introduction to HFSS:An Introduction to HFSS:
An Introduction to HFSS:
 
STUCK-OPEN FAULT ANALYSIS IN CMOS TRANSISTOR BASED COMBINATIONAL CIRCUITS
STUCK-OPEN FAULT ANALYSIS IN CMOS TRANSISTOR BASED COMBINATIONAL CIRCUITSSTUCK-OPEN FAULT ANALYSIS IN CMOS TRANSISTOR BASED COMBINATIONAL CIRCUITS
STUCK-OPEN FAULT ANALYSIS IN CMOS TRANSISTOR BASED COMBINATIONAL CIRCUITS
 
Electrocardiogram (ECG or EKG)
Electrocardiogram (ECG or EKG)Electrocardiogram (ECG or EKG)
Electrocardiogram (ECG or EKG)
 
Maxwell3 d
Maxwell3 dMaxwell3 d
Maxwell3 d
 
Simulation results of induction heating coil
Simulation results of induction heating coilSimulation results of induction heating coil
Simulation results of induction heating coil
 
Matlab code for comparing two microphone files
Matlab code for comparing two microphone filesMatlab code for comparing two microphone files
Matlab code for comparing two microphone files
 
Audio detection system
Audio detection systemAudio detection system
Audio detection system
 
Love me tender
Love me tenderLove me tender
Love me tender
 
Ni myRio and Microphone
Ni myRio and MicrophoneNi myRio and Microphone
Ni myRio and Microphone
 
Results Review of iphone and Detecting of Human Errors Algorithm
Results Review of iphone and Detecting of Human Errors AlgorithmResults Review of iphone and Detecting of Human Errors Algorithm
Results Review of iphone and Detecting of Human Errors Algorithm
 
Results Review of Microphone Prototype and LabView Detecting of Human Errors ...
Results Review of Microphone Prototype and LabView Detecting of Human Errors ...Results Review of Microphone Prototype and LabView Detecting of Human Errors ...
Results Review of Microphone Prototype and LabView Detecting of Human Errors ...
 
The method of comparing two image files
 The method of comparing two image files The method of comparing two image files
The method of comparing two image files
 
A message for my uncle on father's day
A message for my uncle on father's dayA message for my uncle on father's day
A message for my uncle on father's day
 
CENTRIFUGE LOADING HUMAN FACTORS
CENTRIFUGE LOADING HUMAN FACTORSCENTRIFUGE LOADING HUMAN FACTORS
CENTRIFUGE LOADING HUMAN FACTORS
 

Recently uploaded

power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
ongomchris
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
SupreethSP4
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 

Recently uploaded (20)

power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 

The method of comparing two audio files

  • 1. Results Review of Detecting of Human Errors Algorithm for audio files Author: Minh Anh Nguyen Email: minhanhnguyen@q.com Purpose The purpose of this analysis is to determine if the method of comparing two audio files can be used for detecting of human errors for channel-not-loaded-correctly issue. There are many algorithms which can be used to compare two audio files. These algorithms are: Discrete Fourier Transform (DFT), Short Time Fourier Transform (STFT), Wavelet, and Fast Fourier Transform (FFT). In this project, FFT algorithm is used to compare two audio files. Why use FFT The fast Fourier transform (FFT) is an algorithm for converting a time-domain signal into a frequency-domain representation of the relative amplitude of different frequency regions in the signal. The FFT is an implementation of the Fourier transform. The Fourier transform is one of the most useful mathematical tools for many fields of science and engineering. The Fourier transform displays the frequency components within a time series of data. The result of the FFT contains the frequency data and the complex transformed result. The FFT works perfectly when analyzing exactly one cycle of a tone. How FFT works The FFT takes a chunk of time called a frame (number of samples) and considers that chunk to be a single period of a repeating waveform. Most sounds are locally stationary, which means that the sound does look like a regularly repeating function in a short period of time. The FFT is the one-dimensional Fourier transform. If assuming a signal is saved as an array in the variable X, then preforming fft(X) will return the Fourier transform of X as a vector of the same size as X. However, the values returned by fft(X) are frequencies. Applications of the FFT There are many applications of FFT. The FFT algorithm tends to be better suited to analyzing digital audio recordings than for filtering or synthesizing sounds. The FFT is used to determine the frequency of a signal, to try to recognize different kinds of sound, etc. Problem with FFT The FFT function automatically places some restrictions on the time series to generate a meaningful, accurate frequency response. The FFT function uses (n/2) log2 (n), it requires that the length of the time series or total number of data points precisely equal to a 2n. Therefore, FFT can only calculate with a fixed length waveform such as 512 points, or 1024 points, or 2048 points, etc. Another problem with using the FFT for processing sounds is that the digital recordings must be broken up into chunks of n samples, where n always has to be an integer
  • 2. power of 2. When the audio is broken up into chunks like this and processed with the FFT, the filtered result will have discontinuities which cause a clicking sound in the output at each chunk boundary. For example, if the recording has a sampling rate of 44,100 Hz, and the blocks have a size n = 1024, then there will be an audible click every 1024 /(44,100 Hz) = 0.0232 seconds, which is extremely annoying to say the least. The input signal must be repeats periodically and that the periodic length is equal to the length of the actual input; otherwise leakage will occur and cause both the amplitude and position of a frequency measurement to be inaccurate. Techniquesfor comparing two audio files Step 1: Load audio files – Read in two audio files into the workspace. Step2: Truncate both signals so that their durations are equivalent. Step 3: Perform FFT – Compute normalized energy spectral density (ESD) from DFT's two signals Step 4: Compute mean-square-error (MSE) – Compute mean-square-error (MSE) between normalized ESD's of two signals – Two perfectly identical signals will obviously have MSE of zero. Step 5: Display error message on the monitor/computer screen, if MSE value is not zero. Flow chart for comparing two audiofiles
  • 3. Figure1. Flow chart for comparing two audio files Audio test in Simulation mode The following steps are the procedure to perform audio test in simulation mode 1. Make sure audio files are loaded into the workspace without any issues. 2. Plot and listen to audio files, make sure a correct file is loaded. 3. Verify that the FFT value is correct. 4. Positive test: load two audio files which have 2 different signals and verify that the test results show the difference. 5. Negative test: load two audio files which have 2 similar signals and verify that the test result show the same thing or match. Software Matlab R2015b Labview 2014
  • 4. Summaryof Results The following figure illustrates the difference between the displays of the FFT of the repeats periodically input signals and the results of the techniques and flow chart for comparing two audio files above. Figure2. Matlab results for comparing two audio files which are identical Figure3. Matlab results for comparing two audio files which are not identical
  • 5. Figure4. Matlab results for comparing two audio files which are not identical Figure5. Labview results for comparing two audio files which are identical
  • 6. Figure6. Labview results for comparing two audio files which are not identical These results showed that the method of comparing two audio files can be used for detecting of human errors for channel-not-loaded-correctly issue. FFT of a time domain signal takes the samples and calculate a new set of numbers representing the frequencies, amplitudes, and phases of the sine waves that make up the sound. Matlab Code for comparing two audio files. % MatLab Code: % Author: Minh Anh Nguyen (minhanhnguyen@q.com) % Expects a .wav soundfile as input. % usage: Soundfunction('myfile.wav') % This function will read in two wav files, perform fft, and compare these files. it % will display on the screen whether or not the file are identifcal. % this function is also perfom autocorrelation % This beginning part just defines the function to be used in MatLab: takes a % "wav" sound file as an input, and spits out a graph. function [Soundfunction] = Soundfunction( file1, file2 ); clf % Clears the graphic screen. close all;% Close all figures (except those of imtool.) clc;% Clear the command window. fontSize = 20;
  • 7. fontSize1 = 14; % Reads in the sound files, into a big array called y1 and y2. %y = wavread( file ); [y1, fs1]= audioread( file1 ); [y2, fs2]= audioread( file2 ); % Normalize y1; that is, scale all values to its maximum. Note how simple it is % to do this in MatLab. yn1 = y1/max(abs(y1)); yn2 = y1/max(abs(y1)); sound1 = y1; sound2 = y2; %% Do not modify here %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%% time of sound N = length(sound1); % number of points to analyze ls = size (sound1); % find the length of the data per second nbits = 2^(length(sound1)); t1 = (0:1:length(sound1)-1)/fs1; %% time1 fx = fs1*(0:N/2-1)/N; %Prepare freq data for plot T1 = 1/fs1 % period between each sample N2 = length(sound2); ls2 = size (sound2); % find the length of the data per second t2 = (0:1:length(sound2)-1)/fs2; fx2 = fs2*(0:N2/2-1)/N2; %Prepare freq data for plot T2 = 1/fs2 % period between each sample %%%%% cut signal for comparing % cut signal to same length voice1 = y1(fs1*1 : fs1*9); voice2 = y2(fs2*1 : fs2*9); %% find new length N2x = length(voice2); N1x = length(voice1); % find new time t1x = (0:1:length(voice1)-1)/fs1; t2x = (0:1:length(voice2)-1)/fs2; %% find new frequency f2x = fs2*(0:N2x/2-1)/N2x; f1x = fs1*(0:N1x/2-1)/N1x; %% fft of cut signal
  • 8. NFFT1x = 2 ^ nextpow2(N1x); Y1x = fft(voice1, NFFT1x)/ N1x; f1xx = (fs1/ 2 * linspace(0, 1, NFFT1x / 2+1))'; % Vector containing frequencies in Hz STFFT1x = ( 2 * abs(Y1x(1: NFFT1x / 2+1))); % Vector containing corresponding amplitudes NFFT2x = 2 ^ nextpow2(N2x); Y2x = fft(voice2, NFFT2x) / N2x; f2xx = (fs2 / 2 * linspace(0, 1, NFFT2x / 2+1))'; % Vector containing frequencies in Hz STFFT2x = ( 2 * abs(Y2x(1: NFFT2x / 2+1))); % Vector containing corresponding amplitudes %% plot for the cut signal %% plot for the cut signal figure; subplot (3,2,1); plot(t1x, voice1); str1=sprintf('Plot Sound1 with sampling rate = %d Hz and number sample = %d', fs1, N1x); title(str1); xlabel('time (sec)'); ylabel('relative signal strength'); grid on; subplot (3,2,2); plot(t2x, voice2); str2=sprintf('Plot Sound2 with sampling rate = %d Hz and number sample = %d', fs2, N2x); title(str2); xlabel('time (sec)','Fontsize', fontSize); ylabel('relative signal strength','Fontsize', fontSize); grid on; %% fft of cut signal subplot (3,2,3); plot(f1xx, STFFT1x); title ('Single-sided Power spectrum for Sound1 with same length','Fontsize', fontSize1); ylabel ('Magnitude [dB]','Fontsize', fontSize); xlabel ('frequency [Hz]','Fontsize', fontSize); grid on; subplot (3,2,4); plot(f2xx, STFFT2x); title ('Single-sided Power spectrum for Sound2 with same length','Fontsize', fontSize1); ylabel ('Magnitude [dB]','Fontsize', fontSize); xlabel ('frequency [Hz]','Fontsize', fontSize); grid on; %% corlation [C1, lag1] = xcorr(abs((fft(voice1))),abs((fft(voice2)) )); figure, plot(lag1/fs1,C1); ylabel('Amplitude'); grid on title('Cross-correlation between Sound1 and sound2 files') %% calculate mean % Calculate the MSE D= voice1 - voice2; MSE=mean(D.^2); %msgbox(strcat('MSE value is= ',mat2str(),' MSE')); msgbox(strcat('MSE value is= ',mat2str(MSE))); if MSE ==0;
  • 9. msgbox('no error. Signal are the same'); disp('Signal are the same'); else disp('Signal are not the same'); msgbox('Test error. Please check your set up'); end Labview Code for comparing two audio files.