Sie sind auf Seite 1von 89

DEDICATION

We dedicate this project to our


beloved, caring, loving and respected
Parents
And
Family members.

ACKNOWLEDGEMENTS

With the Grace of the Almighty ALLAH WHO bestowed us a lot of blessings
and we became able to complete our project, we are thankful to ALLAH who
is the Creator of the whole universe.
We acknowledge the help and support of our parents and teachers, due to
which we have reached our destination. We are thankful to our supervisor sir
Wajahat for encouraging us during our project.

II

ABSTRACT

Making the machine to learn to recognize the human voice is a great need of
the day. Voice recognition is the process of making the computer intelligent
enough to distinguish a voice spoken by a human from all other voices. In
voice recognition voice is first recorded sampled, framed, windowed and then
different features which make it distinguishable are extracted. These features
include short time energy, zero crossing rate, and spectral roll off spectral flux
spectral centriod. Once these features are extracted then pattern recognition is
applied whose output moves the robotic hand according to the voice command
of the user. Neural networks are used for pattern recognition with five neurons
at the input layer. This voice recognition system is 98 percent accurate when
experimented with a single user. It covers all the commands needed to control
a robotic arm.

III

Table of Contents

Dedication..................I
Acknowledgements..II
Abstract ..... III
Table of Contents.......IV
List of Figures..VIII
List of Tables . ....X
Chapter 1: Introduction...1
1.1 Problem statement................................................................................1
1.2 Objective..............1
1.3 Organization of project report..............................................................2
Chapter 2: Literature Review ....3
2.1 Aim and Purpose..............3
2.2 Mechanical Assembly Review.............................4
2.3 Speech Recognition Review.........................................................5

Chapter 3: Design Procedure..6


3.1 Artificial Intelligence........6
3.2 Machine Learning.................6
3.2.1 Definition....7
3.2.2 Generalization,....7
3.3 Human Interaction.................... 7
3.4 Algorithm types.........................................................7

IV

3.4.1 Supervised learning 8


3.4.2 Statistical classification...9
3.5 Artificial neural network................................................................10
3.5.1 ANN in Matlab..10
3.5.2 How does ANN work....12

3.6 Transfer functions.......13


3.6.1 Hard-limit transfer function .13
3.6.2 Linear transfer function ....14
3.6.3 Sigmoid transfer function .14
3.6.4 Feed-forward back propagation.15
3.6.5 Epoch.....17
3.6.6 Training of ANN...17
3.7 Mechanical Assembly....17
3.7.1 Types of industrial robots......18
3.7.2 Components.......................18
3.8 Mechanical construction.....19
3.9 Characteristics of cyborg arm.....20
3.10 Finger construction with spring................21
3.10.1 How to grip......21

Chapter 4: Design Details..22


4.1 Introduction....22

4.2

First

phase..

.22
4.2.1 Sampling rate ...22
4.2.2 Recording..23
4.2.3 Retrieving .....23
4.2.4 Normalizing..................24
4.2.5 Framing.................24
4.2.6 Windowing............24
4.3 Feature extraction.......27
4.4.Features......27
4.4.1.Zero crossings rate....................28
4.4.2 Short time energy..........................30
4.4.3 Spectral roll off.....31
4.4.4 Spectral flux..........32
4.4.5 Spectral centroid.... ..32
4.5 Electrical and electronic components.32
4.5.1 DC power supply..33
4.5.2 Actuators.......33
4.5.3 H-Bridge.......33
4.5.4 Microcontroller 89c51......................34
4.6

Proteus

design.

....37
4.7 Motor driving circuitry...38
4.8 PCB designing....39
4.9 Problems and troubleshooting............39

VI

Chapter 5: Results and Discussion...41


5.1 Graphical user interface.........41
5.2 GUI in Matlab....41
5.2.1 How does GUI work........42
5.2.1 How does GUI
work..............................................................................................46
5.2.2 Ways to built Matlab GUI........................................................43
5.3 Creating GUI with guide........43
5.3.1 What is guide?...........................................................................43
5.3.2 Opening guide......................43
5.3.3 Laying out a guide to GUI .. 44
5.3.4 Adding components to GUI.............45

5.4 Our project GUI.................45


5.4.1 Start..46
5.4.2 Trouble shoot...47
5.4.3 Training........48
5.4.4 Simulation result......49

Chapter 6: Conclusion...50
Future Suggestions.51

VII

References...52
Appendix A
Feature Extraction, Computing Statistics, Neural network codes....54
Appendix B
Components cost..61
Appendix C
Data Sheets...62

LIST OF FIGURES
Figure 2.1: Project Design.......5
Figure 3.1: Style of neural computation.10
Figure 3.2: Network/data manager in nntool..11
Figure 3.3: Create new data in nntool.......................................................... .12
Figure 3.4: Create network in nntool.............................................................13
Figure 3.5: Hard limit transfer function .....13
Figure 3.6: Pure line transfer function .......14
Figure 3.7: Log sigmoid transfer function.................................................14
Figure 3.8: View of the project network in nn tool.........15
Figure 3.9 Feed farward back propagation....................................................16
Figure 3.10: Result of the trainning...............................................................16
Figure 4.1: Sampling rate...............................................................................23

VIII

Figure 4.2: Retrieving.................................................................................23


Figure 4.3: Hamming Window......................................................................25
Figure 4.4: Result of hamming Window........................................................26
Figure 4.5: Block diagram of voiced/unvoiced classification.......................28
Figure 4.6: Define of zero crossing rate.........................................................29
Figure 4.7: Distribution of zero crossing for voiced/unvoiced speech..........29
Figure 4.8: Computation of short time energy ...31
Figure 4.9: DC motor..33
Figure 4.10: Diagram of l293D......................................................................34
Figure 4.11: Pin Description..........................................................................35
Figure 4.12: Circuit diagram of Motor driving circuit...................................37
Figure 4.13: Motor Driving Circuitry.38
Figure 4.14: Drive layout ...39
Figure 5.1: Guide layout editor ..44
Figure 5.2: Adding component to GUI ..45
Figure 5.3: Our project GUI....45
Figure 5.4: Start button ..46
Figure 5.5: Troubleshoot button.47
Figure 5.6: Trainning button ..48
Figure 5.7: Simmulation button .49

IX

LIST OF TABLES
Table 4.1: Pin configuration ..36

CHAPTER 1:

Introduction

1.1 Problem Statement


Implementation of voice command and control for a cyborg hand requires
extraction of voice feature that make a voice command distinguishable from
all other voices in the language.
Feature extraction requires that voice should be clean from all noise so that
feature extracted per frame of a voice command should have a value within
the range of the class the voice command belongs.
Pattern recognition techniques are applied on the features so that they can be
classified. Pattern recognition techniques should be able to learn the pattern
present in the dataset of a feature extracted from a same voice command class
Combining the feature extraction and pattern recognition, the cyborg hand can
be made intelligent to act on the voice command from a single user.

1.2 Objective
Prime objective of our project is to develop a voice recognition system that
can be used as command and control for any machine.
For that we have chosen robotic arm. Since it has an extensive set of
commands which can be used to train our voice recognition system.
Most of the voice recognition systems are developed for speech to text
conversion. Since these systems are operated for a large vocabulary they are
less accurate and require more computation. our aim was to develop a voice

Air University

Introduction

recognition for the command and control of a machine, while using less
computational power

by using non conventional approach to voice

recognition i.e. instead of using convention features of voice(e.g. MFCC and


LPC) we have chosen a set five feature that make a voice distinguishable
enough to control a cyborg hand.
In our project we achieve the accuracy of 95%, for a single user.
Voice command and control has many applications from military to air force
and from telephony to people with disabilities.
Voice command and control is used in military ground vehicles where
commander can rotate and aim its gun on the target through his voice while
sitting inside in the safe environment of tank. This application of voice
command and control was our major source of inspiration for making this
project since a robotic arm and machine gun has the difference of only the end
effector.

1.3 Organization of Project Report


In Front end processing, we first take the voice signal from the user with the
help of microphone at the sample rate of 44100 samples per second and save it
in the hard drive. Now the samples are retrieving in the MATLAB by using the
command wavered. Normalizing, framing, and windowing are also done in the
first phase of Front end processing.
In the feature extraction, the voice samples are receive by each feature block
and then by applying statistics on each feature block we get the output in the
form of vector matrix. This vector matrix is now applied at the input of neural
network.
In the neural network, neural network is applied at vector matrix of speech
signal and trained the neural network and matched it according to target value
by adjusting weights and bias value.
In cyborg hand, the output of neural network is sent to robotic circuit via
parallel cable which commands the robotic arm to move in specific directions.

CHAPTER 2:

Literature Review

2.1 Aim and Purpose


To implement a speech recognition system capable of recognizing spoken
words from a small vocabulary and using those words to control the motions
of cyborg hand. Secondly to grip any abject by rotating its fingers. The
rotation of finger joints will stop by sensing an object to hold it. An artificial
device extension that replaces a missing body part. It is part of the field
of biomechatronics,

the

science

of

using mechanical devices with

human muscle, skeleton, and nervous systems to assist or enhance motor


control lost by trauma, disease, or defect. Prostheses are typically used to
replace parts lost by injury (traumatic) or missing from birth or to supplement
defective body parts. Inside the body, artificial heart valves are in common use
with artificial hands seeing less common use but under active technology
development. Other medical devices and aids that can be considered
prosthetics include hearing aids, artificial eyes, palatal obturator, gastric bands,
and dentures. Although among designs of prosthetics there have been some
successes in the design of functional robotic implants, there remain many
issues and challenges concerned with the failure to meet the ideal
requirements of a satisfactory prosthetic. These ideals require the device to
be easy to control, comfortable to wear, and cosmetically pleasing.

Air University

Literature Review

2.2 Mechanical Assembly Review


The literature on prosthetics and robotic implants are voluminous, this review
focuses on four topics to determine key challenges and opportunities
underlying these interdisciplinary research areas: firstly, an artificial hand as a
biomimetic; secondly, prosthetic implants

thirdly, prosthetic implants and

tissue reactions to the material fourthly, how inflammatory responses of cells


and tissues surrounding implanted sensors interfere with the signal
transmission of such sensors. This review also notes the importance of the
biological interfaces that robotic implants and other prosthetic devices are in
contact with and how an improved knowledge of pathophysiological changes
at such biological interfaces will lead to improved and more biocompatible
designs of prosthetics. This review concludes with the vision that, to develop a
design that satisfies the above ideals, an interdisciplinary team of biomedical
and tissue engineers, and biomaterial and biomedical scientists is needed to
work together holistically and synergistically.
This report presents an overview of speech recognition technology, software,
development and applications. It begins with a description of how such
systems work, and the level of accuracy that can be expected. Applications of
speech recognition technology in education and beyond are then explored. A
brief comparison of the most common systems is presented, as well as notes
on the main centres of speech recognition research in the UK educational
sector. The report concludes with potential uses of speech recognition in
education, probable main uses of the technology in the future. Speech
recognition is an alternative to traditional methods of interacting with a
computer, such as textual input through a keyboard. An effective system can
replace, or reduce the reliability on, standard keyboard and mouse input. This
can especially assist the following:
People who have little keyboard skills or experience, who are slow typists,
or do not have the time or resources to develop keyboard skills.

Air University

Cyborg Hand

Dyslexic people or others who have problems with character or word use and
manipulation in a textual form.
People with physical disabilities that affect either their data entry, or ability to
read (and therefore check) what they have entered.

2.3 Speech Recognition Review


Speech recognition consists of following:

A microphone, for the person to speak into.

Speech recognition software.

A computer to take and interpret the speech.

A good quality sound card for input and output.

The basic block diagram of our project is:

Fig 2.1: Project Design

CHAPTER 3:

Design Procedure

3.1 Artificial intelligence


It is the property of machines to do reasoning for any given problem with
specified logics and perceptions after a particular process known as Machine
learning.

3.2 Machine Learning


Machine learning, a branch of artificial intelligence, is a scientific discipline
that is concerned with the design and development of algorithms that allow
computers to evolve behaviors based on empirical data, such as from sensor
data or databases. A learner can take advantage of examples (data) to capture
characteristics of interest of their unknown underlying probability distribution.
Data can be seen as examples that illustrate relations between observed
variables. A major focus of machine learning research is to automatically learn
to recognize complex patterns and make intelligent decisions based on data;
the difficulty lies in the fact that the set of all possible behaviors given all
possible inputs is too large to be covered by the set of observed examples
(training data). Hence the learner must generalize from the given examples, so
as to be able to produce a useful output in new cases. Machine learning, like
all subjects in artificial intelligence, require cross-disciplinary proficiency in
several areas, such as probability theory, statistics, pattern recognition,
cognitive science, data mining, adaptive control, computational neuroscience
and theoretical computer science.

Air University

Cyborg Hand

3.2.1 Definition
A computer program is said to learn from experience E with respect to some
class of tasks T and performance measure P, if its performance at tasks in T, as
measured by P, improves with experience E.

3.2.2 Generalization
The core objective of a learner is to generalize from its experience. The
training examples from its experience come from some generally unknown
probability distribution and the learner has to extract from them something
more general, something about that distribution, which allows it to produce
useful answers in new cases.

3.3 Human interaction


Some machine learning systems attempt to eliminate the need for human
intuition in data analysis, while others adopt a collaborative approach between
human and machine. Human intuition cannot, however, be entirely eliminated,
since the system's designer must specify how the data is to be represented and
what mechanisms will be used to search for a characterization of the data.

3.4 Algorithm types


Machine learning algorithms are organized into taxonomy, based on the
desired outcome of the algorithm.

Supervised learning generates a function that maps inputs to desired


outputs. For example, in a classification problem, the learner
approximates a function mapping a vector into classes by looking at
input-output examples of the function.

Unsupervised learning models a set of inputs, like clustering.

Semi-supervised learning combines both labeled and unlabeled


examples to generate an appropriate function or classifier.

Air University
Procedure

Design

Reinforcement learning learns how to act given an observation of the


world. Every action has some impact in the environment, and the
environment provides feedback in the form of rewards that guides the
learning algorithm.

Transduction tries to predict new outputs based on training inputs,


training outputs, and test inputs.

Learning to learn learns its own inductive bias based on previous


experience.

3.4.1 Supervised learning

Artificial neural network


o

Back propagation

Bayesian statistics
o

Naive Bayes classifier

Bayesian network

Bayesian knowledge base

Case-based reasoning

Decision trees

Inductive logic programming

Gaussian process regression

Group method of data handling (GMDH)

Learning Automata

Minimum message length (decision trees, decision graphs, etc.)

Lazy learning

Instance-based learning
o

Nearest Neighbor Algorithm

Probably approximately correct learning (PAC) learning

Ripple down rules, a knowledge acquisition methodology

Symbolic machine learning algorithms

Air University

Cyborg Hand

Sub symbolic machine learning algorithms

Support vector machines

Random Forests

Ensembles of classifiers
o

Bootstrap aggregating (bagging)

Boosting

Ordinal classification

Regression analysis

Information fuzzy networks (IFN)

3.4.2 Statistical classification

Linear classifiers
o

Fisher's linear discriminator

Logistic regression

Naive Bayes classifier

Perceptron

Support vector machines

Quadratic classifiers

k-nearest neighbor

Boosting

Decision trees
o

C4.5

Random forests

Bayesian networks

Hidden Markov models

3.5 Artificial neural network


An Artificial Neural Network (ANN) is an information processing paradigm that
is inspired by the way biological nervous systems, such as the brain, process
information. The key element of this paradigm is the novel structure of the

Air University
Procedure

Design

information processing system. It is composed of a large number of highly


interconnected processing elements (neurons) working in unison to solve
specific problems. ANNs, like people, learn by example. An ANN is configured
for a specific application, such as pattern recognition or data classification,
through a learning process [6].

3.5.1 ANN in Matlab


Artificial neural networks (ANN) are among the newest signal-processing
technologies in the engineer's toolbox. In engineering, neural networks serve
two important functions: as pattern classifiers and as nonlinear adaptive filters.
Definitions and Style of Computation An Artificial Neural Network is an
adaptive, most often nonlinear system that learns to perform a function (an
input/output map) from data.

Fig 3.1: Style of neural computation..[8]


Adaptive means that the system parameters are changed during operation,
normally called the training phase. After the training phase the Artificial
Neural Network parameters are fixed and the system is deployed to solve the

10

Air University

Cyborg Hand

problem at hand (the testing phase). The Artificial Neural Network is built
with a systematic step-by-step procedure to optimize a performance criterion
or to follow some implicit internal constraint, which is commonly referred to
as the learning rule [9]. The input/output training data are fundamental in
neural network technology, because they convey the necessary information to
"discover" the optimal operating point.. There is a style in neural computation
that is worth describing.
Fig 3.2: Network/data manager in nntool
An input is presented to the neural network and a corresponding desired or
target response set at the output. An error is composed from the difference
between the desired response and the system output. This error information is
fed back to the system and adjusts the system parameters in a systematic
fashion (the learning rule). The process is repeated until the performance is
acceptable [8]. It is clear from this description that the performance hinges
heavily on the data. In artificial neural networks, the designer chooses the
network topology, the performance function, the learning rule, and the
criterion to stop the training phase, but the system automatically adjusts the
parameters. At present, artificial neural networks are emerging as the
technology of choice for many applications, such as pattern recognition,
prediction, system identification, and control.

3.5.2 How Does an ANN Work?


In the ANN described above the user selects a tool by writing in m file
nntool.
User selects data and target value from new or if we have data in any file
than data can be imported by Import. Target is value from which we match
our output value

11

Air University
Procedure

Design

Fig 3.3: Create new data in nntool


Than user create network in which training function, transfer function,
number of layer and number of neuron in each layer is selected.

Fig 3.4:Create network in nntool

3.6 Transfer Functions


Three of the most commonly used functions are shown below:
12

Air University

Cyborg Hand

3.6.1 Hard-limit transfer function

Fig 3.5: Hard limit transfer function.[9]


The hard-limit transfer function shown above limits the output of the neuron
to either 0, if the net input argument n is less than 0; or 1, if n is greater than
or equal to 0.

3.6.2 Linear transfer function

Fig 3.6: Pure line transfer function.[9]

The linear transfer function gives the value of positive value for input value
greater than one and negative one for input value less than one.

3.6.3 Sigmoid transfer function

13

Air University
Procedure

Design

The sigmoid transfer function shown below takes the input, which may have
any value between plus and minus infinity, and squashes the output into the
range 0 to 1.

Fig 3.7: Log sigmoid transfer function..[9]


In our project we use three layers of neuron , in first layer we select five
neuron for five features of voice and in second layer we select twenty neuron
in hidden layer and in third layer one neuron is selected for output [11].
In our project we used the feed-forward back propagation. The view of our
network is given below

Fig 3.8: View of the project network in nn tool

3.6.4 Feed-forward back propagation


A feed forward neural network is an artificial neural network where
connections between the units do not form a directed cycle. This is different
from recurrent neural networks.
In this network, the information moves in only one direction, forward, from
the input nodes, through the hidden nodes (if any) and to the output nodes.
There are no cycles or loops in the network [10].

14

Air University

Cyborg Hand

In Back-propagation output values are compared with the correct answer to


compute the value of some predefined error-function. By various techniques,
the error is then fed back through the network. Using this information, the
algorithm adjusts the weights of each connection in order to reduce the value
of the error function by some small amount. After repeating this process for a
sufficiently large number of training cycles, the network will usually converge
to some state where the error of the calculations is small. In this case, one
would say that the network has learned a certain target function.

Fig 3.9: Feed farward back propagation..[6]


The result of training is given below.

15

Air University
Procedure

Design

Fig 3.10: Result of the trainning

3.6.5 Epoch
An entire pass through all of the input training vectors is called an epoch.
When such an entire pass of the training set has occurred without error,
training is complete [11].
One iteration through the process of providing the network with an input and
updating the network's weights. Typically many epochs are required to train
the neural network.

16

Air University

Cyborg Hand

3.6.6 Training of ANN


If sim and learnp are used repeatedly to present inputs to a perceptron, and to
change the perceptron weights and biases according to the error, the
perceptron will eventually find weight and bias values that solve the problem,
given that the perceptron can solve it. Each traverse through all of the training
input and target vectors is called a pass [12].
The function train carries out such a loop of calculation. In each pass the
function train proceeds through the specified sequence of inputs, calculating
the output, error and network adjustment for each input vector in the sequence
as the inputs are presented.

3.7 Mechanical Assembly


A robotic arm is a robotic manipulator, usually programmable, with similar
functions to a human arm. The links of such a manipulator are connected by
joints allowing either rotational motion (such as in an articulated robot) or
translational (linear) displacement. The links of the manipulator can be
considered to form a kinematics chain. The business end of the kinematics
chain of the manipulator is called the end effector and it is analogous to the
human hand. The end effector can be designed to perform any desired task
such as welding, gripping, spinning etc., depending on the application [14].

3.7.1 Types of Industrial Robots

Cartesian robot /Gantry robot: Used for pick and place work,
application of sealant, assembly operations, handling machine tools and
arc welding. It's a robot whose arm has three prismatic joints, whose axes
are coincident with a Cartesian coordinator.

Cylindrical robot: Used for assembly operations, handling at machine


tools, spot welding, and handling at die-casting machines. It's a robot
whose axes form a cylindrical coordinate system.

17

Air University
Procedure

Design

Spherical/Polar robot: Used for handling at machine tools, spot welding,


die-casting, fettling machines, gas welding and arc welding. It's a robot
whose axes form a polar coordinate system.

SCARA robot: Used for pick and place work, application of sealant,
assembly operations and handling machine tools. It's a robot which has
two parallel rotary joints to provide compliance in a plane [15].

Articulated robot: Used for assembly operations, die-casting, fettling


machines, gas welding, arc welding and spray painting. It's a robot whose
arm has at least three rotary joints.

Parallel robot: One of the use is mobile platform handling cockpit flight
simulators. It's a robot whose arms have concurrent prismatic or rotary
joints.

Our voice controlled cyborg arm is a fixed sequence cylindrical robot. It is a


robot whose motion along an axis is limited and the motion between these axis
can not be stopped. This robot performs operation according to preset
information that cannot be easily changed [14].

3.7.2 Components of Cyborg Hand


Power Source
We use a step down transformer that converts 220 AC into 12V DC.

Actuator
Actuators are like the "muscles" of a robot, the parts which convert stored
energy into movement. In our project actuators are 3 DC motors that spin
gears.

Platform
Our robotic arm is supported by an iron stand that is fixed on the surface
of a steel base. Robotic arm is made of light weighted assembly.

18

Air University

Cyborg Hand

End Effectors
In robotics, an end effector is the device at the end of a robotic arm,
designed to interact with the work environment.

Metallic Iron String


Iron string is connected from the lever to the upper end of the finger to
rotate the finger with motor.

Spring
Spring is conncted on the back side of finger from its upper to the supporting iron sheet..

3.8 Mechanical Construction


We have design five fingered hand with 5 active fingers. Each finger has 2
joints. Finger joints are controlled by thick iron wires. Iron wires are
connected to the servo motors via lever. Servo motor is controlled by the
controlling circuitry. Controlling circuitry is interfaced with microcontroller.
We have designed another axis, the wrist joint. Wrist can move clockwise and
anti-clockwise. The fifth axis is at elbow. Elbow is manually movable. The
thumb, first and fifth finger is active in order to grip an object easily. Metallic
(Steel) sheet is used to make fingers and thumb. The arm is also consisting of
metal. The leather glove will cover its fingers. The weight is about 3kg to 4kg.
In our project an end effector is a mechanical gripper. It consists of just two
fingers, that can opened and closed to pick up and let go of a range of small
objects. We use a thread and two small springs. When motor rotates in one
direction, thread is made to wrapped on its shaft, as a result springs become
stretched and gripper fingers open. When motor rotates in other direction
thread becomes unwrapped. As a result springs compress and gripper closed.

3.9 Characteristics of Cyborg Arm


(1) Joints
19

Air University
Procedure

Design

Our robotic arm has two joints called rotary joint and linear joint.
Rotary joint: It can rotate the robotic arms end effector 270 degrees. This
joint connects robotic arm with the iron stand through a gear.
Linear joint: It can rotate the robotic arms end effector along the radius of
270 degrees. This joint connects the end effector with the robotic arm
through a gear [15].

(2) Payload
The carrying capacity of a robotic arm is called its payload. Our robotic
arm can pick an object up to 300 grams.

(3) Reach
The end effector (gripper) of our robotic arm can move up to 12 inches on
a lead screw.

(4) Repeatability
A measurement may be said to be repeatable when this variation is smallar than some agreed limit. The repeatability of this robotic arm is 1.5.

(5) Axis of Rotation


Our robotic arm can move in cylindrical co-ordinates having a constant z
parameter. It can rotate 270 degrees in circular motion and its end effectors
can move 12 inches linearly.

3.10 Finger Construction with spring

20

Air University

Cyborg Hand

A finger having two axes of rotation. These two axes are at each finger at its
both two joints. These axes are at the corner of a finger in order to provide
better rotation. Metallic (iron) string is connected from lever to the upper end.
When motor rotates clockwise, the finger rotates anti-clockwise. Its rotation is
around its both 1st and 2nd axes (at joints) in two steps. When motor rotates
anti-clockwise, the finger rotates clockwise. Spring is connected at back
portion of finger. When motor is rotated anti-clockwise, the then the lever
looses its grip on finger. The spring stretches the finger back by moving both
joints around their axes in two steps. With the attachment of spring, the
complexity of circuit reduces. Use of spring makes circuit economic and
efficient.

3.10.1 How to Grip


When both joint of all fingers move anti-clockwise, the hand turn to close. Put
any object in between its rotating fingers. When finger tips touches the surface
of that object, the current in the circuit sustains. If we do not put a limiting
circuit, the current in the circuit will not stop, causes a chance to break the
joints.

21

CHAPTER 4:

Design Details

4.1 Introduction
Front end are generalized terms that refer to the initial and the end stages of a
process. The front end is responsible for collecting input in various forms from
the user and processing it to conform to a specification the back end can use.
The front end is an interface between the user and the back end. In our project
front end processing has two phases. In first phase we have done sampling and
recording, retrieving and normalizing, and finally framing and windowing. The
second phase involves feature extraction [4].

4.2 First phase


First phase is sampling and recording.

4.2.1 Sampling rate


The sampling rate, sample rate, or sampling frequency defines the number
of samples per second (or per other unit) taken from a continuous signal to make
a discrete signal. For time-domain signals, the unit for sampling rate
is hertz (inverse seconds, 1/s, s1). The inverse of the sampling frequency is
the sampling period or sampling interval, which is the time between samples.
Sample rate is usually noted in Sa/s (non-SI) and expanded as kSa/s, MSa/s, etc.
The common notation for sampling frequency is fs.

22

Air University

Cyborg Hand

Fig 4.1: Sampling rate..[4]

.The sampling rate in our project is 44100 samples per sec

4.2.2 Recording
We take our voice with the help of microphone and record or saved it in the hard
drive with the sampling rate (44100 samples per sec).

4.2.3 Retrieving
Retrieving is done at the sample rate of 44100 samples per sec through wave
read function of MAT.LAB.

23

Air University

Design Details

Fig 4.2: Retrieving

After retrieving the copies of voice command signals is sent to each feature
extraction blocks.

4.2.4 Normalizing
The process of normalizing is called pre emphasis.
In this process all the samples in the voice signal are divided by the maximum
value of a sample. It is done to reduce the dynamic range of the signal and to
make it spectrally flat.

4.2.5 Framing
Framing is called frame blocking.
In this step the voice command signal is divided into a no of blocks. Each frame
(block) contain equal no of voice samples.

4.2.6 Windowing
Windowing is done to remove the discontinuities at the start and at the end of
the frame. We have employed Hamming window for this purpose.

Hamming window
It is also known as a raised cosine window. The hamming window for N points
is defined as:

W (i) =0.54+0.46*cos(2i/N)
Where N/2<=I<N/2

24

Air University

Cyborg Hand

Fig 4.3: Hamming Window

These are specific examples from a general family of curves of the form

W (i) = a + (1 - a) cos (2 pi i / N)

25

Air University

Design Details

Fig 4.4: Result of hamming Window

26

Air University

Cyborg Hand

4.3 Feature Extraction


The second phase of front end processing in our project is feature extraction.
After the first phase the voice samples are sent to each feature extraction
block. The voice features are extracted per frame of voice signal. The five
features of two types are extracted per frame. The two types are time domain
and spectral feature. The five features we have used in our project are short
time energy, zero crossing rate, spectral roll off, spectral flux, and spectral
centroid. The first two features are time domain and last three are spectral
features. Statistics are involved to each feature block to generalize a features
value over a entire signal. The statistics are involved to each feature extraction
block because the pattern recognition technique requires that the feature
should give a single value over e entire signal. Due to which statistics are
involved to represent a general trend in voice command signal. As we used
five features, every feature should give a single value so vector of five values
is given to the input of the neural network. For example, zcr is first calculated
per frame after that a mean value of it is calculated using all of its value per
frame. This value is now ready for input of pattern recognition. Similarly the
statistics of other features are calculated as follows:

4.4 Features
We have extracted the following features:

27

Air University

Design Details

4.4.1 Zero-Crossings Rate


Zero-crossing

rate

is

an

important

parameter

for

voiced/unvoiced

classification. It is also often used as a part of the front-end processing in


automatic speech recognition system. The zero crossing count is an indicator
of the frequency at which the energy is concentrated in the signal spectrum
[5].
The analysis for classifying the voiced/unvoiced parts of speech has been
illustrated in the block diagram
in Fig.4.5[5]

Fig 4.5: Block diagram of voiced/unvoiced classification

In the context of discrete-time signals, a zero crossing is said to occur if


successive samples have different algebraic signs. The rate at which zero

28

Air University

Cyborg Hand

crossings occur is a simple measure of the frequency content of a signal. Zerocrossing rate is a measure of number of times in a given time interval/frame
that the amplitude of the speech signals passes through a value of zero. Speech
signals are broadband signals and interpretation of average zero-crossing rate
is therefore much less precise.
However, rough estimates of spectral properties can be obtained using a
representation based on the short- time average zero-crossing rate.

Fig 4.6: Define of zero crossing rate..[5]

Fig 4.7: Distribution of zero

crossing for voiced/unvoiced speech

29

Air University

Design Details

4.4.2 Short time energy


The short time energy measurement of a speech signal can be used to
determine voiced vs. unvoiced speech. Short time energy can also be used to
detect the transition from unvoiced to voiced speech and vice versa [5]. The
energy of voiced speech is much greater than the energy of unvoiced speech. .
Short-time energy can define as:

The choice of the window determines the nature of the short-time energy
representation. In our model, we used Hamming window. The hamming
window gives much greater attenuation outside the band pass than the
comparable rectangular window.

h(n) = 0.54 0.46 cos(2n /( N 1)) , 0 n N 1

30

Air University

Cyborg Hand

h(n) = 0 , otherwise

Fig 4.8: Computation of short time energy.. [5]


The attenuation of this window is independent of the window duration.
Increasing the length, N, decreases the bandwidth, Fig 5. If N is too small,
details of the waveform. If N is too large, E n will change very slowly and thus
will not adequately reflect the changing properties of the speech signal.

4.4.3 Spectral Roll off


Description:
The spectral Roll Offs point R determines where 85% of the windows
energy is achieved. It is used to distinguish voiced from unvoiced
speech and music.
Resolution: window
Parameters: SOUND file, start time, end time based on the Sub bands
RMS.
Formula:

31

Air University

Design Details

4.4.4 Spectral Flux


Description:
It determines changes of spectral energy distribution of two successive
windows
Resolution: window.
Parameters: SOUND file, start time, end time.
Based on the Sub band RMS.

4.4.5 Spectral Centroid


Description:
The spectral centroid is the balancing point of the sub band energy
distribution. It determines the frequency area around which most of the
signal energy concentrates and is thus closely related to the timedomain Zero Crossing Rate feature. It is also frequently used as an
approximation for a perceptual brightness measure.
Resolution: window.
Parameters: SOUND file, start time, end time, start sub band number,
end sub band number.
Based on the Sub band RMS.

4.5 Electrical/Electronic Components


Electrical and electronics components are D.C supply, voltage regulator
(7805), capacitors, resistors, NPN transistors (PN2222), , H-bridge(L298) and
diodes (1N4001),25 db parallel cable and 25 db female connector.

32

Air University

Cyborg Hand

4.5.1 D.C Power Supply


DC Power Supply of 12 volts and -12 volts is used in the project. DC Power
Supply consists of a transformer, voltage regulator and four diodes or a bridge.

4.5.2 Actuators
Solenoid actuated valves and a D.C Motor are used as actuators. Output
voltage of the first relay is 12 volt and 5volts applied to its coil. Relays which
are connected in relay board have output voltage of 220 volts and they are
energized by first group of relays having output voltage of 12volts and .The
output of second group of relays is used to actuate the Solenoid actuated
valves.

Fig 4.9: Dc motor.[16]

4.5.3 H-bridge (L293D) Dual full-bridge driver


Operating supply voltage is 12V.
Total dc current up to 800mA.
Low saturation voltage

33

Air University

Design Details

Over temperature protection


Logical0 input voltage up to 1.5 v
( High noise immunity)

Fig 4.10: Diagram of l293D[17]

4.5.4 Microcontroller 89C51


A microcontroller (also MCU or C) is a computer-on-a-chip, containing a
processor, memory, and input/output functions. It is a microprocessor
emphasizing high integration.

34

Air University

Cyborg Hand

Fig 4.11: Pin Description

35

Air University

Design Details

Table 4.1: Pin Description


Pin No
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

Function

8 bit input/output port (P1) pins

Reset pin; Active high


Input
(receiver)
for
serial
RxD
communication
Output (transmitter) for serial
TxD
communication
External interrupt 1
Int0
External interrupt 2
Int1
Timer1 external input
T0
Timer2 external input
T1
Write to external data memory Write
Read from external data memory Read

Name
P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
Reset
P3.0
P3.1

8 bit input/output P3.2


P3.3
port (P3) pins
P3.4
P3.5
P3.6
P3.7
Crystal 2
Quartz crystal oscillator (up to 24 MHz)
Crystal 1
Ground (0V)
Ground
P2.0/ A8
P2.1/ A9
8 bit input/output port (P2) pins
P2.2/ A10
/
P2.3/ A11
High-order address bits when interfacing with external
P2.4/ A12
memory
P2.5/ A13
P2.6/ A14
P2.7/ A15
Program store enable; Read from external program memory PSEN
Address Latch Enable
ALE
Program pulse input during Flash programming
Prog
External Access Enable; Vcc for internal program executions EA
Programming enable voltage; 12V (during Flash
Vpp
programming)
P0.7/ AD7
P0.6/ AD6
P0.5/ AD5
8 bit input/output port (P0) pins
P0.4/ AD4
Low-order address bits when interfacing with external memory P0.3/ AD3
P0.2/ AD2
P0.1/ AD1
P0.0/ AD0
Supply voltage; 5V (up to 6.6V)
Vcc

36

Air University

Cyborg Hand

4.6 Proteus Design:


The proteus design of our circuit of motor interfacing with microcontroller is
as follows:

Fig 4.12: circuit diagram of Motor driving circuit

4.7 Motor Driving Circuitry


37

Air University

Design Details

The DC motor drive is used. The drive can rotate the motor in clockwise
direction in order to close the fingers by moving joints. The three motors can
move simultaneously in order to grip an object.

Fig 4.13: Motor Driving Circuitry

We have used the PNP and NPN transistors D313 and B1367. The rating of
motor is about 12V/ 1 A. Both transistors are used as switch in saturation
mode. By switching, we have given the 0V to PNP then motor rotates in
clockwise direction. When 0 is given to NPN transistor, then motor rotates in
anti-clockwise direction. We have used two free wheeling diodes in parellal
with both transistors in reverse bias. When current passes through motor, then
inductors of motor gets charged. These inductors produce back EMF which
can damage the circuit. So these diodes work as protection circuit. Then we
have connected the two switches with the two back to back diodes in parallel.
These switches work as limiting switches. When the lever touches the switch,
then one switch cut off the circuit in one clockwise extreme position and when
the motor rotates anti- clockwise direction then the lever touches the other
switch to cut off the circuit at other extreme position. Four resistances of
1kohm are used to limit the current and to prevent the short circuiting.
38

Air University

Cyborg Hand

4.8 PCB designing


A printed circuit board, or PCB, is used to mechanically support the electrical
and electronics components more precisely then other boards like Vero board
and brad boards. So it is more secure and effective then others. Considering
all the above facts we decided to use PCB for the hardware implementation of
our project for the motor drivers and the microcontroller boards as well.
The layout of our motor drive is as follows:

Fig 4.14: Drive layout

4.9 Problems and Troubleshooting


Problems

Selection of optimal software.

Selection of mathematical techniques and codes regarding softwares


toolbox.

Designing lay-out of physical model.

Design of appropriate electronic hardware.

39

Air University

Design Details

Unavailability of components while designing hardware.

Selection an optimal designing tool for hardware components


modeling and simulation.

Troubleshooting

We worked and discussed on various softwares while surfing on the


net and interfacing with our teachers but ended up on deciding to work
on Matlab.

Among several techniques, to convert voice to do the desired action we


selected the features of voice and apply neural network.

We consider several factors like weight and then choose suitable


material for fabrication of our physical model.

Amongst several designing softwares we adopted PROTEUS for


designing of electronic components integration.

40

CHAPTER 5:

Results and Discussion


5.1 Graphical User Interface
In computing a graphical user interface (GUI, sometimes pronounced gooey)
is a type of user interface that allows users to interact with electronic devices
with images rather than text commands. GUIs can be used in computers, handheld devices such as MP3 players, portable media players or gaming devices,
household appliances and office equipment. A GUI represents the information
and actions available to a user through graphical icons and visual indicators
such as secondary notation, as opposed to text-based interfaces, typed
command labels or text navigation. The actions are usually performed through
direct manipulation of the graphical elements [13].

5.2 GUI in Matlab


A graphical user interface (GUI) is a graphical display in one or more
windows containing controls, called components that enable a user to perform
interactive tasks. The user of the GUI does not have to create a script or type
commands at the command line to accomplish the tasks. Unlike coding
programs to accomplish tasks, the user of a GUI need not understand the
details of how the tasks are performed.
GUI components can include menus, toolbars, push buttons, radio buttons, list
boxes, and slidersjust to name a few. GUIs created using MATLAB tools
can also perform any type of computation, read and write data files,
communicate with other GUIs, and display data as tables or as plots.

41

Air University

Results and Discussion

5.2.1 How Does a GUI Work?


In the GUI described above, the user selects a data set from the pop-up menu,
and then clicks one of the plot type buttons. The mouse click invokes a
function that plots the selected data in the axes.
Most GUIs wait for their user to manipulate a control, and then respond to
each action in turn. Each control, and the GUI itself, has one or more userwritten routines (executable MATLAB code) known as callbacks, named for
the fact that they "call back" to MATLAB to ask it to do things. The execution
of each callback is triggered by a particular user action such as pressing a
screen button, clicking a mouse button, selecting a menu item, typing a string
or a numeric value, or passing the cursor over a component. The GUI then
responds to these events. You, as the creator of the GUI, provide callbacks
which define what the components do to handle events.
This kind of programming is often referred to as event-driven programming.
In the example, a button click is one such event. In event-driven programming,
callback execution is asynchronous, that is, it is triggered by events external to
the software. In the case of MATLAB GUIs, most events are user interactions
with the GUI, but the GUI can respond to other kinds of events as well, for
example, the creation of a file or connecting a device to the computer.
You can code callbacks in two distinct ways:

As MATLAB language functions stored in files

As strings containing MATLAB expressions or commands (such as 'c

= sqrt(a*a + b*b);'or 'print')


Using functions stored in code files as callbacks is preferable to using strings,
as functions have access to arguments and are more powerful and flexible.
MATLAB scripts (sequences of statements stored in code files that do not
define functions) cannot be used as callbacks.
Although you can provide a callback with certain data and make it do
anything you want, you cannot control when callbacks will execute. That is,

42

Air University

Cyborg Hand

when your GUI is being used, you have no control over the sequence of events
that trigger particular callbacks or what other callbacks might still be running
at those times. This distinguishes event-driven programming from other types
of control flow, for example, processing sequential data files.

5.2.2 Ways to Build MATLAB GUIs


A MATLAB GUI is a figure window to which you add user-operated controls.
You can select, size, and position these components as you like. Using
callbacks you can make the components do what you want when the user
clicks or manipulates them with keystrokes.
You can build MATLAB GUIs in two ways:

Use GUIDE (GUI Development Environment), an interactive GUI

construction kit.

Create code files that generate GUIs as functions or scripts

(programmatic GUI construction).

5.3 Creating GUIs with GUIDE


5.3.1 What is GUIDE?
GUIDE, the MATLAB Graphical User Interface Development Environment,
provides a set of tools for creating graphical user interfaces (GUIs). These
tools greatly simplify the process of lying out and programming GUIs.

5.3.2 Opening GUIDE


There are several ways to open GUIDE from the MATLAB Command line.
You can also right-click a FIG-file in the Current Folder Browser and select
Open in GUIDE from the context menu.

43

Air University

Results and Discussion

When you right-click a FIG-file in this way, the figure opens in the GUIDE
Layout Editor, where you can work on it.

Fig 5.1: Guide layout editor


All the tools in palette have tool tips. Setting a GUIDE preference lets you
display the palette in GUIDE with tool names or just their icons. See GUIDE

Preferences for more information

5.3.3 Laying Out a GUIDE GUI


The GUIDE Layout Editor enables you to populate a GUI by clicking and
dragging GUI components into the layout area. There you can resize, group
and align buttons, text fields, sliders, axes, and other components you add.
Other tools accessible from the Layout Editor enable you to:

Create menus and context menus

Create toolbars

Modify the appearance of components

Set tab order

View a hierarchical list of the component objects

Set GUI options

44

Air University

Cyborg Hand

5.3.4 Adding Components to the GUI


The component palette at the left side of the Layout Editor contains the
components that you can add to your GUI. You can display it with or without
names.

Fig 5.2: Adding component to GUI.[13]

5.4 Our project GUI

Fig 5.3: Our project GUI

45

Air University

Results and Discussion

This is the GUI of our project. It consists of following push buttons:


1. Start
2. Troubleshoot
3. Help
4. Training
5. Simulation mode

5.4.1 Start

Fig 5.4: Start button

By pressing start button dialogue box is open which contains speak push
button, which allow user to speak with in one second time.

46

Air University

Cyborg Hand

5.4.2 Troubleshoot

Fig 5.5: Troubleshoot button

By pressing trouble shoot button the dialogue box open which consist of
following buttons:
1. Rotary motor
2. Gripper open
3. Gripper close
4. Back to main menu

47

Air University

Results and Discussion

5.4.3 Training

Fig 5.6: Trainning button

By pressing training button the dialogue box open which consist of


following buttons:
1. Enter samples
2. Calculate feature vectors
3. Train ANN
4. Back to main menu

48

Air University

Cyborg Hand

5.4.4 Simulation Result

Fig 5.7: Simmulation button

By pressing simulation button the dialogue box open which consist of


following buttons:
1. Back to main menu
2. Simulate

49

Chapter 6:
Conclusion
This report explains yhe implementation of voice controlled Cyborg Hand.The
three phases of voice recognition,along with some basis of machine
learning which were concern with the project were described.GUI
designed for our project was also explained. Robotic Hand designed
and developed for the project was also explained in detail in the
report.
Voice recognition consists of three phases front-end processing, feature
extraction and pattern recognition.
Front end processing consists of sampling, recording, retrieving, framing and
windowing. The second phase of voice recognition is feature extraction, which
consists of extraction of features. The third phase is pattern recognition, which
is a major concern of machine learning. The approach of pattern recognition
implemented in our project is Artificial Neural Network. ANN used in our
project is feed-forward back propagation.
After voice recognition, the report explains the design and development of
Cyborg Arm. The robotic arm designed for our project is a fixed sequence
robotic arm with the end effecter of gripper.
To establish the coordination between robotic arm and computer, and between
human and computer a GUI was designed in our project.
Our implementation of voice recognition is 80% accurate when tested 100
times in some environment. Accuracy degrades with change in environment
due to noise. Accuracy also degrades with change in microphone and training
samples.

50

Air University

Cyborg Hand

Future Suggestions
We have implemented the voice-recognition on PC. It can also be
implemented in another convinient microcontroller. The most suitable
microcontroller for that purpose is DS PIC33, since it has builtin ADC and
also have three pin port for voice recocording and playing.
Our voice recognition system some what depends upon environment. It is
because of noise (voices other than voice commands).Though we have done
the noise removal in feature extraction, in which features like ZCR detectsthe
major voice activity region in agiven sample.But the system can be made less
dependent on noise by implementing of noise removal algorithms at the front
end processing.
Moreover it has enough processing power for front end processing and pattern
recognition.

51

References
[1] Pattern Recognition. Bishop, C Neural Networks for Pattern
Recognition3rd Edition,1996
[2] Prasad D Polur, Ruobing Zhou, Jun Yang, Fedra Adnani, Rosalyn S.
Hobsod SPEECH RECOGNITION USING ARTIFICIAL NEURAL. 2001
Proceedings of the 23rd Annual EMBS International Conference, October 2528, Istanbul, Turkey..
[3] Roziati Zainuddin, Othman O. Khalifa. .Neural Networks Used for
Speech Recognition. NINETEENTH NATIONAL RADIO SCIENCE
CONFERENCE, ALEXANDRIA, March, 119-21, 2002.
[4] Lawrence Rabinar, Biing-Hwang Jaung Fundamentals of speech
recognition.
[5] Harmonic Spectral Centroid. McAdams, S. 1999. Perspectives on the
contribution of timbre to musical structure. Computer Music Journal.
23(3):85-102
[6] Neural Network: Eric Davalo and Patrick Naim Neural Networks 3rd
Edition,1989
[7] Feed Forward Neural Network. http://en.wikipedia.org/wiki/ /Feed forward
neural network.
[8] Neural Network :Aleksander, I. and Morton An introduction to neural
computing. 2nd edition, 1992.
[9]Neural.network.http://www.emsl.pnl.gov:2080/docs/cie/neural/neural.home
page.html
[10] Pattern Recognition. Bishop, C Neural Networks for Pattern
Recognition3rd Edition,1996. [11] Neural network: Howard Demuth, Mark
Beale Neural Network Toolbox4th Edition, July 2002

52

Air University

Cyborg Hand

[12] Neural Network: Hagan,M.T. and H.B. Demuth, Neural Networks for
Control,Proceedings of the 1999 American Control Conference, San Diego,
CA, 1999, pp1642-1656.
[13] GUI: http:// en.wikipedia.org/wiki/Graphical_user_interface
[14] Saeed b Nikku. Introduction to robotics, 2nd Edition, 2001
[15] Robotic Arm .http://en.wikipedia.org/wiki/Robotic_arm.
[16] B.L.Theraja.Electrical Machines 8thEdition, 4 Volumes Set by Tony
Burns, Stephen...
[17] H Bridge http://en.wikipedia.org/wiki/H_bridge
[18] DB25 connector. http://www.nullmodem.com/DB-25.htm

53

Appendix A
MATLAB CODE FOR FEATURE EXTRACTION

CODE OF SHORT TIME ENERGY

Function E = ShortTimeEnergy(signal, windowLength,step);


signal = signal / max(max(signal));
curPos = 1;
L = length(signal);
numOfFrames = floor((L-windowLength)/step) + 1;
%H = hamming(windowLength);
E = zeros(numOfFrames,1);
for (i=1:numOfFrames)
window = (signal(curPos:curPos+windowLength-1));
E(i) = (1/(windowLength)) * sum(abs(window.^2));
curPos = curPos + step;
end

CODE OF SPECTRAL CENTRIOD

function C = SpectralCentroid(signal,windowLength, step, fs)


signal = signal / max(abs(signal));
curPos = 1;
L = length(signal);
numOfFrames = floor((L-windowLength)/step) + 1;
H = hamming(windowLength);

54

Air University

Cyborg Hand

m = ((fs/(2*windowLength))*[1:windowLength])';
C = zeros(numOfFrames,1);
for (i=1:numOfFrames)
window = H.*(signal(curPos:curPos+windowLength-1));
FFT = (abs(fft(window,2*windowLength)));
FFT = FFT(1:windowLength);
FFT = FFT / max(FFT);
C(i) = sum(m.*FFT)/sum(FFT);
if (sum(window.^2)<0.010)
C(i) = 0.0;
end
curPos = curPos + step;
end
C = C / (fs/2);
)
C(i) = 0.0;
end
curPos = curPos + step;
end

CODE OF SPECTRAL FLUX

function F = SpectralFlux(signal,windowLength, step, fs)


signal = signal / max(abs(signal));
curPos = 1;
L = length(signal);
numOfFrames = floor((L-windowLength)/step) + 1;
H = hamming(windowLength);

55

Air University

Appendix A

m = [0:windowLength-1]';
F = zeros(numOfFrames,1);
for (i=1:numOfFrames)
window = H.*(signal(curPos:curPos+windowLength-1));
FFT = (abs(fft(window,2*windowLength)));
FFT = FFT(1:windowLength);
FFT = FFT / max(FFT);
if (i>1)
F(i) = sum((FFT-FFTprev).^2);
else
F(i) = 0;
end
curPos = curPos + step;
FFTprev = FFT;
end

CODE OF SPECTRAL ENTROPY

function En = SpectralEntropy(signal,windowLength,windowStep, fftLength, numOfBins);


signal = signal / max(abs(signal));
curPos = 1;
L = length(signal);
numOfFrames = floor((L-windowLength)/windowStep) + 1;
H = hamming(windowLength);
En = zeros(numOfFrames,1);
h_step = fftLength / numOfBins;

for (i=1:numOfFrames)

56

Air University

Cyborg Hand

window = (H.*signal(curPos:curPos+windowLength-1));
fftTemp = abs(fft(window,2*fftLength));
fftTemp = fftTemp(1:fftLength);
S = sum(fftTemp);

for (j=1:numOfBins)
x(j) = sum(fftTemp((j-1)*h_step + 1: j*h_step)) / S;
end
En(i) = -sum(x.*log2(x));
curPos = curPos + windowStep;
end

CODE OF SPECTRAL ROLL OFF

function mC = SpectralRollOff(signal,windowLength, step, c, fs)


signal = signal / max(abs(signal));
curPos = 1;
L = length(signal);
numOfFrames = (L-windowLength)/step + 1;
H = hamming(windowLength);
m = [0:windowLength-1]';
for (i=1:numOfFrames)
window = (signal(curPos:curPos+windowLength-1));
FFT = (abs(fft(window,512)));
FFT = FFT(1:255);
totalEnergy = sum(FFT);
curEnergy = 0.0;
countFFT = 1;

57

Air University

Appendix A

while ((curEnergy<=c*totalEnergy) && (countFFT<=255))


curEnergy = curEnergy + FFT(countFFT);
countFFT = countFFT + 1;
end
mC(i) = ((countFFT-1))/(fs/2);
curPos = curPos + step;
end

MATLAB CODE FOR COMPUTING STATISTICS

function FF = computeAllStatistics(fileName, win, step)

[x, fs] = wavread(fileName);

EE = Energy_Entropy_Block(x, win*fs, step*fs, 10);


E = ShortTimeEnergy(x, win*fs, step*fs);
Z = zcr(x, win*fs, step*fs, fs);
R = SpectralRollOff(x, win*fs, step*fs, 0.80, fs);
C = SpectralCentroid(x, win*fs, step*fs, fs);
F = SpectralFlux(x, win*fs, step*fs, fs);

FF(1) = statistic(EE, 1, length(EE), 'std');


FF(2) = statistic(Z, 1, length(Z), 'stdbymean');
FF(3) = statistic(R, 1, length(R), 'std');
FF(4) = statistic(C, 1, length(C), 'std');
FF(5) = statistic(F, 1, length(F), 'std');

58

Air University

Cyborg Hand

FF(6) = statistic(E, 1, length(E), 'stdbymean');

MATLAB CODE FOR NEURAL NETWORK

CODE FOR TRAINING THE ANN


net1=newff(fv,t,20,{},'traingd');
net.trainParam.show = 50;
net.trainParam.lr = 0.01;
net.trainParam.epochs = 10000;
net.trainParam.goal = 0.01;
[net1,tr]=train(net1,fv,t);

CODE FOR SIMULATING THE ANN


clc
win=0.15;
step=0.1;

for i = 1:1
file = sprintf('%s%d.wav','c',i);
input('You have 1 seconds to say your name. Press enter when ready to record--> ');
y = wavrecord(44100,44100);
sound(y,44100);
wavwrite(y,44100,file);

end

59

Air University

Appendix A

load net1
file = sprintf('%s%u.wav','c',1);
ff1=computeAllStatistics(file, win, step);
ff1=ff1';
%fv(1:5,1)=ff1;
a=sim(net1,ff1);
b=a(1,1);
b
if(b>1)
rotaryfornechay
end
if(b<1)
rotaryforuper
end

60

61

Appendix C

Data Sheets

62

Air University

Cyborg Hand

63

Air University

Appendix C

64

Air University

Cyborg Hand

65

Air University

Appendix C

66

Air University

Cyborg Hand

67

Air University

Appendix C

68

Air University

Cyborg Hand

69

Air University

Appendix C

70

Air University

Cyborg Hand

71

Air University

Appendix C

72

Air University

Cyborg Hand

73

Air University

Appendix C

74

Air University

Cyborg Hand

75

Air University

Appendix C

76

Air University

Cyborg Hand

77

Air University

Appendix C

78

Air University

Cyborg Hand

79

Das könnte Ihnen auch gefallen