next up previous
Next: MATLAB and Fourier Transform Up: notes Previous: Review of Fourier Analysis

Comparing Sounds

When you compared your two graphs using MATLAB you saw obvious differences, mainly in the length and the amplitudes of the signals. The signals you plotted can be interpreted as functions of time $ f_1$ and $ f_2$, to compare them we should look at

$\displaystyle \Vert f_1-f_2\Vert = \max\{f_1(t)-f_2\},
$

an say that the two sounds are similar if this number is small and different if it is large. Use the space below, to outline any difficulties this approach might bring:

One of the problems you should have encountered is that these two functions are not defined on the same interval. To remedy this find the approximate starting point and end point of the word in the two signals y1 and y2. Then identify the length of both words. Let M be the longer one, and let $ n_1$ be the starting point of the word in the first signal. Carry out the following commands:

x1=zeros(M,1); {\it here and in the following M is the number you found above}
for j=1:M
x1(j)=y1(j+n_1-1);
end
or use
x1(1:M)=y1(n_1:n_1+M-1);
Repeat this for the second signal.

Now x1 and x2 are vectors which still contain the same signal as y1 and y2, but they are of the same length. Plot the two new signals and compare them. Next we want to compute the norm of the difference to do this type

norm=max(abs(x1-x2))
Is this number small? Explain your reasoning.

To get a better idea whether this number is small or not compute the norms of x1 and x2

norm1=max(abs(x1))
norm2=max(abs(x2))
and compare them to the norm of the difference.

  1. Is the norm of the difference small, compared with the individual signals?
  2. Discuss the major problems of this approach and offer some remedies.

As next exercise in this section we want to compare the signal x1 to itself. To do this create a vector x3

x3=5*x1;

This is the same signal, only 5 times as loud as the original. Compute the norms of x1, x3 and x1-x3, and answer the following questions:

  1. Is the difference between x1 and x3 small or large?
  2. Since x1 and x3 come from the same recording, the least that we can expect is that the computer and we recognize it as the same word spoken by the same person (if not at the same time). Discuss a possible remedy for this. As a hint you may think of the sounds as vectors, the actual mix of sounds in the word is the direction of the vector, and the volume is its length.

In order to solve this problem you should have thought about unit vectors. So in the last computer exercise of this section we will normalize x1 and x2 and compare them. To do this we use two methods, in the first we normalize by the maximal entry in the vector. To do this

z1=x1/max(x1);
and repeat this for x2. Then compute the norms of x1, x2 and x1-x2 and compare them. Is the result for x1-x2 small compared to the norms of x1 and x2? And is the result better or worse than the result for the un-normed sounds?

In linear algebra we learned a different method to compute norms or length' of vectors. To compute the traditional length do

leng1=0;
for j=1:M
leng1=leng1+x1(j)^2;
end
leng1=sqrt(leng1);
q1=x1/leng1;
or use the vectorized command
leeng1=sqrt(sum(abs(x1).^2));
This gives you a unit vector in the traditional sense. Compute this also for x2 and repeat the comparisons from above.


next up previous
Next: MATLAB and Fourier Transform Up: notes Previous: Review of Fourier Analysis
Werner Horn 2006-06-06