Vous êtes sur la page 1sur 63

Wavelets for Sound Analysis

and Re-Synthesis
Graham Self
2
nd
May 2001
Project Supervisor: Dr. Guy Brown
Second Marker: Dr. Joab Winkler
This report is submitted in partial fulfilment of the requirement for the Bachelor of
Science Dual Honours in Computer Science and Mathematics by
Graham Self
Page I
Declaration
All sentences or passages quoted in this dissertation from other peoples work have
been specifically acknowledged by clear cross-referencing to author, work and page(s).
Any illustrations which are not the work of the author of this dissertation have been
used with the explicit permission of the originator and are specifically acknowledged. I
understand that failure to do this amounts to plagiarism and will be considered grounds
for failure in this dissertation and the degree examination as a whole.
Name:
Signature:
Date:
Page II
Abstract
This paper firstly introduces the main branch of mathematics that lead to the discovery of
Wavelets and their transforms, Fourier Analysis. The paper gives a detailed account of the
development of different Fourier transforms and describes the motivation for a need for a
different transform due to the multiresolution problem. The theory of Wavelets is then
introduced as a solution to this problem together with a detailed account of the Continuous and
Discrete Wavelet Transforms.
The paper also documents the development, testing and evaluation of two Computer Assisted
Learning Tools that students could use to learn about wavelet theory.
Page III
Acknowledgments
Thanks go to
My Parents, for being supportive
Alice for being there every step of the way
Guy for endless proof reading
And to all those involved in the testing and evaluation
Page IV
Contents
Introduction 1
1: Fourier Analysis 2
1.1 The Statement that changed mathematics 2
1.2 Applications of Fourier Analysis 3
1.3 The Fourier Transform Finding the frequency content of a signal 3
1.4 The Discrete Fourier Transform 4
1.5 The Fast Fourier Transform 5
1.6 The Time/Frequency problem 5
1.7 The Short Term Fourier Transform 6
1.8 Technical definitions for Chapter 1 8
2 : Introduction to Wavelets 11
2.1 Where did they come from? 11
2.2 The Mother Wavelet 12
2.3 Wavelets achieve Multiresolution 12
2.4 How do you create a Wavelet? 13
3 : The Continuous Wavelet Transform 14
3.1 Theory 14
3.2 Computation of the CWT 15
3.3 Visualising the CWT 3D Plot 16
3.4 Visualising the CWT Scalograms 16
4 : The Discrete Wavelet Transform 17
4.1 Why not use the CWT? 17
4.2 Discretizing the Continuous Wavelet Transform 17
4.3 Subband Coding 18
4.4 Example of Subband Coding 20
5 : Computer Assisted Learning Tools 22
5.1 Computer Assisted Learning (CAL) 22
5.2 Which programming language? 23
6 : Requirements Analysis 24
6.1 The initial requirement 24
6.2 The Client and Developer scenario 24
6.3 The Matlab Auditory Demos 26
7 : Software Development 27
7.1 Getting familiar with MATLAB 27
7.1.1 MATLABs GUI 27
7.1.2 Coding in MATLAB 28
7.2 Wavelet Learning Tool - Interface Design 29
7.3 The coding of The Wavelet Learning Tool 30
7.3.1 Coding the CWT 30
7.3.2 Coding the Inverse CWT 32
7.3.3 Input error recovery 32
7.4 Development problems 33
7.4.1 Surf vs Imagesc 33
7.4.2 The disappearing cursor 34
Page V
7.5 Development of the Subband Learning Tool 35
7.6 Screen Shots 35
7.7 Functionality of the Wavelet Learning Tool 36
8 : Software Testing 38
8.1 Motivation 38
8.2 Functional Testing 39
8.3 Testing the Wavelet Learning Tool 39
8.3.1 Random Testing 40
8.3.2 Testing Structural Synthesis 41
8.3.3 The Category-Partition method 44
8.4 Testing Summary 45
9: Evaluation 46
9.1 Questionnaire Construction 46
9.2 User Guide 47
9.3 Questionnaire Results 47
9.4 Evaluation Summary 49
9.5 Evaluation of the Subband Learning Tool 49
9.6 Future Work 49
10: Conclusions 51
References 52
Appendix A Questionnaire 53
Appendix B Wavelet Learning Tool User Guide 55
Appendix C Software Development Log 57
Introduction
Page 1
Introduction
Wavelets have many historical routes leading up to their discovery as they can be used in
many different scientific areas. This dissertation documents the usefulness and importance
wavelets have when calculating a frequency analysis on a signal. The main route of the
discovery of wavelets came as a natural progression from the Short Term Fourier Transform,
as there was a need for a better analysis technique. The problem with using Fourier Transforms
is that a frequency analysis cant give both good frequency and good time resolution at the
same time. This is known as the multiresolution problem and was solved by using Wavelets
instead of a fixed analysis window. The wavelets have the important property that they dont
have to be fixed in size. They can be easily controlled by parameters, which compress and
dilate the wavelet depending on which frequency is being analysed in the signal. An account of
how to create wavelets using the mother wavelet formula and how they can be applied to
signal analysis is also given in this paper.
The free movement of the wavelets was exploited in the Continuous Wavelet Transform to
give a detailed representation of the frequencies in a signal. The signal could now be
represented with both good time and good frequency resolution, so unlike before, the user
could tell not only what frequencies occurred in the signal, but also when they occurred. The
transform introduces the notion of a scale, which is equivalent to the inverse of the frequencies
being analysed. The continuous wavelet transform produces a coefficient matrix, which can be
visualised by the use of a scalogram, which is also investigated. The problem that the
continuous wavelet transform has is that it calculates a coefficient for each sample in the signal
for every scale that is to be calculated. For long signals, this can be time consuming and
uneconomical when applying the transform computationally.
The solution to this problem was solved by the development of a discrete version of the
wavelet transform. The dissertation details the reasons for wanting to use a discrete version
along with the arguments for showing how this can be done without loss of data. The Discrete
Wavelet Transform is based on the ideas behind Nyquists Sampling Theorem and a method
for calculating the transform is given called Subband Coding.
A large part of this dissertation gives a detailed account of the development, testing and
evaluation of two Computer Assisted Learning (CAL) Tools. Because wavelet theory is a
fairly new topic, lecturers are limited with the way they can teach the topic to new students
who are unfamiliar to the concepts that are involved. Therefore, CAL tools were developed to
aid in the teaching of wavelets and to provide an interactive demonstration of what the
transforms can do and how they provide benefits to signal analysis. The dissertation provides
evidence for the benefits for using CAL tools with a series of lectures and also what
requirements were needed for them to be successful.
The main tool developed alongside this dissertation is called the Wavelet Learning Tool. This
was developed to demonstrate visually how wavelets are used in the continuous version of the
wavelet transform. The user is able to compare the effects of using different wavelets and to
see a visual representation of the coefficient matrix produced, called a scalogram. The
scalogram effectively shows the signal in the frequency domain. As the title of the dissertation
suggests, the user can also re-synthesise a signal from a scalogram that has been altered. The
tool allows the user to remove scales from the scalogram and then listen to the effects this has
on the overall signal. This is effectively a frequency filtering technique.
The second tool called the Subband learning Tool was developed to show visually the process
undergone during Subband coding, which is the discrete version of the wavelet transform.
Subband coding is, in its simplest terms, a series of filtering and sub-sampling operations and
the user can see what effects on a speech signal each stage of the process has.
Fourier Analysis
Page 2
1 : Fourier Analysis
1.1 The Statement that Changed Mathematics
Before 1930, the main branch of mathematics leading to Wavelet Theory formed as a result of
a natural progression from the world of the Fourier analysis. Fourier analysis is a significant
discovery and has influenced many different areas of applications including science, maths,
engineering and most important of all, signal processing. Joseph Fourier started off the
Fourier revolution by introducing a simple mathematical statement:
Any periodic function can be represented as a sum of sines and cosines
This discovery had fundamental importance to the signal processing world, as a complex
signal could be visualised as a combination of smaller signals of which we know a lot about.
Studying these smaller signals i.e. sine waves and cosine waves, will directly allow you to
infer properties about the more complex signal. We will see later how the amplitudes of the
sine and cosine waves in a complex signal enable you to calculate the frequencies in the signal.
Fouriers statement can be expressed mathematically as follows.
f(x) = ) sin cos (
2
1
1
0

+ + kx b kx a a
k k
[EQ 1]
Where the Fourier Coefficients
k k
b a a , ,
0
are defined as

2
0
0
) (
2
1
dx x f a

2
0
) cos( ) (
1
dx kx x f a
k

2
0
) sin( ) (
1
dx kx x f b
k
[M 1993]
This is known as the Fourier Series and says that any curve that periodically repeats itself can
be expressed as the sum of perfectly smooth oscillations i.e. the sines and cosines.
Barbara Burke Hubbard described how the Fourier Series can be represented by a process of
multiplying various sinusoidal waves (sines and cosines) with certain amplitude coefficients
and then shifting them so they either add or cancel [H 1995]. An example of this procedure is
shown in figure 1.1.1
Figure 1.1.1
a) sin(x), b) sin(x) + sin(2x), c) sin(x) + sin(2x) + (4+ sin(3x))
The sinusoidal waves are called basis signals as they form a basis of any function. These are
also the basis for the Fourier Transform (see Section 1.3), which is derived from the property
described above. The sines and cosines form a basis of any signal. See page 8 for an
explanation of a basis
a)
b)
c)
Fourier Analysis
Page 3
1.2 Applications of Fourier Analysis
Not only did the Fourier Series aid mathematicians to differentiate difficult functions; the
Fourier Series opened a new door to frequency analysis. Before Fourier, raw signals were
always represented in the time domain. The problem with a signal being represented in the
time domain is that no information, except amplitude, can be given at a specific time. It is
often more convenient to be able to see what frequencies occur at different time intervals.
As described before, the Fourier Series consist of a combination of sinusoids. If you extract the
amplitudes of each sinusoidal component you obtain the Fourier Coefficients. As the sinusoids
are equally spaced in frequency i.e. sin x, cos x, sin 2x, cos 2x knowing these coefficients
gives us information on which frequencies are present in the function.
As sound signals are effectively represented as a function, the Fourier Series enables us to
extract the frequencies present in the signal.
This leads us to the Fourier Transform, which converts a signal from the time-domain into the
frequency-domain.
1.3 The Fourier Transform Finding the frequency content of a signal
The Fourier Transform, as introduced above, converts information about a signal in the time-
domain into a signal in the frequency-domain. It also allows you to go back without loss of
information.
Figure 1.3.1
The only frequencies that contribute to the Fourier Series of a periodic function (see 1.1) are
the integer multiples of the functions fundamental frequency. This fundamental frequency,
also known as the base frequency is the inverse of the period of the signal. For example, if the
signal has a period of 2 ms ( = 0.002 s), the fundamental frequency will be 1/0.002 = 500Hz.
The Fourier Transform (FT) also allows certain non-periodic functions (those that decrease
fast enough so that the area under their graphs is finite) to be converted i.e. it is still possible to
describe it in terms of its frequencies. But to do this, you need to compute coefficients for all
possible frequencies, to compute its FT.
The Fourier Transform can be derived from the Fourier series, where the coefficients for a and
b are defined as follows.


xdx x f a 2 cos ) ( ) (


xdx x f b 2 sin ) ( ) ( [H 1995] [EQ 2]
Since we are now dealing with a non-periodic function, we must consider the interval between
minus-infinity and infinity.
Transforming into the complex plane
In Fourier Analysis, complex numbers make it possible to have a single coefficient for each
frequency. This means that you no longer need coefficients for the sines and cosines, just one,
which will give you the information of both. It is calculated using the fact that a complex
number z = x + iy can be represented by the point (x,y) in the complex plane. The x-axis
representing the real part of the number z, and the y-axis representing the imaginary (i) part
(see figure 1.3.2). The phase of the complex number is simply the angle that is created when
Inverse Fourier Transform
Fourier Transform
TIME DOMAIN FREQUENCY DOMAIN
Fourier Analysis
Page 4
Figure 1.3.2
The Complex Plane
a line joins the point (0,0) to the point (x,y). The magnitude is the length of the line, which is
calculated using Pythagoras Theorem.
To write a Fourier series or transform using complex numbers, you can use the formula

sin cos i e
i
+ , which is derived from the complex plane
The formula for the Fourier Series of a periodic function (equation 1) can now be written
ikx
k
e c x f

) (
Where the formulas for the coefficients (equation 2) become
dx e x f c
ikx
k

1
0
) (
Using this knowledge, the formula for the Fourier Transform ) (

f and its inverse f(x) are


dx e x f f
x i


) ( ) ( [EQ 3]

d e f x f
x i
) (
2
1
) (

1.4 The Discrete Fourier Transform


Digital computers are finite machines: any desired computation can only use a finite number of
operations. No digital computer, then, can deal with real-(or complex)-valued functions of real
numbers. The Discrete Fourier Transform (DFT) samples the function in order for it to be
represented on a computer. Instead of having f(x) at all x, we have only the values of f at a
finite number of points f(x1), f(x2), For convenience, this is usually sample points at regular
intervals, of say. If you start sampling at x1=0, the sequence of sample points becomes 0, ,
2,,(n-1) and the sample values are f(0), f(), f(2),,f((n-1) )
Because the DFT is to enable you to use digital computers in Fourier Analysis, we need a
finite analogue of the Fourier Transform given in equation 3.
The integral is all over x, and is calculated for every real value of . In the finite analogue, the
integral becomes the sum

1
0
) (
n
r
r i
e r f

[C 1990] [EQ 4]
This is still defined for all complex numbers of absolute value 1, therefore the equation needs
restricting further, so we have a finite number of values .
We use the fact that
r i
e , for fixed , is periodic, with period 2/. Thus the range can be
restricted to values of between 0 and 2/.
So equation 4 now becomes the formula for the Discrete Fourier Transform (DFT)

1
0
/ 2
,
) ( ) / 1 ( ) / 2 (
n
r
n ikr
n
e r f n n k f D


(x , y)
x
y

magnitude
) (
2 2
y x +
Fourier Analysis
Page 5
1.5 The Fast Fourier Transform
The Fast Fourier Transform is of special interest because it has enabled the use of the DFT to
be faster and therefore more commonly used. When calculating the DFT, a small number of
Fourier Coefficients is often adequate for an accurate Fourier Transform. It means that, with
the aid of computers, a Discrete Fourier Transform can be quickly processed.
An example of this is the fft command in Matlab. The program uses the FFT technique to give
a fast effective result, which can then be plotted on the frequency domain.
Figure 1.5.1 shows the result of using this command.
Figure 1.5.1
Matlab plots of left) Plot of a speech signal right) Its Fast Fourier Transform
When the Fourier Transform is plotted, only the amplitude data is shown and the phase is
discarded.
The Fast Fourier Transform (FFT) was introduced by Cooley and Tuley in the mid 1960s. Its
effects have been evolutionary, turning Fourier Analysis from merely being a mathematical
tool to being a practical one as more and more people turned to Fourier Transforms as an
effective way of frequency analysis. Cooley and Tooley developed an algorithm to speed up
the DFT for signals that had a length of a power of 2 e.g. 2, 4, 8, 16, 32, 64 This is because
the method recursively halved the data.
The algorithm is described as a divide and conquer algorithm that systematically divides the
data into two halves, the FFT is then performed on each half, and then the two halves are
spliced back together.
The FFT cuts down the number of computations needed from
2
n to n log n. Therefore the
larger the value of n, the more impressive the gain in speed of calculating the FT.
Since the Cooley and Tooley algorithm has been developed, a new FFT algorithm has been
discovered where the signal need not have a length of a power of 2.
1.6 The Time/Frequency problem
There is a fundamental problem with the Fourier Transform that led to the search for a more
suitable transform such as the Wavelet Transform.
A function and its Fourier Transform are two faces of the same information. The function
displays the time information and hides the information about frequencies, and the Fourier
Transform displays the frequency information but no information about the time. The question
that is raised is, is it necessary to have both the time and the frequency information at the same
time?
The answer depends on the particular application and the nature of the signal in hand. The
Fourier Transform gives the frequency information of the signal, which means that it tells us
how much of each frequency exists in the signal, but it does not tell us when in time these
frequency components exist.
Olivier Rioul and Martin Vetterli state that a transform such as this one can only be effectively
applied to stationary signals [R 1991].
Fourier Analysis
Page 6
Definition: Signals in which frequency content doesnt vary significantly in time are
Stationary.
The only strictly stationary signal is one with constant frequency.
Here is an example.
Robi Polikar gave the following example in his Wavelet tutorial, which shows the problems
with non-stationary signals. [P 1996]
Figure 1.6.1 is a plot of a stationary signal and its Fast Fourier Transform, zoomed in. The
signal is x(t)=cos(2*pi*10*t)+cos(2*pi*25*t)+cos(2*pi*50*t)+cos(2*pi*100*t) and so
contains frequencies of 10, 25, 50, 100 hz at any given time instant.
Figure 1.6.1
Plot of a Stationary signal and its FFT
Figure 1.6.2
Plot of a Non-stationary signal and its FFT
Figure 1.6.2 is a plot of a signal with four different frequency components at four different
time intervals i.e. it is non-stationary. This signal contains the same frequencies as the signal
used for the stationary example. The Fast Fourier Transform is also given.
The ripples in the FFT are due to sudden changes from one frequency to another and are
irrelevant in this example.
Apart from the ripples, the two plots of the FFT look identical, they both have large peaks at
frequencies 10, 25, 50, 100 Hz. The problem is apparent when you ask yourself when these
frequencies actually occurred. It is straightforward for the stationary example, but not so for
the non-stationary signal. This example shows that any change in frequency of a signal at the
slightest of time intervals will effect the overall FFT. As a result, you would get completely
false information.
As this project involves non-stationary signals, a further approach is needed.
1.7 The Short Term Fourier Transform
Fourier analysis doesnt work equally well for all kinds of signals or for all kinds of problems.
Hubbard describes the nave approach of some scientists when applying Fourier
In some cases, scientists using it are like the man looking for a dropped coin under a
lamppost, not because that is where he dropped it, but because thats where the light is
[H 1995]
If the signal is non-periodic, the summation of the periodic functions, sine and cosine, doesnt
accurately represent the signal. Research into artificially extending the signal to make it
Fourier Analysis
Page 7
periodic revealed that you would require what is called continuity at the endpoints of the
function.
Dennis Gabor introduced the Short Term Fourier Transform (STFT), also known as
Windowed Fourier Transform, as an attempt to overcome the problem with identifying when a
frequency occurred in a non-stationary signal. STFT introduces the notion of time dependency
into the Fourier Analysis.
Gabors basic Idea: Introduce a local frequency parameter (local in time) so that the Fourier
Transform looks at the signal through a window over which the signal is approximately
stationary.
Figure 1.7.1
Studying the frequencies of the signal segment by segment limits the span of time during
which something is happening.
Formal Definition
Given a signal x(t), Gabor recognised that to be accurate in time, a two-dimensional time-
frequency representation is needed, S(t, f), where f is the local frequency.
Recall, the signal is stationary when it is seen through a window g(t) (see figure 1.7.1).
The signals viewed in the window are represented by the following equation.
) ( ) ( T t g t x
T is the time location where the window is centred, and g (t) is the window function.
The multiplication of x(t) by g (t) is called Convolution (see page 10)
The Fourier Transform of these signals is then obtained by applying this to the Fourier
Transform given in Equation 3 (page 4)
As you can see by the formula, the STFT relies heavily on the choice of the window. In figure
1.7.1, the window was a basic rectangular window, but for more accurate results, different
shaped windows can be used such as the preferred Hamming window.
Another factor is the size of the window. Although the size of the window is fixed for the
entire process of calculating the STFT, different STFTs can be calculated using different sized
windows. A small window is effectively blind to low frequencies, as they are too large for the
window, but using a large window, information is lost about brief changes.
We will see later how Wavelets have combated this problem as an attempt to see the wood and
the trees.
Figure 1.7.2 illustrates the windowing of a signal in STFT.
It shows Gabors 2-dimension principle and gives two alternative views.
Analysis Window g(t)
The wave is stationary in this
windowed section
T
Time (t)
x(t)
dt e T t g t x f T STFT
ft j 2
) ( ) ( ) , (

[EQ 5]
Fourier Analysis
Page 8
Figure 1.7.2
[R 1991]
Figure1.7.2 shows vertical stripes in the time-frequency plane. They illustrate the windowing
of the signal view of the STFT. Windowing at time t, it computes all frequencies of the STFT.
The alternative view is shown by the horizontal stripes. It is based on a filter bank
interpretation of the STFT process. At a given frequency f, the STFT amounts to filtering the
signal at every value of t, using a bandpass filter. The window function is modulated to the
given frequency.
The time/frequency resolution problem with STFT
In 1975, Jean Morlet recognised a problem: Unlike Fourier Analysis, The STFT system has the
disadvantage of being imprecise about time in the high frequencies because the size of the
window is fixed. If you then make the window very small, it means losing all the information
about low frequencies.
So Morlet took another approach, which lead to the discovery of the WAVELET.
1.8 Technical Definitions for Chapter 1
Basis Functions
A group of functions such as y = sinx, y=sin2x, etc. form a basis if
i) They are all linearly independent from each other.
ii) They can form any other linear function i.e. they span a vector space.
[Adapted from PMA211 course notes]
Linear Independence Formal Definition
Let v1,,vr be functions over a field F (eg. Real Numbers).
Say that there exist coefficients a1,,ar in F, not all zero, such that a1v1+a2v2++arvr = 0
If the only way this can occur is that a1=a2==ar=0, then v1,,vr are all linearly
independent. Basically, this means that you cant make one of the linear independent functions
by combining any multiples of the others that are in the same basis.
Part ii) states that given any linear function in the same field, you can make it up by using
combinations of the basis functions.
STFT(T,f2)
STFT(T,f1)
T
f
Sliding Window g(t)
STFT(T1,f) STFT(T2,f)
T1 T2
f1
f2
modulated
filter bank
Fourier Analysis
Page 9
In the case of the Fourier Transform, the basis is made up of sinusoids. According to the
definition of a basis, this means that all sinusoids are linearly independent from each other.
The following is a proof to show this.
A proof to show linear independence of sinusoids
Firstly, we need to explore Orthogonality and Inner Products
The Inner Product of two functions is a mapping < , > : V x V where V is a function in a
vector space and is a real number. We only need to concern ourselves with the mapping for
a continuous function, as both sin nx and cos nx are both continuous.
Given the space of all continuous functions on the closed interval [a,b], the Inner Product < >
is defined by

> <
b
a
dt t g t f g f ) ( ) ( ,
Let u and v be functions in a vector space, we say u and v are Orthogonal if <u , v> = 0 ie.
if their inner product is zero.
It is known that if you have a set of functions that are all orthogonal to each other, then they
are linearly independent and therefore form a basis. So to complete the proof, it needs to be
shown that the functions in the proposed sinusoidal basis are all orthogonal to each other.
The elements of a sinusoidal basis are, 1 , cos x, sin x, cos 2x, sin 2x, , cos nx, sin nx,
The proof is in three steps
Step 1 proof that cos mx and cos nx are othogonal where m n
< cos mx, cos nx > =


+ +

tdt n m tdt n m ntdt mt ) cos(


2
1
) cos(
2
1
cos cos


1
]
1

+
1
]
1

+
+

n m
t n m
n m
t n m ) sin(
2
1 ) sin(
2
1
= 0
so cos mx and cos nx are orthogonal
Step 2 proof that sin mx and sin nx are othogonal where m n
< sin mx, sin nx > =


+

tdt n m tdt n m ntdt mt ) cos(


2
1
) cos(
2
1
sin sin


1
]
1

+
+

1
]
1

n m
t n m
n m
t n m ) sin(
2
1 ) sin(
2
1
= 0
so sin mx and sin nx are orthogonal
Step 3 proof that cos nx and sin mx are othogonal
< cos nx, sin mx > =


+ +

tdt m n tdt m n mtdt nt ) sin(


2
1
) sin(
2
1
sin cos
if n m


1
]
1


+
1
]
1

+
+

m n
t m n
m n
t m n ) cos(
2
1 ) cos(
2
1
= 0
if n = m


1
]
1

+
+

m n
t m n ) cos(
2
1
= 0
Fourier Analysis
Page 10
so cos nx and sin mx are othogonal
All possible cases have been exhausted, and in each case the inner products have equalled to
zero, therefore, all sinusoids are orthogonal to each other and hence they are linearly
independent and form a basis for the Fourier Transform.
Convolution
An operation of the form x(n)h(n) is called Convolution, written x(n) h(n), but the symbol is
usually omitted.
The Matlab command in conv(x,h)
Convolution is used to calculate the response of the system to an arbitrary input signal by
convolving it with the systems impulse response.
You can think of convolutions geometrically, but it is best to explain them mathematically as
this is what computers do when they calculate the convolution.
The convolution of two sequences a and b, is given by
j k j k
b a b a

) (
where
k
b a ) ( is the kth element of the resulting sequence.
If the
j
a and
j
b are nonzero only for j >= 0 then
j k
k
j
j k
b a b a


0
) ( [H 1995]
The convolution property is more useful when applied in a transformed domain (such as
frequency is the transformed domain of time in Fourier Analysis). It is very hard to visualise
what is happening to two signals after convolution when still in the time domain, but in the
transformed domain, convolution becomes multiplication. ] [ ] [ ] [ y T x T y x T
So this is effectively where corresponding values of points along the x-axis of both graphs are
multiplied together to form the new point.
Figure 1.8.1
TIME TIME
FREQUENCY FREQUENCY

FOURIER TRANSFORM

Introduction to Wavelets
Page 11
2 : Introduction to Wavelets
2.1 Where did they come from?
Wavelets were discovered as a result of engineering and not from mathematics like most
applications in signal processing. Yves Meyer was one of the first people who realised the
importance of wavelets and recognised that most researchers had been using a process
resembling the wavelet process already without knowing of its history or functional
backgrounds. Wavelet theory has developed independently from a large number of areas, and
it was he who made the connection. He made the following comment.
Tracing the history of wavelets is almost a job for an archeologist, I have found at least 15
distinct roots of the theory, some going back to the 1930s [H 1995]
This dissertation focuses on the discovery of wavelets as an approach to solve the
time/frequency resolution problem presented in the previous chapter.
The first use of wavelets was when Morlet was using Short Term Fourier Analysis. He was
using STFT when working on a system that processed echo signals, used for aiding the
localisation of oil for excavation. Big windows were placed at different places on the signal,
then, as the price of computing dropped further; windows were placed closer and closer
together, even overlapping. Morlets problem was, no matter what he did; the process didnt
get any better. Morlet wanted a finer local definition.
As mentioned in section 1.7, the STFT system has the disadvantage of being imprecise about
time in the high frequencies (unless you make the window very small, which means loosing all
the information about low frequencies).
So Morlet decided on another technique. Instead of keeping the size of the window fixed and
filling it with oscillations of different frequencies, he did the reverse: he kept the number of
oscillations in the window constant and varied the width of the window.
This window is called a WAVELET.
Figure 2.1.1
STFT Vs Wavelets
When the wavelet is stretched, the oscillations inside of it are stretched, decreasing their
frequency. When the wavelet is compressed, higher frequencies are produced.
Figure 2.1.1 shows the difference between STFT and Wavelets.
Top Row: STFT
Size of window is fixed and the number of oscillations varies.
Small window is blind to low frequencies, which are too large for the window.
STFT
WAVELETS
Introduction to Wavelets
Page 12
The large window looses information about a brief change in the information concerning the
entire interval corresponding to the window.
Bottom Row: WAVELETS
A mother wavelet (left) is stretched or compressed to change the size of the window.
It makes it possible to analyse a signal at different scales.
2.2 The Mother Wavelet
The mother wavelet is the building block for all other wavelets.
All wavelets are generated from a single wavelet function by a series of simple scaling and
translation procedures. This two dimensional parameterization is obtained from the function
(t) by
) 2 ( 2 ) (
2
,
k t t
j
j
k j
j , k Z [B 1998]
Z is the set of all integers. The factor
2
2
j
maintains a constant norm idependent of scale j.
k- parameterisation of the time or space location.
j- the frequency or scale.
The function (t) is called the generating wavelet or Mother Wavelet and defines the wavelet
basis. The term basis is the same here as it was in the FT case.
Looking at the formula, it is clear to see that there are infinitely many mother wavelets, which
form the foundations of the Wavelet Transforms.
2.3 Wavelets achieve Multiresolution
Figure 2.3.1
[G 1995]
Frequency Frequency
Time
Time
a)
b)
Introduction to Wavelets
Page 13
Amara Graps describes the benefits of using wavelets in signal processing. Wavelets overcome
the time/frequency resolution problem because of their ability to be stretched and compressed
(see section 2.2).
Part a of figure 2.3.1 shows a STFT, where the window is simply a square. Because a single
window is used for all frequencies in the STFT, the resolution of the analysis is the same at all
locations in the time/frequency plane.
An advantage of using wavelets in a transform is that the width of the windows can vary. You
can have short high-frequencies windows and long low-frequency windows.
Part b shows the coverage in the time/frequency plane with a wavelet function.
2.4 How do you create a Wavelet?
As mentioned earlier, there are infinitely many wavelets. Unlike the basis for the Fourier
Transform i.e. sinusoids, wavelets can contain many sharp corners or discontinuities.
Wavelets are obtained by altering the variables j and k given in the mother wavelet formula in
section 2.2. These variables are integers that scale and dilate the mother function to generate
different wavelet families such as the Daubechies family (see below). The scale index j
indicates the wavelets width, and the translation index k gives its position.
The term position is used in the same sense as it is for the STFT; it is related to the location of
the window, as it is shifted through the signal.
Figure 2.4.1
Figure 2.4.1, shows the Daubechies Wavelet family with different scaling and transitions.
They were created by a Matlab function that used the rules described by Ingrid Daubechies, in
her book Ten Lectures on Wavelets. [D 1992]
Within each family of wavelets (such as the Daubechies family) are wavelet subclasses that
are distinguished by the number of coefficients and by the level of integration. These wavelets
are classified within a family often by the number of vanishing moments. [G 1995]
The Continuous Wavelet Transform
Page 14
3 : The Continuous Wavelet Transform
The Continuous Wavelet Transform (CWT) was developed as an alternative approach to the
Short Term Fourier Transform (STFT) to overcome the time/frequency resolution problem
(section 1.7)
3.1 Theory
The CWT is done in a similar way to the STFT, in the sense that the signal is multiplied with a
function, which is in this case, the Wavelet introduced in the previous chapter. Also, like
STFT, the transform is computed seperately for different segments of the time-domain signal.
The main difference between CWT and STFT is that the width of the window is changed as
the transform is computed for every single spectral component, which is probably the most
significant characteristic of the CWT.
In the STFT computation, because the window had a constant shape and size throughout the
analysis, the frequency responses of the window were regularly spaced over the frequency
axis. Figure 3.1.1 (a) shows what filter bank the STFT produces. A filter bank is a term used to
describe the filtering effects on the frequencies in the signal as the window moves along the
signal.
Figure 3.1.1
[R 1991]
In the CWT case, instead of the frequency responses of the analysis filter being regularly
spaced over the frequency axis, they are regularly spread in a logarithmic scale (figure 3.1.1
(b) ).
Olivier Rioul and Martin Vetterli describes that this logarithmic approach in the filter banks is
used for modelling the frequency response of the cochlea situated in the inner ear and is
therefore adapted to auditory perception. [R 1991]
We have already introduced Wavelets as the basis function for the CWT, and that these are
scaled and translated versions of the mother wavelet. The following formula expresses the
CWT in terms of the signal applied to the wavelet
Formula
dt
s
t
t x
s abs
s CWT
x

,
_


) (
) (
1
) , ( [EQ 6]
This shows the transformed signal is a function of two variables, and s, the translation and
scale parameters, respectively and (t) is the mother wavelet.
Frequency f
Frequency f
(a) Constant Bandwidth (STFT) (b) Constant Relative Bandwidth (CWT)
The Continuous Wavelet Transform
Page 15
Notice that we do not have a frequency parameter, as we had with the STFT (EQ 5, page 7),
instead, we have a scale parameter which is defined as 1/frequency.
Robi Polikar made the following analogy:
The scale parameter in the wavelet analysis is similar to the scale used in maps. As is the
case of maps, high scales correspond to a non-detailed global view (of the signal), and low
scales correspond to a detailed view. [P 1996]
3.2 Computation of the CWT
This section explains the formula given above and shows some applications.
Let x(t) be the signal that is to be analysed. Firstly, you need to choose a wavelet to act as the
analysing window. There are several candidates, Morlet, Sombrero, Daubechies, which are all
derived from the mother wavelet. Once the wavelet is chosen, the computation starts at s = 1
and the CWT is computed for all values of s, smaller and larger than 1. It is conventional that
the value of s (the scale) starts at 1, but this doesnt always have to be the case. The procedure
then continues for increasing values of s i.e. the analysis will start from high frequencies and
proceed towards low frequencies.
As the value of s increases, the more the wavelet dilates, so the first value of s corresponds to
the most compressed wavelet.
The wavelet is placed at the beginning of the signal which is at the point which corresponds
to t = 0. The wavelet function at scale 1 is multiplied by the signal and then integrated. The
result of this integration is then multiplied by the constant number 1/sqrt(s). This is for
normalisation purposes only, so that the transformed signal will have the same energy at every
scale. The final result is the value of the CWT at time zero (t=0) and scale s=1 in the time-
scale plane.
The value of the transformation is calculated every time the wavelet is shifted towards the right
by . Therefore the value for the CWT is obtained at t=0, t=, t=2, etc. with scale s=1as the
wavelet is shifted. This procedure repeats until the wavelet reaches the end of the signal. One
row of points on the time-scale plane is then completed. Sections 3.3 and 3.4 show how these
rows are represented.
s is then increased by a small value and the above procedure is repeated for every value of s,
where each value of s fills the corresponding row of the time-scale plane.
Figure 3.2.1 shows the CWT process with s=1. The wavelet is the Morlet wavelet and is
shown in yellow. Here, t represents the value of time where the centre of the wavelet is
positioned.
Figure 3.2.2 shows the CWT process with s=5.
Figure 3.2.1
s=1 a) t=2, b) t=40, c) t=90, d) t=140
Figure 3.2.2
s=5 a) t=2, b) t=40, c) t=90, d) t=140
a) b) a) b)
c) d) c) d)
The Continuous Wavelet Transform
Page 16
3.3 Visualising the CWT 3D Plot
Section 3.2 showed how the CWT is calculated by moving the wavelet window along the
signal at different wavelet scales. Each time the scale is increased, a new row of a matrix is
added. The matrix produced by the CWT process has the following dimensions.
x-axis : Translation (depends on the value of tau)
y-axis : the number of different values of s used
Figure 3.3.1 shows a typical plot of a CWT.
Figure 3.3.1
As described earlier, the scale parameter s in equation 7 is actually the inverse of frequency. In
other words, frequency decreases as scale increases. So the portion of the graph in figure 3.3.1
with scales around zero, actually correspond to highest frequencies in the analysis.
3.4 Visualising the CWT - Scalograms
The Scalogram is a very common tool in signal analysis, as it provides a distribution of the
energy of the signal in the time-scale plane. Olivier Rioul and Martin Vetterli recognised that
the CWT is isometric and therefore preserves energy. They proved this with the following
formula
X
E
s
ds d
s CWT
2
2
) , (

[R 1991]
where
2
) (

t x E
x
is the energy of the signal x(t).
This discovery lead to the definition of the scalogram, as the squared modulus of the CWT.
Figure 3.4.1 shows an example of a typical scalogram.
Figure 3.4.1
The Scalogram is the visual representation used in the Wavelet Learning Tool being developed
as part of this dissertation
The Discrete Wavelet Transform
Page 17
4 : The Discrete Wavelet Transform
4.1 Why not use the CWT?
As described in section 3, a signal can be transformed from the time domain to the frequency
domain using the Continuous Wavelet Transform (CWT) while reducing the loss of time and
frequency resolution. The section explained how the CWT was calculated by changing the
shape of the wavelet, which acts as the analysis window, for each analysis frequency. The
wavelet shape was governed by the scale parameter s where a larger s would represent a
more dilated wavelet. The wavelet would move along the signal with each scale and calculate
the CWT coefficient for each step. The size of the steps are governed by the parameter.
The s and parameters are continuous, i.e. their values can be incremented up to any value,
and hence the transform is called the Continuous Wavelet Transform. Due to these parameters
being continuous, the CWT is not well suited to computer implementation [A 1996]. Although
the Wavelet Learning Tool, being developed alongside this dissertation, is being developed to
use the CWT, to show how the process works and how the scalograms are produced, it is not
the quickest or most practical transform to use. The tool will only allow you to use small
values of s and , any larger values i.e. a signal with too many samples increases computation
time dramatically.
4.2 Discretizing the Continuous Wavelet Transform
In the Continuous Wavelet Transform, the wavelet coefficients were calculated using equation
6. As mentioned above, the CWT cant be practically computed because it contains an integral
with which the variables are continuous. It is therefore necessary to discretize the transform.
The most intuitive way of doing this is to simply sample the time-frequency plane. With most
transforms, the most natural choice would be to sample the plane with a uniform sampling rate,
but in the case of Wavelet Transforms, the scale change can be used to reduce the sampling
rate. Nyquist developed the following rule that explains the reasons for using scale to reduce
sampling rate.
Nyquists Sampling Theorem: If the range of frequencies of a signal measured in cycles per
second is n, then the signal can be represented with complete accuracy by measuring its
amplitude 2n times a second. [H 1995]
This theorem describes how a curve with a finite number of frequencies can be represented
exactly by a finite number of samples. Usually you would need an infinite number of samples
in order to represent the curve exactly.
Nyquists Sampling Theorem can be interpreted so that if the time-scale plane needs to be
sampled with a sampling rate of n1 at scale s1, the same plane can be sampled with a sampling
rate of n2 at scale s2, where s1<s2 (corresponding to frequencies f1>f2) and n2<n1.
In other words, at lower frequencies, the sampling rate can be decreased which will save a
considerable amount of computation time.
The first stage of the discretization process is to discretize the scale parameter s onto a
logarithmic grid. The time parameter is then discretized with respect to the scale parameter. In
this way, a different sampling rate is used for every scale. This method is represented by the
Dyadic Sampling Grid (figure 4.2.1).
The Discrete Wavelet Transform
Page 18
Figure 4.2.1
Dyadic Sampling Grid [V 1995]
The Dyadic Sampling Grid shown in figure 4.2.1 is a pictorial representation of the
relationship between sampling frequency and scale. As scale increases down the graph, the
frequency being analysed decreases. Nyquists Rule says that the further you go down the
graph, the lower the sampling rate that is needed. In the figure, the sampling rate is represented
by the dots. The more dots, the higher the sampling rate. Each dot corresponds to a Wavelet
coefficient calculated using the Continuous Wavelet Transform. The larger the scale
parameter, the fewer the number of coefficients that are needed, and therefore the quicker the
computation time.
You could think of the area covered by the axes as the entire time-scale plane. The CWT will
assign a value to the continuum of points on this plane. There are obviously an infinite number
of CWT coefficients. Considering the discretization of the scale axis, among the infinite
number of points, only a finite number of them will actually be calculated, using a logarithmic
rule. The base of the logarithm depends on the application but the most common is 2 because
of its convenience. An application called Subband Coding (see section 4.3), uses such a base.
If the base 2 is chosen, only the values 2,4,8,16,32etc are used for the scale parameter. The
time axis is then discretized according to the discretization of the scale axis. Since the discrete
scale changes by a factor of 2, the sampling rate is reduced for the time axis by a factor of 2 at
every scale. You can see at each stage of the Dyadic Grid that the sample rate is decreased by
half. As a consequence, the Discrete Wavelet Transform uses wavelets only of the form where
the scale
k
j 2 and k is a whole number, see the formula for the mother wavelet on page 12.
4.3 Subband Coding
There are two well documented methods for calculating the Discrete Wavelet Transform based
on the ideas expressed in section 4.2, The Multiresolution Pyramid and Subband Coding. This
section will give a detailed explanation of the later of these two and will be used as part of a
second piece of software showing the visual effects the method has on the signal.
Driven by applications such as speech and image compression, a method called Subband
Coding was proposed by Croisier, Esteban and Galand using a special class of filters called
quadrative mirror filters in the late 1970s [V 1995]
The Subband coding scheme, first popularised in speech compression, uses a combination of
high-pass and low-pass filters to reduce the sample rate of the transform. Filters of different
cut-off frequencies are used to analyse the signal at different scales. The whole Subband
process consists of a series of these filters known as a filter bank. High-pass filters are used to
analyse the high frequencies in the signal, and the signal is passed through a series of low-pass
filters to analyse the low frequencies.

log s
The Discrete Wavelet Transform
Page 19
The resolution of the signal, which is a measure of the amount of detail information in the
signal, is changed by the filtering operations, and the scale is changed by downsampling (sub-
sampling) operations. Sub-sampling a signal corresponds to reducing the sampling rate, which
is equivalent to removing some of the samples of the signal. For example, subsampling by two
refers to dropping every other sample of the signal (see figure 4.2.1). Subsampling by a factor
n reduces the number of samples in the signal n times.
Figure 4.3.1
The Subband Coding scheme shown as a filter bank tree. [R 1991]
h(n) high-pass filter, g(n) Low-pass filter, 2 Subsampling by 2
The procedure starts with creating a high-pass filtered version of the signal by passing the
signal through a half band digital low-pass filter. This is done by convolving the signal by an
impulse response function h[n] which represents the low-pass filter. A half band low-pass filter
eliminates exactly half the frequencies from the low end of the frequency scale. For example,
if a signal has a maximum of 1000 Hz component, then half band lowpass filtering removes all
the frequencies above 500 Hz.
There is an important thing to consider when talking about frequency in the discrete case and
is explained as follows.
In discrete signals, frequency is usually expressed in terms of radians. As a result of this, the
sampling frequency of the signal is equal to 2 radians in terms of radial frequency. Therefore,
the highest frequency component that exists in a signal will be radians, if the signal is
sampled at Nyquists rate (which is twice the maximum frequency that exists in the signal, see
page 17); that is, the Nyquists rate corresponds to rad/s in the discrete frequency domain.
Therefore using Hz is not appropriate for discrete signals. However, Hz is used whenever it is
needed to clarify a discussion, since it is very common to think of frequency in terms of Hz. It
should always be remembered that the unit of frequency for discrete time signals is radians.
After passing the signal through a half band low-pass filter, half of the samples can be
eliminated. This is according to Nyquists rule, since the signal now has a highest frequency of
/2 radians instead of radians. Simply discarding every other sample will subsample the
signal by two, and the signal will then have half the number of data points. The low-pass
filtering removes the high frequency information, but leaves the scale unchanged. Only the
subsampling process changes the scale (see figure 4.3.2). Resolution, on the other hand, is
related to the amount of information in the signal, and therefore, it is affected by the filtering
operations. Half band lowpass filtering removes half of the frequencies, which can be
Etc.
h(n)
g(n)
h(n)
g(n)
h(n)
g(n)
2
2
2
Level 1
Level 2
Level 3
The Discrete Wavelet Transform
Page 20
interpreted as losing half of the information. Therefore, the resolution is halved after the
filtering operation. Half the samples can be discarded without any loss of information.
Basically, the lowpass filtering halves the resolution, but leaves the scale unchanged. The
signal is then subsampled by 2 since half of the number of samples are redundant. This doubles
the scale.
This completes one level of the Subband decomposition
This can be repeated for further decomposition. At every level, the filtering and subsampling
will result in half the number of samples (and hence half the time resolution) and half the
frequency band spanned (and hence double the frequency resolution).
Figure 4.3.2
Resolution and scale changes in discrete time
4.4 Example of Subband Coding
We have shown how to decompose a sequence into two sub-sequences at half rate by using a
bank of halfband pass filters. This process can be iterated on the sequence from the lower band
to achieve finer frequency resolution at lower frequencies. Repeating the process once on the
first low band creates a new low band, which corresponds to the lower quarter of the frequency
spectrum. Each further iteration will half the amount of frequency in the signal.
Figure 4.4.1 shows the result of applying a signal to the Subband Coding scheme, each stage
shows how the signal is sub-sampled and how the frequency band is reduced by half.
The signal in blue is a sound wave made up of two tones produced by someone whistling. The
first region is a low tone and the second is a distinctively higher tone. Its Scalogram image,
produced by the Wavelet Learning Tool being developed along side this dissertation, is given
below also. This was computed using the Morlet wavelet. It clearly shows the two distinct
frequencies.
Figure 4.4.1
Outputs from Subband Coding Scheme
halfband
lowpass filter
resolution: halved
scale: no change
halfband
lowpass filter
resolution: halved
scale: doubled
2
High pass filter 1
2000 Samples
f(/2 ~ )
High pass filter 2
1000 Samples
f(/4 ~ /2)
High pass filter 3
500 Samples
f(/8 ~ /4)
High pass filter 4
250 Samples
f(/16 ~ /8)
4000 Samples
The Discrete Wavelet Transform
Page 21
Figure 4.4.1 shows the results from each stage (iteration) of the Subband Coding scheme.
The example given is of a signal comprised of a low frequency tone followed by a high
frequency tone. Throughout the different stages of the Subband coding scheme, the signal has
been high-pass filtered and then down sampled. The outputs given show the signal at the
different stages of the scheme. It is clearly visible that at the start of the process, only the high
frequency components are visible but, as the process has gone on, the signal has been more
and more high pass filtered until only the very low frequencies are left. This is proved by the
fact that the high frequency tone has been completely filtered out after 4 filters.
The outputted signals given in figure 4.4.1 are taken from the Subband Learning Tool
developed along side this dissertation.
Computer Assisted Learning Tools
Page 22
5 : Computer Assisted Learning Tools
5.1 Computer Assisted Learning (CAL)
As this dissertation researches into the fairly new field of Wavelet Theory, a software package
is being developed to aid in the understanding of the processes involved. The fact that there
hasnt been much software development in this field gives all the more reason to develop one
now, which can be used to complement the teaching of the subject. Generally speaking, the
software package being developed belongs to the family of Computer Assisted Learning
(CAL) tools. This chapter discusses the advantages and disadvantages of using CAL and
whether a CAL tool is appropriate in this situation.
Computer Assisted Learning means (in a broad sense) using computers in education for all
kinds of purposes. [ICASSP vol2 1995]
When constructing CAL tools, it has been recognised that they should provide flexibility for
the student involved and also be stimulating enough so that the student can construct private
concepts rather than reproducing given explanations. [K 1996]
The advantage of having such a tool is that users can control their own access to the
information being taught. In this way, the flexibility of the system allows students to adapt the
available information streams to their mental need at any given moment. The disadvantage of
this free access to the CAL tool is that lecturers have no control over the flexibility of the
system. Lecturers need to anticipate how much the students will take advantage of this free
access, which may lead to the student not fully understanding the basic concepts that the CAL
tool was developed for in the first place. Because of this flexibility problem, CAL tools can not
solely be used as a method for teaching a new subject, but there is plenty of evidence below to
suggest that there are great advantages of using a CAL tool when used with a series of lectures.
Lecturers, Martin Cooke and Guy Brown, have researched into possible situations where a
CAL tool is useful in teaching speech and hearing, and may therefore aid in the teaching of
Wavelets. Their development of the Matlab Auditory Demos (MAD), with which the Wavelet
Learning Tool being developed as part of this dissertation would contribute to, has given the
two authors a deep understanding on whether a CAL tool is appropriate.
They initially recognised the following problem,
The courses in speech and hearing typically introduce large amounts of unfamiliar material to
participants with backgrounds almost as variedthe domains of speech and hearing involve
intangible signals, ill-suited to traditional styles of presentationthe possibilities for
misinterpretation are immense and, in our experience, difficult to predict [C 1999]
Recognising this problem, it was clear that CAL tools would be an appropriate solution, due to
the scope for interaction and experimentation.
Matti Karjalainen and Martti Rahkila also recognised the fruitfulness of using a CAL tool with
teaching Signal Processing. They also understood that a CAL tool must be in some way more
useful than ordinary teaching methods. [ICASSP vol2 1995]
Kommers, Grabinger and Dunlap recognised that there are 3 main areas to most CAL tools
where there are significant advantages to learning, Resource, Communication and Exploration.
[K 1996]
Resource: Paper-based documents are restricted to text, tables, schematic line drawings and
pictures, whereas hypermedia allows sound and video sequences as well. CAL tools can
provide multiple dimensions in the meanings of expressed ideas e.g. hearing a property of a
sound wave provides a better and more natural understanding than a picture of the sound wave.
Computer Assisted Learning Tools
Page 23
However, it is important that the resources provided by the tool match those provided by the
lecturer. If the tool and the lectures mention the same word for different meanings, the learning
experience is weakened.
Communication: This is based on the idea that a system should be programmed so that a
dialogue could evolve between the machine and the learner. The actual bandwidth of
communication in a CAL tool is very low and would probably not feature a large amount in
the tools being developed. However, a user guide will be developed to help users to use the
tools to the best effect, see Appendix B.
Exploration: Computer simulation programs themselves are convincing for demonstrating their
education value. Confronting a student with a simulation allows more drastic, flexible and
critical manipulations. In a book, only a few examples may be given for a particular property,
but with a CAL tool, explorations into many other instances of that particular property can be
achieved. The exploration property will allow students to learn by discovery.
The CAL tools being developed for this dissertation are developed with the teaching of the
subject in mind, and how it can complement and reinforce a lecture course by providing hands-
on experience. The software has to be fairly easy to use to avoid early frustrations to a users
inexperience, and must also be visually suitable to make it clear what is happening. Just
looking at the previous chapters demonstrates how mathematical the theory of Wavelets is, and
to a computer science student, who may or may not have a good mathematical background,
may seem very demanding. The tool will help students to see visually what the maths
represents and enhance the students willingness to learn more about the subject, instead of
being intimidated by the mathematical content. After all, the actual use of Wavelets is to aid in
Signal Processing, so actual audio and visual demonstrations are an obvious key to teaching
the subject.
5.2 Which programming language?
There are many different program languages, which you can develop a learning tool from and
they all have their advantages and disadvantages, so it is sometimes difficult to choose which
one to use without seeing the benefits.
Matti Karjalainen and Martti Rahkila constructed a CAL tool using the QuickSig object-
orientated environment packages. This provides signal-processing tools for many application
domains, using the concept that signals and related concepts are represented as objects and the
operations on them are typically implemented by method functions. Another advantage is that
a wide range of functions such as filtering and transforms (like FFT) are built-in. However,
this programming environment has a problem with portability. QuickSig is Macintosh-specific
and also requires the languages Lisp and CLOS. So QuickSig is ill suited to large class sizes
and students would not be able to run the software on their home machines.
The CAL tools being developed in this dissertation use MATLAB.
Matlab is a high level programming language, which provides many facilities for data
visualisation and numerical computation. It doesnt have the problem with portability, as a
version of MATLAB is available for most operating systems. MATLAB lends itself to
prototype programming, as it provides good facilities for quick interface construction. Matlab
also has a high-level support for sound handling and signal processing. As it is a mathematical
language, it lends itself to the use of vectors and matrices and makes it very straightforward to
plot graphs of signals. Martin Cooke and Guy Brown recognised that MATLAB is a sensible
choice compared to languages such as Java. They recognised that an application in Java would
be time consuming because the Java applications interface (API) has no equivalent of the
signal processing toolbox available in MATLAB. A Java application for signal processing
would probably be too slow for any adequate user interaction.
Requirements Analysis
Page 24
6 : Requirements Analysis
The previous chapter introduced the notion of a Computer Assisted Learning tool and how
they can be used to assist in the teaching of Wavelet Theory. This dissertation will now focus
on the development of such a tool.
6.1 The initial requirement
At the very beginning, before any work was carried out, there was a small brief on what the
project should cover. This brief also contained a short paragraph on the basic requirements of
the system that was also to be developed
A MATLAB application will be designed and implemented that allows a wavelet
representation of sound to be generated using the DWT and modified by direct on-screen
manipulation (e.g. by removing components at certain scales); the inverse DWT will then be
applied to resynthesize a sound waveform which can be played to the listener.
This statement details the basic ideas of the system and was considered to be the backbone of
the system. It is clear that the system needs to include a function to work out the DWT, and
also the IDWT, and some user interaction to alter the scales on screen before the IDWT is
calculated. There are no clues to how the GUI should look, or how the user interacts with it.
Even though the initial requirement states that the DWT should be calculated, there was no
obvious indication of how the results of these calculations were to be displayed. Also, which
wavelet is to be used to calculate the DWT ?
All of these questions needed to be answered, so an interview was set up between myself (the
developer) and the client, to attempt to make clear what is needed.
6.2 The Client and Developer scenario
Before starting the design of any software system, it is important that you have all the
requirements clear first. The best way to do this is for the developer to ask a multitude of
questions to the client in order to extract important information about the system that the client
may not of previously given.
In any software development program, the client will have a total understanding of the
problem, as he is the one with the expertise on the subject. It is all too common for clients to
assume that a software developer is also an expert on their particular field of work. However,
this is always never the case and the software developer will have a limited understanding of
the problem and may be confused by the clients initial requirements. It may be the case that
the initial requirements are vague or even impossible to implement, so the idea of having an
interview is to explore and develop the clients narrow goals and to fill in any gaps of
understanding.
The interview session took place in the first week of development of this project and some of
the questions that were raised are detailed below. Most of the questions were of a result of
studying the initial requirement and of an early research into the topics of Wavelet Theory
before the project began. The answers given are not direct quotes, but they summarise the
discussion.
Requirements Analysis
Page 25
Q. Do you want a visual representation of the effects that different wavelets have?
This two-part question asks the developer to clarify how the result of the DWT should be
presented and to find out whether the user should be able to compare the effects of different
wavelets.
A. The result of the process of using the Wavelet Transform should be represented by a
Scalogram so the user can see all the coefficients calculated on a time-frequency axis. This
scalogram can then be manipulated ready for the inverse transform.
The user should be able to choose from a selection of wavelets so they that can compare the
different effects they have on the process. A good idea would be to have a side-by-side
comparison.
After the discussion, it was realised that the answer given by the client to this question
contradicted the initial requirement, and also the text that had been studied. In the
requirements, it was clear that the system should use a Discrete Wavelet Transform to analyse
the signal. However, the answer to the question suggested that the result of the transform
should be presented visually using a scalogram. In section 3.4, it explains that a scalogram is
calculated by taking a Continuous Wavelet Transform matrix and taking the square of the
magnitudes of the coefficients. This means that the requirements should be changed to using
the CWT and not the DWT. After discussing this, this became the new requirement and it was
agreed that another piece of software would be developed to show how the DWT could be
calculated using Subband Coding.
Q. Do you want a breakdown visually of the CWT process?
After recognising that it was in fact the CWT that would be used in the software, this question
approached the subject of using animation to picture the CWT process as well as the scalogram
showing the results it gives.
A. Yes. Showing the wavelet as it compresses or dilates to calculate each scale of the CWT
would be beneficial.
Q. How do you want the On-Screen manipulation to work?
The initial requirement suggested that the user should be able to use on-screen manipulations
to remove scales from the CWT in order to re-compute the inverse transform. However, it is
unclear how this could be done, especially in Matlab, where graphics are more limited than in
Java, say.
A. It was suggested that the user could directly manipulate the scalogram by using some sort of
cursor. The cursor could move up and down the scalogram and a window would show the
CWT coefficients at that scale. The cursor could then be used to select certain scales to be
removed.
Q. Would you like to be able to play back the sound waves?
A. Yes. You need to be able to play the original sound wave that is to be analysed, and also
you need to hear the effects of the re-synthesis of the scalogram using the ICWT.
Q. Do you want to be able to actively control the scaling and translation coefficients of
the wavelet used?
The CWT coefficients are calculated at every scale by using the scaling coefficient in the
mother wavelet formula (see section 2.2). The number of rows in the CWT matrix depends on
the number of scales calculated. Also, the number of columns in the CWT matrix depends on
the size of the steps the wavelet takes as it moves along the signal between each coefficient
calculation. The steps are controlled by the translation coefficient. Altering the values that
these coefficients take will change the number of CWT coefficients to be calculated, which
may be a useful property.
A. Yes. You could use a slider.
Requirements Analysis
Page 26
6.3 The Matlab Auditory Demos
The software tools being developed along side this dissertation will form part of the Matlab
Auditory Demo (MAD) CAL tools. These tools have been developed to aid in the teaching of
Computer Speech and Hearing courses in the University of Sheffield. [C 1999]
Because these MADs are Computer Assisted Learning tools, they need to fulfil the
requirements mentioned in chapter 5. The MADs consist of many different tools that enable a
user to understand many different concepts in the subject of Computer Speech and Hearing.
They vary from producing spectogram representations of speech waveforms to the complex
modelling of the Basilar Membrane in the ear.
Even though there is a wide variety of software systems comprising the MADs, they all have
many things in common that enable them to be successful CAL tools. The research into the
MADs produced the following further requirements.
Speed
The software tools that are being developed must be quick enough to allow sufficient user
interaction and provide meaningful animation. A quick system will maintain the users
interest, which will naturally enhance users understanding and learning of Wavelets.
Ease of use
Research into the MADs showed that all the systems were user friendly in such a way that the
user could see almost straight away what functionality was available. GUI objects are clearly
labelled and are only accessible at the appropriate times. Axes are labelled appropriately and
on-screen instructions appear when appropriate to guide the user. None of the systems are too
clustered with too many buttons, sliders etc. which would only confuse a new user, especially
if the user is new to the subject being investigated.
Aesthetics
It is important that the interface is pleasing to look at. If the system is dull in appearance, the
user would not be as interested in using the system, so the teaching of the subject would suffer.
The system should provide a suitable amount of colour to aid in the users understanding e.g.
the system could be colour coded so that different components have their own colour. Also, the
tools being developed should match the appearance of the MADs so that it is clear that they
belong to that group. The tools should have similar headers, size, background colour etc.
Input error recovery
It is important that a CAL tool recovers well to input error. Ideally, the system shouldnt allow
a wrong sequence of inputs i.e. by disabling GUI objects, but it is often the case where a user
would input something wrong either by mistake or by their lack of understanding about the
material or the system. It is here where the system should recognise that a user has inputted the
wrong value, and correct the error appropriately.
Software Development
Page 27
7 : Software Development
After the Requirements Analysis, it was proposed that two pieces of software would be
developed. The main one, called the Wavelet Learning Tool (WLT), will be developed and
documented in detail and will comprise of all the requirements set out in the previous chapter.
The second piece of software will be a basic tool, which will show the different stages in the
Subband Coding scheme and is called the Subband Learning Tool (SLT).
7.1 Getting familiar with MATLAB
In simplest terms, MATLAB is a computer environment for performing calculations.[R 1998]
MATLAB is a contraction of Matrix Laboratory, and is primarily used for a convenient tool
for the manipulation of matrices. Since it was first created, it has added more and more
functionality and remains a leading tool for scientific computation. While simple problems can
be solved interactively with MATLAB, its real power shows when you give it calculations
that are extremely cumbersome or tedious to do by hand. Because the Continuous Wavelet
Transform involves constructing a very large matrix, and then displaying that matrix,
MATLAB seemed to be a natural choice.
MATLAB also allows graphics to be displayed with ease and with little programming as it
combines an efficient programming structure with a multitude of pre-defined mathematical
commands. Therefore, before any software development, it was beneficial to familiarise with
what MATLAB has to offer in term of commands and interface construction.
7.1.1 MATLABs GUI
Matlab provides many different GUI objects to make user interaction as easy as possible. Each
object has its own different advantages depending on the type of operation. Below is a
comprehensive list of what is available.
Push Buttons The software user can press buttons for instant execution of a particular
function.
Pop-up Menus Contains a list where one item can be selected i.e. a wavelet type. After
selection, a process can be initiated.
Edit Boxes Used to alter a numerical parameter in a function.
Check Boxes Often used when there is an option to have a particular property in the
system or not.
Radio Buttons Similar to check boxes except they usually come in pairs where you
select one or the other.
Sliders Also used to alter the parameter in the function, but unlike edit boxes, a
value doesnt need to be known and the function can update in real-time
as the slider moves.
List Boxes Similar to pop-up menus except that the whole of the list cant be
visualised at once to save space.
Software Development
Page 28
Matlab also allows the construction of axis, lines, text, figures and other graphical devices, that
were taken into consideration when sketching the initial interface design.
Each GUI object has attached to it a series of handles. These handles define many properties of
the objects, which are set and controlled by the developer. The properties are set when the
software is first executed, but can be changed at any time during software development.
Controlling the handles to the GUI objects controls how the system will look, behave and how
efficiently. Therefore, a good understanding of the handles available and how to use them
appropriately was an important stage in software development.
7.1.2 Coding in MATLAB
Matlab is a functional program language rather than an object-orientated one. Functions call
other functions, which are executed in a sequential fashion. Each function is read downwards
unless encountered by a for or while loop or by an if clause.
The Wavelet Learning Tool will consist of many different functions, which will call each other
appropriately. The Matlab system will have to cope with the flow of control between these
different functions, which are written in m-files, which can be called at any time within a
program. However, keeping track of all these m-files can be very difficult and looks very
untidy. The solution to this is the case statement. Instead of having many different m-files
containing the different functions of the system, it is better practise to place all the functions
into one m-file separated by a case statement.
Figure 7.1.2.1
Every time the m-file containing all the switch statements is called, it must be called with an
appropriate argument corresponding to which case is to be read.
Another advantage to this case switching approach is that you can have an initialisation case
where all the global parameters can be set when the system is first executed.
Matlab programming revolves around designing separate functions to do separate jobs, and
then plugging them into the overall system to interact with the interface. This plug-in nature of
programming allows each function to be tested independently before being encapsulated into
the system. Most of the functions being developed involve matrix manipulation and can be
tested simply by running them on the Matlab command window to see if they produce correct
results. Some functions need not be tested seperately from the system if their sole purpose is to
just change global variables or alter the interface in some way. The functions that are
constructed from a mathematical knowledge followed the sequence of development shown in
figure 7.1.2.2.
m-file
CWT
m-file
Load
Signal
m-file
Zoom
in
m-file
switch
case CWT
--------
case Load Signal
--------
case Zoom in
--------
end
Software Development
Page 29
Figure 7.1.2.2
One of the most useful GUI objects handles is the enabling handle. This allows the software
developer to control when a user can use a particular GUI object. To stop the wrong sequence
of inputs into the system, a particular object can be disabled at a time when it shouldnt be
used. These restrictions will make the software more secure and more likely to recover from
user input error.
7.2 Wavelet Learning Tool - Interface Design
The main system to be developed is the one identified in the requirements analysis, the
Wavelet Learning Tool (WLT). This tool will allow users to choose different wavelets to
compute a CWT and corresponding scalogram. A side by side comparison of different
wavelets was recommended, as was a way of manipulating the scalogram to produce a re-
synthesised signal from an Inverse CWT function.
Matlab allows you to construct an interface very simply and effectively with very little code. It
is very beneficial to do interface development in the early stages of development, as it will aid
in the understanding of what functionality is needed in the final system. Knowing which GUI
objects were available, an initial sketch of the interface was made and presented for comment.
Figure 7.2.1
The sketch shown in figure 7.2.1 is an early representation of the proposed look of the
software tool. The original idea was to have the following GUI objects.
Mathematical
Formula
Code into
Matlab
Test seperately
on command
screen
Introduce appropriate
Interface code and
handle commands
Plug into the system
using case clause
Test the
system
Software Development
Page 30
5 Graphs: Plot of loaded signal. 2 for showing the animated wavelet as it changes shape to
calculate the different scales of the scalogram. Plot of the CWT coefficients from the
selected scale from a scalogram. Plot of the reprocessed signal.
2 Scalogram Images each with their own cursor
Pop-up menus for selecting a wavelet
Zoom Controls for zooming in on the plot of CWT coefficients
Process buttons for re-processing the CWT.
Play buttons for playing back the original and altered signals.
7.3 The coding of The Wavelet Learning Tool
Section 7.2 shows how an initial interface was designed to accommodate for the requirements
established in the requirement analysis. This initial interface was then coded into Matlab with
the help of the Guide tool. The Guide tool is a Matlab interface construction tool, which allows
a user to code an interface quickly and effectively without the tedious task of setting all the
handles to each GUI object. Although the Guide tool writes the interface code for you, it is in a
format which didnt suit the interactive nature of the system, therefore it was only used to set
the basic handles such as position and colour, whilst other handles such as call-backs were
coded by hand.
Having developed the interface first, it was then logical to develop the main functions, which
would be called by the user via the interface. There are two main functions: the Continuous
Wavelet Transform (CWT) and the Inverse Continuous Wavelet Transform (ICWT).
This section describes the main coding developments that were undergone during the coding of
the Wavelet Learning Tool. By no means is this a fully comprehensive description of all the
coding, as it does not include full details e.g. of global parameters or handle properties. To see
a full development log, see appendix C.
See Appendix C for the software development log
7.3.1 Coding the CWT
The requirements state that the user must be able to compare the effects of using different
wavelets with the CWT. The interface contains pop-up menus, which contain a list of the
different wavelets available for the computation. The main job of the CWT function is to
calculate the CWT coefficients at each scale of the wavelet transform and to plot these into a
CWT matrix. Chapter 3 described how this matrix could then be used to produce a scalogram
of the CWT by squaring each coefficient independently. The scalogram will have time on the
x-axis and scale on the y-axis.
There are three separate CWT functions, one for each wavelet (Gauss, Morlet and Sombrero).
Each calculates the CWT matrix and sets this as a global variable. The CWT matrix is
calculated in the usual way by changing the shape of the wavelet at each scale of the
transform. The CWT functions first calculate how many scales to compute depending on the
length of the signal. Re-calling from chapter 3, as the scale value increases, the frequency
decreases and therefore the wavelet needs to dilate. So the user can see the final shape of the
wavelet, the CWT function calculates the largest scale first and then compresses the wavelet
until the scale=1. The different shapes of the wavelet are stored in another matrix, which is
also set as a global variable for other functions to use.
Software Development
Page 31
When the user selects a wavelet from a pop-up menu either the function waveselecta or
waveselectb is called depending on which pop-up menu is executed. The waveselcta and
waveselctb functions are the main functions in the WLT program. These functions control all
the data handling and graphics handling of the system when a new CWT is calculated. Each
function controls its own part of the system, either A or B, which corresponds to which pop-up
menu is selected. The interface is split into A and B to allow for the side by side comparisons.
Both functions were developed simultaneously as they both contain similar functionality. The
functions were carefully developed to provide the following sequence of operations
The function reads which wavelet has been selected,
then calls the appropriate CWT function.
(The CWT function calculates the CWT matrix and matrix of wavelet shapes see above)
A graph is animated with the different forms that the wavelet takes at each scale of the CWT.
The function then presents the CWT matrix as a scalogram.
The scalograms cursor is drawn onto scale number 2.
The PlotCWT function is called.
The above list gives a summary of the functionality within the two main functions of the
system, namely waveselecta and waveselectb. These functions were the first to be developed
after the coding of the CWT function, as there needed to be a way of calling the function with
different arguments.
The summary states that after the displaying of the scalogram, the main function then calls a
function called PlotCWT. This function plots a graph of the CWT coefficients from a selected
scale of the scalogram. The scale is selected by the cursor and, as the cursor is re-drawn after
the construction of a new scalogram, the CWTPlot function needs to be called to update the
plot. The CWTPLot function is also called every time the cursor is moved, to update the plot in
real time.
Figure 7.3.1.1
Figure 7.3.1.1 shows the sequential function calls that form the system for the whole CWT
process, which is executed every time a user selects a wavelet from one of the pop-up menus.
POP-UP MENU
A
EXECUTED BY
USER
WAVESELECTA
FUNCTION
CWT
FUNCTION
PLOTCWT
FUNCTION
1
2
3
4
Creates CWT
matrix and
Wavelet
shape matrix
Plots CWT
coefficients at
selected scale
Animates graph of
wavelet shapes.
Plots scalogram and
cursor. (after CWT
function call)
Software Development
Page 32
7.3.2 Coding the Inverse CWT
This section describes the task of re-synthesising a signal from a scalogram, which has been
altered by removing certain scales. To do the re-synthesis, you need an inverse CWT function
that will take its data from the scalogram, which is set as a global variable, and use this to
calculate a new sound signal.
In order to allow a user to remove scales from a scalogram to his or her own discretion, a
system was added to the interface, which let the user input the scale numbers with which to
remove. The user enters into two edit boxes the scales to remove from and to and presses a
button to execute this. Pressing the button calls a function called remove which simply reads
the CWT matrix, which is a global variable, sets the appropriate lines to zero and then re-
draws the scalogram. The function then re-assigns the global CWT matrix to the matrix with
the appropriate lines set to zero, which can then be accessed by the Inverse CWT.
Figure 7.3.2.1
The Remove scales interface
So users can alter scalogram A and B differently to compare the effects of different frequency
filtering techniques, the interface allows you to select which scalogram to alter. Because of
this, there needed to be two separate global CWT matrices corresponding to the two different
scalograms.
The initial interface design at the beginning stages of software development didnt
accommodate for removing scales and producing the Inverse CWT. This is because it was
envisaged that there would be a more interactive way of removing the scales i.e. by using the
cursor. However, the approach adopted was chosen due to the ease of its use and speed of
removing the scales. An attempt at the alternative approach of using the cursor slowed down
the system significantly.
The Inverse CWT function is called by two buttons, one for each altered scalogram. The
function then retrieves the corresponding CWT matrix depending on which button called it.
The Inverse CWT function is then executed and a plot of the re-synthesised signal is produced
on a new signal axis.
7.3.3 Input error recovery
Many measures took place during software development to insure that the system either
doesnt allow for input error i.e. using the enable handle, or to insure that the system can
recognise when an input error has occurred. Here are two of the measures introduced.
Entering non-integer values into edit boxes.
Because scales are calculated at integer values, it makes no sense to enter a non-integer scale
number to remove from a scalogram. Therefore, the number entered is round to the nearest
integer. If the integer is then negative or zero, the scale number is set to one, and the global
variable is changed accordingly.
Software Development
Page 33
Loading a file with extensions which arent wav, au or snd
The system reads file extension and decides whether it is one of the above. If not, the system
brings up a dialogue box informing the user that the file cant be loaded. The system then
returns to the state it was previously in.
7.4 Development problems
Throughout the development of any software, there will always be problems and challenges
that the software developer will encounter. Most of them just requires some clever piece of
coding, whereas, others require a drastic re-think of the structure of the software. Below are
two problems. The first describes a problem, which lead to large amounts of code being
altered. The second problem is a prime example where just a few lines of code can solve a
serious problem.
7.4.1 Surf vs Imagesc
Matlab provides two main functions for displaying a matrix, surf and imagesc. The software
had been originally developed using the surf function to display the spectrograms, as this
seemed the natural choice for displaying a matrix clearly. However, the system was re-written
to use the imagesc function due to the following reasons.
Figure 7.4.1.1
Figure 7.4.1.1 shows the graphical representation the two functions give for the matrix shown.
The first thing that is noticeable is that the surf function has one less column and one less row
than the matrix and the imagesc image. This is surprising and is due to the fact that it
calculates the image by producing a plot of the matrix first, 3-dimensionaly. The image
produced is that graph viewed from above. Therefore, the first lines are missing due to the fact
that they fall on the x and y axes of the graph. Imagesc is simply an image of the values in the
matrix.
Another difference that needed to be understood is that the surf image is in fact a horizontal
flip of the actual matrix. Figure 7.4.1.2 shows this fact.
When realising these problems, surf still looked the best quality image. The last 2 figures show
how surf produces a much cleaner image, and would therefore be more suitable for the tool.
However, it wasnt until further into the development that the biggest problem arose. There
can be two surf images on screen at any one time due to the side by side comparison
requirement, the problem was that the system couldnt cope with the amount of memory that
was needed to surf two large matrices. Surf is a very uneconomical function when it comes to
SURF IMAGESC
1 2 3 4 5
2 4 3 2 1
3 4 5 6 3
0 0 3 4 3
1 2 3 4 5
2 4 5 3 2
4 5 6 5 3
THE MATRIX
VS
Software Development
Page 34
Figure 7.4.1.2
memory allocation; as a consequence, the system became extremely slow and frustrating. This
meant that the system had to be re-coded to accommodate for the imagesc function. As
detailed above, this involved flipping matrices and re-allocating x and y data for the axis.
7.4.2 The disappearing cursor
During the development of the Wavelet Learning Tool, it was decided that it would be very
beneficial if the user could control the number of scales that the system used during the CWT
process. Increasing the number of scales would mean that the CWT matrix would have more
rows and therefore, the scalogram would look clearer. Another advantage would be that the
user could perform a more defined frequency filtering operation on the original signal. If there
were a larger choice of scales that could be removed, then the user would be able to select the
frequencies to remove more carefully.
To introduce the option of increasing or decreasing the number of scales used, an edit box was
introduced to the interface that allowed users to choose a multiple of scales. The CWT
function would calculate the minimum number of scales needed and then multiply this number
by the number chosen by the user.
The system uses a different numbering system to the one shown by the interface. To make
programming easier for the cursor, line numbers are used instead of scale numbers in the
background of the system. Looking at the scalogram, the bottom row is called line one,
whereas this is the maximum scale number, you can think of line numbers being opposite to
the scale numbers. The problem occurred when a user selects to reduce the number of scales
on the scalogram and the cursor is lying on a line number which doesnt appear on the new
scalogram. The following figure shows the problem.
Figure 7.4.2.1
The result was that the cursor simply disappeared. The problem was eventually solved by
coding the system to always move the cursor down to line two (so it is clearly visible) every
time the user changes the number of scales via the edit box on the interface.
Scalogram with 22 scales
Line number = 18
Scale number = 5
?
Scalogram with 11 scales
SURF OF FLIPPED MATRIX IMAGESC OF ORIGINAL MATRIX
Software Development
Page 35
7.5 Development of the Subband Learning Tool
Because the main system being developed is the Wavelet Learning Tool, this chapter has been
dominated by the development of this system, and because it was the most challenging system
to develop. This small section details the steps taken to develop the Subband Learning Tool
that will demonstrate to students the different stages in the Subband coding process.
Figure 4.3.1 on page 19 shows the Subband coding process as a series of high and low pass
filters. Each stage in the process reduces the number of samples in the signal by half. The tool
shows the result of each stage of the coding scheme by plotting a graph of the down-sampled
signal, which are represented by red arrows in the figure.
All that was needed for the system was a function for calculating the DWT. This function
stored all the stages of the signal in to one long vector. The system would then select the
appropriate values from the vector as the user scrolls up and down the different stages of the
process.
The system provides 3 axes. The first constantly shows the original signal before the DWT
transform. The next two axes show the down sampling of the signal. The top axes always
shows the signal before the downsampling, and the bottom axes always shows the result of the
downsampling. The user can use scroll buttons to scroll through the different sub-samplings to
get a feel for what the process involves.
7.6 Screen Shots
The Wavelet Learning Tool
Software Development
Page 36
The Subband Learning Tool
7.7 Functionality of the Wavelet Learning Tool
Menu Bar You use this to load in a signal to be processed and also to close down the tool.
Each time a new signal is loaded into the tool, the Original Signal Graph is updated and all the
windows and pop-up menus are reset to their original settings, i.e. blank or none.
The Animated Wavelet Viewers Each time a new wavelet is chosen from either pop-up
menu, the corresponding wavelet viewer will then show the different stretches and
compressions the wavelet goes through during the continuous wavelet transform.
The Pop-up Menus Gives the user a choice of wavelets to study.
Show All / Show Steps options This enables the user to see the different stages of the
construction of the scalogram being constructed if he/she wishes to do so. It basically pauses to
show the image of the scalogram as each scale is added. Very useful to visualise the CWT
coefficients at lower frequencies, which may not have previously been visible due to the fact
that they have a lower value.
The Scalograms This scalogram is produced every time a wavelet is selected from a pop-up
menu. The image produced depends on two factors The wavelet chosen and the number of
scales selected in the Options Menu. The Scalograms also have a scrolling cursor where the
user can select different scales and the tool automatically update the CWT Graph to show the
selected data.
Original Signal Graph This is updated every time a signal is loaded into the tool. It shows a
time domain representation of the signal. This graph can be zoomed into using the Zoom
Controls next to the CWT Graph by selecting the Zoom Original Signal Option. If this is
selected, the original signal will be zoomed to match the zooming of the CWT Graph.
New Signal Graph This graph is plotted when the Process Buttons are pressed. It gives a
plot of the re-synthesised signal produced by the Inverse CWT function. This function reads
the data from the scalogram and uses it to reproduce the signal. The user can remove lines
Software Development
Page 37
from the scalogram by using the Alter Lines Options, which will change the result of the new
signal. Users can compare the original and new signals by playing back the sounds as well as
seeing the difference visually. Like the Original signal, this graph can be zoomed into using
the Zoom Controls next to the CWT Graph by selecting the Zoom New Signal Option. If this
is selected, the new signal will be zoomed to match the zooming of the CWT Graph
Process Buttons These buttons call the Inverse CWT and will update the New Signal Graph.
There are two buttons depending on which scalogram you wish to read the data off.
Alter Lines Options The user can use the edit boxes determine which scales of a selected
scalogram are to be removed. This is done by effectively setting all data points on that line of
the CWT matrix to zero. This tool enables users to see the effects on the signal of removing the
CWT at certain scales. The edit boxes automatically update when the user changes the number
of scales option. This is due to the fact that the scalogram may have fewer lines than the
numbers entered into them. The user isnt allowed to enter any numbers greater than the
number of lines or a number less than 1. Also, the user cant have a from value greater than a
to value.
Options Menu Here, the user can select the number of scales used during the CWT
computation. When a signal is loaded, the system calculates the number of scales needed for a
CWT computation based on the length of the signal. The user can then select multiples of
scales to produce a clearer scalogram image. This can also be used so the user can achieve a
more detailed frequency analysis.
Zoom Original / New Signal These are check boxes that the user can select so the Original
and New graph plots are updated every time the user zooms in or scrolls the CWT Graph. If
the user selects one of these after the CWT Graph has been zoomed already, then as soon as
one of these check boxes is selected, the corresponding graph automatically updates to
correspond to the scale on the CWT Graph.
Zoom Buttons These are used to zoom in on the CWT Graph, and also the Original and
New Signal graphs if the user desires. The user can also scroll along the graph and also refresh
the graph to show the whole scale.
CWT Graph This updates every time the user moves one of the cursors on either scalogram.
It recognises which scalogram has been selected and plots the appropriate line.
Software Testing
Page 38
8 : Software Testing
8.1 Motivation
This chapter begins with a paragraph from a book on Software Testing, which summarises the
approach and motivation for the rest of this chapter.
When asked to give a reason for testing a computer program, typical programmers respond,
To see if it works. In practice, the notion of a working program is a complex one which
takes into account not only the technical requirements of the programming task but also
economics, maintainability, ease of interface to other systems and many other less easily
quantifiable program characteristics. [D 1987]
In summary, testing needs a lot of planning and care to make sure many characteristics of the
software are tested. It is important that the system works correctly, especially as the tools
that have been developed are to be used as a Computer Assisted Learning Tool. The system
has to behave correctly and produce the correct outputs if students are to trust the system.
But what is testing?
There is a formal British Standard definition of software testing (BS7925 Part1 of 1998) which
describes software testing as follows
testing is the process of exercising software to verify that it satisfies specified requirements
and to detect errors
At the start of the development of the Wavelet Learning Tool, a client-developer scenario was
set up to clarify all the requirements that the system needed to satisfy (see page 24) and this
formed the specification of the system. The specification also includes the intended behaviour
of the system. The specification has a new role here as testing involves selecting appropriate
test cases and producing outputs from the system, whether it is visual or not, and then
comparing them with the specification of the system to see if the expected output matches with
the actual one from the system (see figure below).
Figure 8.1.1
Testing for Correctness [D 1987]
PROGRAM
MACHINE
TEST
DATA
SPECIFICATION
OR
KNOWN
INPUT /
OUTPUT
COMPARE
OUTPUT ?
Software Testing
Page 39
8.2 Functional Testing
The testing method that is used in this Dissertation is one of functional testing. The basic idea
is that programs can be viewed as a collection of functions, which are developed from other
pre-written functions. The theory says that any faults in the system are due to the faults in the
development from one function, which is known to be fault free via testing, into a new
function. This technique is well suited to programs developed in Matlab due to its plug-in
approach to programming. During the development of the Wavelet Learning Tool, functions
were created and tested independently and were then plugged in to the system. Functional
testing will test the actual connections between these independently developed functions.
The Functional Testing approach assumes that the user knows nothing about the internal
operations (the coding) of the system and testing is solely concerned with finding out when the
input-output behaviour of the program does not agree with its specifications. This is often
referred to as black-box testing because the testers cant see the internal workings of the
system.
Reasons for choosing Functional Testing
The testing method forces the tester to forget about how the system was coded. This
prevents the programmer from choosing inputs that he/she knows will avoid error in the
system.
As no knowledge of the construction of the system is needed, other people other than the
programmer can test the system. This also avoids the programmers subconscious
tendency to choose nice inputs. The more people you have to test the system, the quicker
the testing and the greater the chance that the system will be tested exhaustively.
Since the system was developed using MATLAB, most syntactical errors are detected
using the debugging tools within it.
The system is made up of several different functions which can be called at different
intervals i.e. move cursor A, zoom-in etc. Functional Testing is needed to test the systems
responses to switching from one function to the other.
You can use a hybrid of functional testing techniques in order to test all characteristics of
the system.
The next section shows a step by step account of how the Wavelet Learning Tool was tested
using several techniques, which are common to Functional Testing.
8.3 Testing the Wavelet Learning Tool
Due to the nature of the Matlab programming Language, each function of the system was
independently tested. After the completion of each function, i.e. the CWT or ICWT, samples
of randomly selected test cases were tested on the functions to see if the outputs matched the
expected inputs. Similarly, when a new function was written that required user interaction i.e.
moving a cursor, the test cases were simply to interact with the function.
What wasnt thoroughly tested during development was the movement from one function to
another, for example, move a cursor and then remove a scale. The following sections describe
this necessary testing of the system as a whole.
To accommodate all the possible errors that could occur in the system, several different
techniques were used to test it, namely, random testing, testing structural synthesis and the
category-partition method.
Software Testing
Page 40
8.3.1 Random Testing
This is the simplest method of testing a system, and can be very effective. Four candidates
were selected who had no previous knowledge of Wavelet Theory and had not seen the system
in its development stages. The candidates were asked to randomly select inputs to the system
and to record any unexpected activity onto a log sheet. The log sheet recorded the sequence of
inputs together with the unexpected outputs. These sequences were then traced through the
program to try to identify the fault in the code.
Looking at Figure 8.3.1.1, there were 2 errors detected by random testing. The fault from the
second error was easily identified. The Process A button, which is used to calculate the Inverse
Continuous Transform with Wavelet A, was still enabled when the Wavelet A menu had been
reset. So all that was needed to correct the error was the line
set(ud.PushProcessA,Enable,off);
in the part of the code that is called when none is selected in the appropriate wavelet pop-up
menu.
The first error was a global variable error, because the zoom controls needed to know which
line of the scalogram was being shown in the CWTPLot window.
There have been strong disagreements about the value of Random Testing and it has been
considered to be the poorest test case design in design methodology. [D 1987] But there is
strong evidence above that show it is very useful for identifying errors that may not have been
picked up by a more formal approach.
Figure 8.3.1.1
Scanned In section of a Log Sheet
Software Testing
Page 41
8.3.2 Testing Structural Synthesis
Section 8.2 describes how functional testing tests the connections between the functions in the
system. To test the Wavelet Learning Tool, a study into how the functions are linked in the
system was established by understanding that all the functions in the system were linked by
Structural Synthesis. In structural synthesis, functions are joined together into graph-like
structures that describe the sequences in which they should be executed. Failures correspond to
wrong sequences of functions or to wrong transmission of data between one function and
another. [H 1987]
In order to understand the structural relation between the functions in the system, a technique
was sought to construct these graphs which show the links or data flows between the functions
to be tested.
Sequential Dependency
To enable a graph to be constructed showing allowable transitions between the functions in the
system, a good starting block is to look at the sequential dependencies between the functions.
This is where a function can not be instantiated without the calling of an earlier function first.
An example of this is that you cant select a wavelet from a menu in order to calculate a CWT,
without having loaded a signal into the system.
Figure 8.3.2.1
Graph showing Sequential Dependency
This sequential Dependency technique was inspired by the Task Modelling syntax used in the
Open Toolbox of Techniques [S 1998]. Even though Task Modelling is mainly used as part of
the software development stage in the software life-cycle, it can also be used in the testing
stage to test the transitions between functions.
In order for the system to function correctly, it is vitally important that these sequential
dependencies are obeyed, otherwise the system will crash.
These sequential dependencies are controlled by the enable function used in Matlab to
prevent buttons or menus being selected out of sequence. Every button, cursor, menu, editor
etc. in Matlab has an option to be enabled or disabled to control this. During the development
of the Wavelet Learning Tool, this enabling function was introduced as each function was
IDLE
Load Sig
Choose
Wavelet B
Choose
Wavelet A
Zoom
Controls
Remove
Scales in A
Move
Cursor B
Move
Cursor A
ICWT
of A
ICWT
of B
Remove
Scales in B
Software Testing
Page 42
developed, but it is easy to forget to include one or two due to the complexity of the system, so
these were tested at this stage.
After testing the sequential dependency of the system, the testing concentrated on the other
transitions between the functions.
Function Transitions
The next stage in testing the Wavelet Learning Tool is to consider all the other transitions that
link all the functions identified in the previous section.
In order to construct a graph of transitions for the entire system, it is less complicated to try
and model each wavelet section (A or B) seperately and then model the interactions between
them.
Here is the graph for using Wavelet A.
Figure 8.2.2.2
These transitions dont have sequential dependency but may have weaker conditions attached
to them. These conditions are represented by condition statements commonly used in UML
e.g. [Wavelet none].
These conditions often occur when sequential dependencies occur after a period of time. For
example, looking at the above figure, you are allowed calculate the ICWT of a wavelet after
you have moved the cursor A because you may have already traversed the Remove Scales
function. The condition notation makes sure that the Remove Scales function has already
been traversed, otherwise you cant traverse the arrow.
Even though figure 8.3.2.2 shows the transitions between states that are used when using
Wavelet A, the graph for Wavelet B is identical as they both provide the same operations. The
interactions between the two parts are modelled later.
As you can see in the figure, you can move to the Choose Wavelet A state from any other
state except the idle state. This is also the case with the Load Sig. state. These are the most
important transitions in the system as these reset the systems user interface, global variables
and user behaviour. It is these transitions that need the most testing because, if these transitions
dont perform properly, then all subsequent transitions will behave abnormally.
IDLE
Load Sig
Choose
Wavelet A
Zoom
Controls
Remove
Scales in A
Move
Cursor A
ICWT
of A
[Removed
Scales in A =
true]
[Removed
Scales in A =
true]
Software Testing
Page 43
To test these transitions, a list was made that describes all operations that the system has to do
when entering the Choose Wavelet A and Load Sig. states.
Choose Wavelet A/B states (not choosing none as an option)
Set Process A/B button to be disabled
Re-animate Wavelet A/B window
Re-plot Scalogram A/B
Re-plot CWTPlot axes
If Wavelet B/A = none
{set PlayNew button to be disabled
blank out ICWT axis}
Choose Wavelet A/B states (choosing none)
Set Process A/B button to be disabled
Set Remove Scales of A/B Radio Button to be disabled
Set Recompute A/B to be disabled
Blank Wavelet A/B and Scalogram A/B axes
If CWTPlot axis is showing a scale fom Wavelet A/B
then blank the CWTPlot axis
If Wavelet B/A is also set to none
Read from list below
Load Signal state
Disable the following Recompute A and B buttons, Zoom New Signal checkbox, All zoom
controls, All remove scale controls, All Reprocess ICWT buttons.
Blank the axes of Both Wavelet Windows, Both Scalograms, CWTPlot axes, ICWT axes.
As well as performing these visual operations, the system needs to alter the global variables
that these GUI objects use. If these are not altered correctly, further testing will reveal these
faults in the system.
Having tested these important state transitions, the other transitions on the graph in figure
8.3.2.2 also need to be tested exhaustively to see if the systems output is what is expected.
Now the state transitions occurring in the separate Wavelet operations have been tested, it is
now important to test the situations where the user will alternate between using the two
different wavelets. The system has to carefully swap between the global variables of one
Wavelet system to the other without confusing them. Figure 8.3.2.3 below shows all allowable
state transitions between the two sets of states.
Again, to fully test the system, all possible transitions must be tested and, where allowable, in
both directions. In this diagram, the red arrows are ones that have a condition attached to them,
which have been omitted to make the diagram less complicated. All the conditions have the
same type of relation, that is they are all of the type [Remove Scales in B = true]. That is to
say that you can only traverse the arrow if the arrows destination has had Scales removed. For
example, you cant compute the ICWT of A if A hasnt had any scales removed from the user.
That concludes the testing by Structural Synthesis. The next section describes the last testing
procedure, which is used to test user input to the system.
Software Testing
Page 44
Figure 8.3.2.3
8.3.3 The Category-Partition method
This testing method doesnt test the transitions between the functions, but the allowable inputs
to the functions individually. The parts of the system that need to be tested are those where the
user inputs some data at his or her discretion i.e. which scales to remove from the Scalograms.
During development, it was recognised that the free role of the user needed to be restricted in
some way in order to keep the system functioning normally. One such restriction recognised
was that the user couldnt input a value larger than the number of lines on the scalogram to
remove.
Due to the nature of the software, there are only a few areas where the user has a large input to
the running of the system. These form the Categories that are to be partitioned.
Removing Scales
Loading a Signal
No. of Scales (Options Menu)
The above Categories can then be partitioned into different areas of user input that need to be
tested seperately. These are..
Removing Scales
Number of Scales being removed
Which Scalogram?
Position of Scales
Loading a Signal
Signal Type
Signal Length
No. of Scales
Value
Choose
Wavelet
Remove
Scales in
Move
Cursor B
ICWT
of A
Choose
Wavelet
Remove
Scales in
Move
Cursor A
ICWT
of B
[Remove Scales in B = true]
[Remove Scales in A = true]
OR
Software Testing
Page 45
Each partition represents a separate area of the system that needs to be tested. Below gives
adequate values for each partition, which will fully test the system.
Removing Scales
Number of Scales being removed - None, One, Many, All
Which Scalogram? - Neither, A, B, Both
Position of Scales - From < 1, From = 1, From >1, To > No. Lines, To = No. Lines, To < No.
Lines
Loading a Signal
Signal Type - au, wav, snd, other
Signal Length - 0,1,>1,>4000
No. of Scales
Value - <1, 0, 1, >1
Each of these partitions is tested with the values given above, which are chosen so that they
attempt to cover all possibilities. To choose the values, you make valid assumptions about the
behaviour of the system. For example, it is assumed that if the system can cope with a value
>1 for no. of octaves, then it can cope with any of these values from 1 upwards.
8.4 Testing Summary
Section 8.3 described the many ways that the Wavelet Learning Tool was tested. Even though
the Subband software was also developed as part of this dissertation, because of its minimum
specification and lack of user input, it made sense to describe the testing processes with the
WLT instead. However, throughout the development of the Subband software, testing was
made to ensure that it met its specifications.
During testing, I found that the Wavelet Learning Tool became slow for long signals, or for a
too large amount of scales. However, this came to no surprise because in section 4.1, it was
noted that the CWT could be very slow due to the fact that the scale and transition variables
are continuous. Therefore, because both a larger signal and a larger number of scales means
that the transform takes more steps and therefore calculates more coefficients, the whole
process becomes slower. To avoid this, it was recognised that the DWT could be used instead,
but this wasnt used in the tool because we needed a CWT to calculate the scalograms (see
section 3.4)
Evaluation
Page 46
9 : Evaluation
The testing, described in the previous chapter, enabled any bugs that were in the software tools
to be detected, which could then be corrected appropriately. These bugs were as a consequence
of coding errors during development, which may or may not have been detected without
thorough testing. The testing investigated whether or not the functions in the software tools
worked correctly together without any failures. What needs to be investigated now is a test on
whether the system meets the requirements as a whole. It needs to be discovered whether or
not the software tools meet the requirements for a successful computer assisted learning tool.
The first step was to construct a questionnaire to collect the opinions from the types of people
who are likely to use the system, i.e. students.
9.1 Questionnaire Construction
To investigate whether the Wavelet Learning Tool would be successful as a CAL tool, a
questionnaire was constructed following certain guidelines on what questions should be asked
and what scales to use.
A questionnaire is a good tool for evaluating the goodness or badness of decisions made in
the course of the software development. For example, during development, it was decided that
edit boxes should be included to select which scales to remove from the scalograms. This
decision was made as it was thought that this method would be easier to use than any other
that could be developed in Matlab. The questionnaire will include a question on ease of use to
determine whether a decision like this one was a good or bad one. Another decision was what
colours were to be used in the interface, so a questionnaire could also assess this decision.
The questionnaire is being constructed with a specific goal in mind, whether or not the
Wavelet Learning Tool is appropriate for a CAL tool when complemented by a series of
lectures. The questionnaire should be an effective way of measuring this goal. In order to do
this, it is necessary to have more than one indicator or item as the measure of this concept.
Here, one of the indicators is a series of questions all investigating the effectiveness of the
functionality in the system; speed, ease of use, input error recovery, number of user
interactions, visual appearance
Another indicator is series of questions investigating the softwares potential as a CAL tool
and whether it could be used for research purposes.
The final indicator will be a free space for the questionnaire recipient to give any unrestricted
comments about the system.
In general, most questionnaires ask the participant to comment on certain aspects of a subject
area by providing responses to a series of questions. These responses are generally ordered on
a scale. Scales are used primarily in situations where the researcher needs to build a perceived
intensity into the questions. For example, if someone was asked to comment on the visual
appearance of a GUI then, if there was no scale, the answer may be nice, OK, colourful, etc..
However, if you ask a question where there is a restriction on the answer scale to certain
intensities, then a comparison becomes much more meaningful and efficient to evaluation. For
example, the responses could be restricted to one of five different choices.
The problem is, which scale is appropriate?
R. Likert designed the Likert scale in 1937. [H 1992]
There are five categories for responses: strongly agree, agree, undecided, disagree, strongly
disagree. The questions used with the scale either express a favourable or unfavourable
attitude. For example, The speed of the WLT is satisfactory gives a favourable attitude
Evaluation
Page 47
where as The WLT is difficult to use gives an unfavourable one. Likert described how the
scores given for the favourable answers are opposite to the scores given for unfavourable ones
and that there is an order or intensity structure to the responses.
This scale will make evaluation of the responses much easier as there are only a finite number
of responses to categorise.
See Appendix A for the full questionnaire
9.2 User Guide
In order to get the most accurate representation of students opinions; a User Guide was
written so that their responses were based on a good understanding of the operation of the
system. The guide describes the different functions available and how they are used to
investigate different aspects of the CWT. It also gives a few step-by-step exercises that the
students can try, to show them the systems capabilities and so they can get a feel for the GUI.
See Appendix B for the User Guide
9.3 Questionnaire Results
Ten people were surveyed using the questionnaire. The responses were put into percentages to
assess the strengths of the answers for each question. Each question is represented below
together with a pie graph of responses, which is a good visual representation of the
effectiveness of each area of the system.
The Speed of the WLT is satisfactory

80%
20%
Strongly Disagree Disagree
Undecided Agree
Strongly Agree
The WLT is easy to use

40%
60%
Strongly Disagree Disagree
Undecided Agree
Strongly Agree
Speed was chosen several times as the most
important factor in a CAL tool.
Everyone surveyed at least agreed that the speed
of the system was satisfactory. Only 20% strongly
agreed, so there may have been some room for
improvement.
Generally, the speed is satisfactory, but can be
slow if there is more than one scalogram on screen
at any one time, and especially if the signal is too
long or too many scales are being computed in the
options menu.
More than half of the students surveyed strongly
agreed that the WLT is easy to use. This is a great
result as the tool was designed as a Computer
Assisted Learning Tool, and means that users can
concentrate more on their learning than getting
the tool to work.
Generally, the tool is extremely easy to use, and
people should have little difficulty when asked to
use it.
Evaluation
Page 48
The WLT recovers well to input error

30%
70%
Strongly Disagree Disagree
Undecided Agree
Strongly Agree
The number of user interactions in the WLT is appropriate

30%
70%
Strongly Disagree Disagree
Undecided Agree
Strongly Agree
The visual appearance of the WLT is good

80%
10% 10%
Strongly Disagree Disagree
Undecided Agree
Strongly Agree
You find the WLT interesting

30%
60%
10%
Strongly Disagree Disagree
Undecided Agree
Strongly Agree
The WLT has research potential

50%
30%
10% 10%
Strongly Disagree Disagree
Undecided Agree
Strongly Agree
The WLT was developed with input error in mind
because a CAL tool must give accurate results
effectively.
70% of the students surveyed strongly agreed
with the statement that it recovers well to input
recovery. One student commented that he
attempted to crash the system by inputting non-
integer values into the edit boxes and was
pleasantly surprised when the system recognised
the error.
This simply explores whether the tool meets the
user expectation on the number of user
interactions. The tool meets all the functional
requirements set out at the beginning of
development and, by the survey result, this is
enough for an effective learning tool.
Although visual appearance is not the first thing
you think of during evaluation, it can play a vital
role in a CAL tool. The tool has to look visually
exiting in order for it to be interesting. Most
students agreed that the WLT is visually appealing
but not all.
The tool is colourful but the animation could be
better was one comment. The tool isnt highly
animated, as Matlab is restricted on what it can do.
This question explores the users initial interest in
the WLT. There is a range of responses, some
disagreeing with the statement, but more than half
agreeing. Some students may have been
uninterested due to their academic background. If
people arent interested in signal analysis, then
they are unlikely to be interested in the WLT.
Although the WLT was developed as a CAL tool,
for interest, this question was included in the
questionnaire. It could have been worded better as
the intention was to discover whether the tool
could be used to aid in research. The responses
were fairly inconclusive probably due to the
vagueness of the question.
Although the WLT could be used for a small
amount of research, it doesnt really provide a lot
of scope for thorough investigations.
Evaluation
Page 49
The WLT will complement a series of lectures on Wavelet Theory well

20%
80%
Strongly Disagree Disagree
Undecided Agree
Strongly Agree
The questionnaire was a valuable tool for evaluating the effectiveness of the WLT as a CAL
tool. The WLT is both quick and easy to use and will complement a series of lectures well.
9.4 Evaluation Summary
The Wavelet Learning Tool was developed as a Computer Assisted Learning (CAL) tool to
enable the successful teaching of the theory of wavelets and their transforms. The above
questionnaire evaluation details the success of the tool as it succeeds in being quick, easy to
use, user friendly with input error recovery and fairly aesthetically pleasing to look at. But the
main area of success, which is extremely important in a CAL tool, is the fact that it calculates
the wavelet transforms accurately. Students can have faith in the system in that what they ask
the system to do is calculated accurately, efficiently and displayed in the best possible way.
The tool is portable, so can be accessed on many different platforms i.e. Windows 95,98,NT,
Unix, which greatly benefits the students who wish to access the system from home or in a
computer lab.
9.5 Evaluation of the Subband Learning Tool
The Subband Learning Tool was developed to show the different stages in the subband coding
scheme. It had very few requirements as it only had to show the results of this process. The
tool does this effectively and accurately and can be used as a CAL tool to teach students the
process involved. The software was simply tested by exhaustive testing, as there are only a few
functions that make up the tool.
The tool also shows how efficient the DWT can be compared to the CWT. If you load in a
signal that has too many samples into the Wavelet Learning Tool, the system slows down
significantly due to the fact that the CWT calculates every coefficient. However, the Subband
Learning Tool can cope with signals of a large length as it reduces the sampling rate at each
scale.
The tool can be used to break down a signal from the time domain into the frequency domain
as the signal is split up by a series of high and low pass filters. However, a visual
representation of this process doesnt give a clear and well-understood representation of the
frequencies in the signal, which reduces the tools effectiveness as a CAL tool.
9.6 Future Work
Due to the scope of wavelet theory, it is impossible to include all of it in one dissertation.
There are many areas of wavelet theory that havent been explored here and could be used to
enhance either the understanding of the process involved or improving the actual tools
developed. Many texts go into the theory of orthogonal wavelets. Areas like these ones are
This is the most valuable of all the questions. It
assesses whether the tool would be suitable for the
task it was developed for.
80% of the students surveyed strongly agreed that
the tool would complement a series of lectures.
Evaluation
Page 50
examples of advanced wavelet theory which, with more time, are definitely worth
documenting.
The dissertation goes into little detail of how someone could actually create his or her own
wavelets for the wavelet transforms. An extension to the Wavelet Learning Tool could be to
allow students to create their own wavelets using the formula for the mother wavelet, and then
use their own wavelets on the system to see the effects they have.
The main software development for this dissertation was the Wavelet Learning Tool.
However, the second system developed was the basic Subband Learning Tool to show the
different stages of the Subband coding scheme process. With more time, this system could
have more functionality to show a more animated representation of the processes involved.
The system could show the filters used and the process of downsampling in real-time.
Conclusions
Page 51
10 : Conclusions
Both the continuous and discrete versions of the Wavelet Transform were explored and fully
implemented. It has been shown that both can be used to successfully analyse the frequencies
in a signal and be programmed in such a way that a user can learn about them.
The dissertation successfully documents the history behind wavelet theory, paying particular
detail to the reasons for needing a new transform due to the inefficiency of the Fourier
transform on continuous signals. The wavelet transforms were discussed in detail, their
mathematical formulas have been given and their results have been shown graphically. For
each transform, it has been proved that a signal can be transformed from the time domain into
the frequency domain without loss of time or frequency information. The multiresolution
problem that occurs all too often in the Fourier transforms has been solved due to the
discovery of these new wavelet transforms.
Two software systems have been designed, developed, tested and evaluated throughout this
dissertation. The Wavelet Learning Tool (WLT) has great potential to become an extremely
useful tool in the teaching of wavelet theory. It combines all of the theory discussed in the
dissertation and gives a graphical, interactive view of what is involved. The WLT allows
students to see the effects that different wavelets have on the continuous wavelet transform of
a signal. The wavelets are animated so that the user can see the different shapes it takes during
the transform, and the result is displayed as a scalogram. Users can then remove scales from
the scalogram to compute a re-synthesised signal to see the effects of their frequency filtering.
The tool does everything that it set out to achieve and has been thoroughly tested using a
combination of functional testing techniques. Students filled out a questionnaire to evaluate the
tool. They gave a positive response to many aspects of the tool, including speed, ease of use,
and input error recovery.
The other software tool developed is the Subband Learning Tool. This was produced to show
students the process of Subband Coding. The dissertation introduces Subband coding as a
technique used to calculate the discrete version of the wavelet transform and gives evidence
for the advantages a discrete transform over a continuous one.
Comparing the two pieces of software, it is evident that the discrete version of the transform is
less time consuming and more economical than the continuous version. The Wavelet learning
tool can only accept signals of a small length, whereas the Subband Learning tool can accept
signals containing a large amount of samples. The Wavelet Learning Tool was developed to
show users how a signal can be broken up into its frequency components. Working through the
software, it is possible to perform high-pass low-pass and band pass frequency filtering
operations on the signal and hear the effects they have on the re-synthesised signal.
References
Page 52
References
[A 1996] Subband and Wavelet Transforms Design and Applications Ali N. Akansu and
Mark J.T. Smith
[B 1998] Wavelets and Wavelet Transforms A Primer C. Sidney Burrus, Ramesh A
Gopinath and Haito Guo
[C 1990] Fourier Methods Mark Cartwright
[C 1999] Interactive explorations in speech and hearing Martin Cooke and Guy J. Brown
[D 1987] Software Testing and Evaluation Demillo, McCracken, Martin and Passafiume
[D 1992] Ten Lectures on Wavelets Ingrid Daubechies
[G 1995] An introduction to Wavelets Amara Graps
[H 1987] Functional Program Testing and Analysis William E. Howden
[H 1992] Social Research Methods Richard M. Hessler
[H 1995] The world According to Wavelets Barbara Burke Hubbard
[ICASSP vol2 1995] ICASSP 1995 Volume 2 Paper Title: Learning Signal Processing
Concepts And Psychoacoustics In The QuickSig DSP Environment Matti
Karjalainen and Martti Rahkila
[K 1996] Hypermedia Learning Environments Piet A. M. Kommers, Scott Grabinger and
Joanna C. Dunlap
[M 1993] Wavelets: Applications and Algorithms Yves Meyer
[P 1996] The Wavelet Tutorial (website) Robi Polikar
www.public.iastate.edu/~rpolikar/WAVELETS/
[R 1991] Wavelets and Signal Processing Olivier Rioul and Martin Vetterli
[R 1998] The Matlab Handbook 5 Darren Redfern and Colin Campbell
[S 1998] The OPEN Toolbox of Techniques B Henderson-Sellers, A J H Simons and H
Younessi
[V 1995] Wavelets and Subband Coding Martin Vetterli and Jelena Kovacevic
Appendix A
Page 53
Appendix A
THE WAVELET LEARNING TOOL
COMPUTER ASSITED LEARNING - EVALUATION SURVEY
The Wavelet Learning Tool (WLT) is now a complete package, which enables users to enhance their
understanding of the theory of Wavelets and their Transforms.
To evaluate the effectiveness of this software, this survey is being conducted by a selection of
individuals who have no prior understanding of Wavelet Theory but have encountered a Computer
Assisted Learning (CAL) tool before.
Whether your prior experiences with a CAL tool have been positive or negative, please try and give an
unbiased perspective of how the WLT tool can support a series of lectures on Wavelet Theory.
Please read the short guide on the use of the tool before you complete the following sections.
Thankyou.
1. Functionality
The Speed of the WLT is satisfactory
STRONGLY
DISAGREE
DISAGREE UNDECIDED AGREE STRONGLY
AGREE
The WLT is easy to use
STRONGLY
DISAGREE
DISAGREE UNDECIDED AGREE STRONGLY
AGREE
The WLT recovers well to input error
STRONGLY
DISAGREE
DISAGREE UNDECIDED AGREE STRONGLY
AGREE
The number of user interactions in the WLT is appropriate
STRONGLY
DISAGREE
DISAGREE UNDECIDED AGREE STRONGLY
AGREE
The Visual Appearance of the WLT is good
STRONGLY
DISAGREE
DISAGREE UNDECIDED AGREE STRONGLY
AGREE
Which of the above is most important to you? ____________________________________
2. Usage
You find the WLT Interesting
STRONGLY
DISAGREE
DISAGREE UNDECIDED AGREE STRONGLY
AGREE
Appendix A
Page 54
The WLT has research potential
STRONGLY
DISAGREE
DISAGREE UNDECIDED AGREE STRONGLY
AGREE
The WLT will complement a series of lectures on Wavelet Theory well
STRONGLY
DISAGREE
DISAGREE UNDECIDED AGREE STRONGLY
AGREE
3. Other Comments
With your previous experiences with a CAL tool, what was the biggest problem
you had?___________________________________________________________________
Does WLT have that problem? ________________________________________________
Other Comments..
Appendix B
Page 55
Appendix B
T TH HE E W WA AV VE EL LE ET T L LE EA AR RN NI IN NG G T TO OO OL L U US SE ER R G GU UI ID DE E
The Wavelet Learning Tool (WLT) enables you to explore the many applications of the
Continuous Wavelet Transform (CWT). You can interactively explore the transform by
seeing and hearing the way it analyses a signal.
The CWT is a valuable device in signal processing as it analyses a signal, loaded
from the file menu (1), and converts it from the time domain into the frequency
domain. The main difference between this transform and the Fourier Transform is that
it does this frequency analysis without any loss of time or frequency resolution. With
the Fourier Transform, you either get one or the other. The tool displays the result of
the frequency analysis in the form of a Scalogram (7), this is similar to a spectrogram
in Fourier analysis, where time is along the bottom and frequency is up the side.
The tool allows you to compare the effects of using different wavelets to compute the
CWT (4). The wavelet is the analysis window with which each CWT coefficient is
calculated. Unlike in the Short Term Fourier Transform, this wavelet window
compresses and dilates to calculate different lines (scales) in the scalogram and this
is visualised in the animated wavelet window (6).
The tool also allows you to plot the CWT coefficients at a certain scale on the
scalogram by selecting a line using a cursor. This plot is shown on the bottom axis (9).
There are zoom controls to get a closer look at these coefficients, and there is the
option to change the original signal plot (2) and the plot of the re-synthesised signal
(13) so that their scales match those of the zoomed plot of the CWT coefficients (3).
The remove scales options (11) allows the user to actively remove any scales from a
selected scalogram. The user can then analyse the effects of removing certain
frequencies by re-synthesising the signal with the altered scalogram (12). This re-
synthesised signal is plotted on the new signal axis (13).
Before selecting a wavelet to do a transform with, you also have the option to show
the construction of the scalogram step-by-step by selecting show steps (5). In this
1
2
8
4
5
6
7
3
9
10
11
12
13
Appendix B
Page 56
way, the user can see the pattern of the smaller CWT coefficients before they become
too dark due to any larger coefficients higher up the scale. The re-compute button (8)
is also useful for refreshing a scalogram after it has been altered using the alter scale
options.
As you can see, the WLT is split up into two wavelet areas A and B. In this way, users
can compare the effects of using two different wavelets. It could also be used to
compare different frequency filtering techniques i.e. you could do a high-pass filter on
A and a low-pass filter on B then, using the re-processing controls (12), you can hear
the effects they have. The tool will act appropriately when you want to change
between different wavelets.
The No. of scales option lets the user control the number of scales taken during the
CWT. In other words, the number of times the wavelet changes shape. Doubling this
parameter (4) doubles the number of scales on the scalogram. It effectively improves
the clarity of the scalogram. When altering this option, there is no effect until re-
compute is pressed or another wavelet has been selected.
Here are two exercises, which demonstrate what the WLT can do.
Exercise 1
1. Load in signal lowhigh.au. Play it, what do you hear?
2. Select the Morlet wavelet from the Wavelet A pop-up menu. The CWT
computation starts automatically.
3. Select the same wavelet for wavelet B. This time you could tell the program to
show steps.
4. Move one of the cursors up and down over the scalogram. What do you notice
about the CWT coefficients?
5. Move the cursor onto line 15 and zoom in on it. Compare with the original plot of
the signal by selecting the appropriate check box. What do you notice?
6. Press the refresh button on the zoom controls.
7. Using the remove scales options, remove scales 1-5 and 11-44 from scalogram A,
and scales 1-14 and 18-44 from scalogram B.
8. Press the process A button and play the re-synthesised signal. What do you
notice? Now press the process B button and play the re-synthesised signal. What
do you notice?
9. Try the exercise again. This time with scales x 6, can you improve on separating
the high and low sounds?
Exercise 2
1. Load in vowel sound ar.au. Play it, what do you hear?
2. Select the Sombrero wavelet from the Wavelet A pop-up menu. The CWT
computation starts automatically.
3. Move cursor A up and down over the scalogram. What do you notice about the
CWT coefficients?
4. Using the remove scales options, remove scales 1-14 from scalogram A. This is
equivalent to doing a low-pass filter. It removes some of the higher frequencies.
5. Press the process A button and play back the signal. What do you notice?
Appendix C
Page 57
Appendix C - Software Development Log
SEMESTER 1
Weeks 1 2 3 4 5 6 7 8 9 10 11 12
Requirements Analysis
Continuous WT function development
Preliminary GUI development and menu for
loading signal.
CWT function plugged into interface. Popup
menu developed for wavelet selection.
Wavelet windows developed to show
wavelet animation. Testing
Scalogram development with cursors and
testing.
Cursor selects scale off scalogram and plots
on the CWT coefficients on the CWTPlot
axis. Testing
Development of zoom buttons
Remove scales section of the system. i.e.
updating scalograms, choosing lines etc.
Testing
Integrating zoom controls to include
zooming on original and new signal scales
Testing functionality written so far by
random testing and developing interface.
SEMESTER 2
Weeks 1 2 3 4 5 6 7 8 9 Easter
Break
Development of the ICWT function and code
for reading off altered scalogram to produce
new signal. Process buttons.
Development of the choice to show steps of
CWT and scalogram construction.
Testing and debugging of the WLT
Evaluation / Questionnaire analysis
Design and construction of Subband
interface
Create core code for Subband tool
Plug in code and finish interface
Testing and de-bugging
Finish Dissertation write-up and make any
slight adjustments to software from
comments in evaluation.
Subband
Software

Vous aimerez peut-être aussi