SlideShare ist ein Scribd-Unternehmen logo
1 von 10
Results Review of Detecting of Human Errors Algorithm for audio files
Colorado State University
School of Biomedical and Electrical Engineering
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

Weitere ähnliche Inhalte

Was ist angesagt?

Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project PPT
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project PPTImage Segmentation using Otsu's Method - Computer Graphics (UCS505) Project PPT
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project PPTAkshit Arora
 
Lecture 4 Relationship between pixels
Lecture 4 Relationship between pixelsLecture 4 Relationship between pixels
Lecture 4 Relationship between pixelsVARUN KUMAR
 
Artificial Neural Networks Lect3: Neural Network Learning rules
Artificial Neural Networks Lect3: Neural Network Learning rulesArtificial Neural Networks Lect3: Neural Network Learning rules
Artificial Neural Networks Lect3: Neural Network Learning rulesMohammed Bennamoun
 
The world of loss function
The world of loss functionThe world of loss function
The world of loss function홍배 김
 
Convolutional Neural Network (CNN) presentation from theory to code in Theano
Convolutional Neural Network (CNN) presentation from theory to code in TheanoConvolutional Neural Network (CNN) presentation from theory to code in Theano
Convolutional Neural Network (CNN) presentation from theory to code in TheanoSeongwon Hwang
 
Fuzzy Logic in the Real World
Fuzzy Logic in the Real WorldFuzzy Logic in the Real World
Fuzzy Logic in the Real WorldBCSLeicester
 
TensorFlow Tutorial | Deep Learning With TensorFlow | TensorFlow Tutorial For...
TensorFlow Tutorial | Deep Learning With TensorFlow | TensorFlow Tutorial For...TensorFlow Tutorial | Deep Learning With TensorFlow | TensorFlow Tutorial For...
TensorFlow Tutorial | Deep Learning With TensorFlow | TensorFlow Tutorial For...Simplilearn
 
Mc Culloch Pitts Neuron
Mc Culloch Pitts NeuronMc Culloch Pitts Neuron
Mc Culloch Pitts NeuronShajun Nisha
 
Genetic Algorithm for optimization on IRIS Dataset REPORT pdf
Genetic Algorithm for optimization on IRIS Dataset REPORT pdfGenetic Algorithm for optimization on IRIS Dataset REPORT pdf
Genetic Algorithm for optimization on IRIS Dataset REPORT pdfSunil Rajput
 
Digital Image Processing: Image Enhancement in the Spatial Domain
Digital Image Processing: Image Enhancement in the Spatial DomainDigital Image Processing: Image Enhancement in the Spatial Domain
Digital Image Processing: Image Enhancement in the Spatial DomainMostafa G. M. Mostafa
 
Perceptron 2015.ppt
Perceptron 2015.pptPerceptron 2015.ppt
Perceptron 2015.pptSadafAyesha9
 
"Deep Learning for Manufacturing Inspection Applications," a Presentation fro...
"Deep Learning for Manufacturing Inspection Applications," a Presentation fro..."Deep Learning for Manufacturing Inspection Applications," a Presentation fro...
"Deep Learning for Manufacturing Inspection Applications," a Presentation fro...Edge AI and Vision Alliance
 
Activation functions
Activation functionsActivation functions
Activation functionsPRATEEK SAHU
 
[系列活動] 手把手的深度學習實務
[系列活動] 手把手的深度學習實務[系列活動] 手把手的深度學習實務
[系列活動] 手把手的深度學習實務台灣資料科學年會
 
Methods of Optimization in Machine Learning
Methods of Optimization in Machine LearningMethods of Optimization in Machine Learning
Methods of Optimization in Machine LearningKnoldus Inc.
 
discrete wavelet transform
discrete wavelet transformdiscrete wavelet transform
discrete wavelet transformpiyush_11
 
03 digital image fundamentals DIP
03 digital image fundamentals DIP03 digital image fundamentals DIP
03 digital image fundamentals DIPbabak danyal
 

Was ist angesagt? (20)

Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project PPT
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project PPTImage Segmentation using Otsu's Method - Computer Graphics (UCS505) Project PPT
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project PPT
 
Lecture 4 Relationship between pixels
Lecture 4 Relationship between pixelsLecture 4 Relationship between pixels
Lecture 4 Relationship between pixels
 
Artificial Neural Networks Lect3: Neural Network Learning rules
Artificial Neural Networks Lect3: Neural Network Learning rulesArtificial Neural Networks Lect3: Neural Network Learning rules
Artificial Neural Networks Lect3: Neural Network Learning rules
 
The world of loss function
The world of loss functionThe world of loss function
The world of loss function
 
Convolutional Neural Network (CNN) presentation from theory to code in Theano
Convolutional Neural Network (CNN) presentation from theory to code in TheanoConvolutional Neural Network (CNN) presentation from theory to code in Theano
Convolutional Neural Network (CNN) presentation from theory to code in Theano
 
Fuzzy Logic in the Real World
Fuzzy Logic in the Real WorldFuzzy Logic in the Real World
Fuzzy Logic in the Real World
 
TensorFlow Tutorial | Deep Learning With TensorFlow | TensorFlow Tutorial For...
TensorFlow Tutorial | Deep Learning With TensorFlow | TensorFlow Tutorial For...TensorFlow Tutorial | Deep Learning With TensorFlow | TensorFlow Tutorial For...
TensorFlow Tutorial | Deep Learning With TensorFlow | TensorFlow Tutorial For...
 
Mc Culloch Pitts Neuron
Mc Culloch Pitts NeuronMc Culloch Pitts Neuron
Mc Culloch Pitts Neuron
 
Genetic Algorithm for optimization on IRIS Dataset REPORT pdf
Genetic Algorithm for optimization on IRIS Dataset REPORT pdfGenetic Algorithm for optimization on IRIS Dataset REPORT pdf
Genetic Algorithm for optimization on IRIS Dataset REPORT pdf
 
Fuzzy+logic
Fuzzy+logicFuzzy+logic
Fuzzy+logic
 
Hu moments
Hu momentsHu moments
Hu moments
 
Digital Image Processing: Image Enhancement in the Spatial Domain
Digital Image Processing: Image Enhancement in the Spatial DomainDigital Image Processing: Image Enhancement in the Spatial Domain
Digital Image Processing: Image Enhancement in the Spatial Domain
 
Perceptron 2015.ppt
Perceptron 2015.pptPerceptron 2015.ppt
Perceptron 2015.ppt
 
"Deep Learning for Manufacturing Inspection Applications," a Presentation fro...
"Deep Learning for Manufacturing Inspection Applications," a Presentation fro..."Deep Learning for Manufacturing Inspection Applications," a Presentation fro...
"Deep Learning for Manufacturing Inspection Applications," a Presentation fro...
 
Activation functions
Activation functionsActivation functions
Activation functions
 
[系列活動] 手把手的深度學習實務
[系列活動] 手把手的深度學習實務[系列活動] 手把手的深度學習實務
[系列活動] 手把手的深度學習實務
 
Methods of Optimization in Machine Learning
Methods of Optimization in Machine LearningMethods of Optimization in Machine Learning
Methods of Optimization in Machine Learning
 
Histogram processing
Histogram processingHistogram processing
Histogram processing
 
discrete wavelet transform
discrete wavelet transformdiscrete wavelet transform
discrete wavelet transform
 
03 digital image fundamentals DIP
03 digital image fundamentals DIP03 digital image fundamentals DIP
03 digital image fundamentals DIP
 

Andere mochten auch

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 filesMinh Anh Nguyen
 
The method of comparing two image files
The method of comparing two image filesThe method of comparing two image files
The method of comparing two image filesMinh Anh Nguyen
 
Use of spatial frequency domain imaging (sfdi) to quantify drug delivery
Use of spatial frequency domain imaging (sfdi) to quantify drug deliveryUse of spatial frequency domain imaging (sfdi) to quantify drug delivery
Use of spatial frequency domain imaging (sfdi) to quantify drug deliveryMinh Anh Nguyen
 
Comparing two audio files
Comparing two audio filesComparing two audio files
Comparing two audio filesMinh 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 CIRCUITSMinh Anh Nguyen
 
Simulation results of induction heating coil
Simulation results of induction heating coilSimulation results of induction heating coil
Simulation results of induction heating coilMinh 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 CIRCUITSMinh 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 DauMinh Anh Nguyen
 
Cmos Arithmetic Circuits
Cmos Arithmetic CircuitsCmos Arithmetic Circuits
Cmos Arithmetic Circuitsankitgoel
 
faults in digital systems
faults in digital systemsfaults in digital systems
faults in digital systemsdennis gookyi
 
UNIT-III-DIGITAL SYSTEM DESIGN
UNIT-III-DIGITAL SYSTEM DESIGNUNIT-III-DIGITAL SYSTEM DESIGN
UNIT-III-DIGITAL SYSTEM DESIGNDr.YNM
 

Andere mochten auch (13)

A place in_my_heart
A place in_my_heartA place in_my_heart
A place in_my_heart
 
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
 
The method of comparing two image files
The method of comparing two image filesThe method of comparing two image files
The method of comparing two image files
 
Use of spatial frequency domain imaging (sfdi) to quantify drug delivery
Use of spatial frequency domain imaging (sfdi) to quantify drug deliveryUse of spatial frequency domain imaging (sfdi) to quantify drug delivery
Use of spatial frequency domain imaging (sfdi) to quantify drug delivery
 
Comparing two audio files
Comparing two audio filesComparing two audio files
Comparing two audio files
 
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
 
Simulation results of induction heating coil
Simulation results of induction heating coilSimulation results of induction heating coil
Simulation results of induction heating coil
 
Maxwell3 d
Maxwell3 dMaxwell3 d
Maxwell3 d
 
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
 
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
 
Cmos Arithmetic Circuits
Cmos Arithmetic CircuitsCmos Arithmetic Circuits
Cmos Arithmetic Circuits
 
faults in digital systems
faults in digital systemsfaults in digital systems
faults in digital systems
 
UNIT-III-DIGITAL SYSTEM DESIGN
UNIT-III-DIGITAL SYSTEM DESIGNUNIT-III-DIGITAL SYSTEM DESIGN
UNIT-III-DIGITAL SYSTEM DESIGN
 

Ähnlich wie 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).pptxHamzaJaved306957
 
Vidyalankar final-essentials of communication systems
Vidyalankar final-essentials of communication systemsVidyalankar final-essentials of communication systems
Vidyalankar final-essentials of communication systemsanilkurhekar
 
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
 
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
 
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
 
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 reductionIOSR Journals
 
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
 
Fast Fourier Transform Analysis
Fast Fourier Transform AnalysisFast Fourier Transform Analysis
Fast Fourier Transform Analysisdhikadixiana
 
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
 
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.docxcatheryncouper
 
Digital Tuner
Digital TunerDigital Tuner
Digital Tunerplun
 
Solvedproblems 120406031331-phpapp01
Solvedproblems 120406031331-phpapp01Solvedproblems 120406031331-phpapp01
Solvedproblems 120406031331-phpapp01Rimple Mahey
 
Iaetsd computational performances of ofdm using
Iaetsd computational performances of ofdm usingIaetsd computational performances of ofdm using
Iaetsd computational performances of ofdm usingIaetsd Iaetsd
 
igorFreire_UCI_real-time-dsp_reports
igorFreire_UCI_real-time-dsp_reportsigorFreire_UCI_real-time-dsp_reports
igorFreire_UCI_real-time-dsp_reportsIgor Freire
 

Ähnlich wie 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
 
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...
 
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...
 
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
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
 
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...
 
Fast Fourier Transform Analysis
Fast Fourier Transform AnalysisFast Fourier Transform Analysis
Fast Fourier Transform Analysis
 
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Ố
 
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
 
Digital Tuner
Digital TunerDigital Tuner
Digital Tuner
 
Solvedproblems 120406031331-phpapp01
Solvedproblems 120406031331-phpapp01Solvedproblems 120406031331-phpapp01
Solvedproblems 120406031331-phpapp01
 
Iaetsd computational performances of ofdm using
Iaetsd computational performances of ofdm usingIaetsd computational performances of ofdm using
Iaetsd computational performances of ofdm using
 
igorFreire_UCI_real-time-dsp_reports
igorFreire_UCI_real-time-dsp_reportsigorFreire_UCI_real-time-dsp_reports
igorFreire_UCI_real-time-dsp_reports
 
dsp.pdf
dsp.pdfdsp.pdf
dsp.pdf
 

Mehr von 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 2018Minh Anh Nguyen
 
Sound and Vibration Toolkit User Manual
Sound and Vibration Toolkit User ManualSound and Vibration Toolkit User Manual
Sound and Vibration Toolkit User ManualMinh 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 festivalMinh Anh Nguyen
 
Electrocardiogram (ECG or EKG)
Electrocardiogram (ECG or EKG)Electrocardiogram (ECG or EKG)
Electrocardiogram (ECG or EKG)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 AlgorithmMinh 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
 
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 dayMinh Anh Nguyen
 
CENTRIFUGE LOADING HUMAN FACTORS
CENTRIFUGE LOADING HUMAN FACTORSCENTRIFUGE LOADING HUMAN FACTORS
CENTRIFUGE LOADING HUMAN FACTORSMinh Anh Nguyen
 
Green fields - The brother four
Green fields - The brother fourGreen fields - The brother four
Green fields - The brother fourMinh Anh Nguyen
 
How to perform software testing
How to perform software testing How to perform software testing
How to perform software testing Minh Anh Nguyen
 

Mehr von 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
 
Happ New Year
Happ New YearHapp New Year
Happ New Year
 
Tutorial for EDA Tools:
Tutorial for EDA Tools:Tutorial 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 HFSSAn Introduction to HFSS
An Introduction to HFSS
 
Electrocardiogram (ECG or EKG)
Electrocardiogram (ECG or EKG)Electrocardiogram (ECG or EKG)
Electrocardiogram (ECG or EKG)
 
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 ...
 
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
 
Try to remember
Try to rememberTry to remember
Try to remember
 
Paloma
PalomaPaloma
Paloma
 
Green fields - The brother four
Green fields - The brother fourGreen fields - The brother four
Green fields - The brother four
 
Happy New Year
Happy New YearHappy New Year
Happy New Year
 
Chuc Mung Nam Moi 2016
Chuc Mung Nam Moi 2016Chuc Mung Nam Moi 2016
Chuc Mung Nam Moi 2016
 
How to perform software testing
How to perform software testing How to perform software testing
How to perform software testing
 
New Year wishes
New Year wishesNew Year wishes
New Year wishes
 

Kürzlich hochgeladen

Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncssuser2ae721
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substationstephanwindworld
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgsaravananr517913
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the weldingMuhammadUzairLiaqat
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Vishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documentsVishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documentsSachinPawar510423
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm Systemirfanmechengr
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - GuideGOPINATHS437943
 

Kürzlich hochgeladen (20)

POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substation
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the welding
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
Vishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documentsVishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documents
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm System
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - Guide
 

The method of comparing two audio files

  • 1. Results Review of Detecting of Human Errors Algorithm for audio files Colorado State University School of Biomedical and Electrical Engineering 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
  • 2. 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
  • 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.