net - UK (2020-04)

(Antfer) #1

Text-to-Speech API


Artificial intelligence (AI) is defined as a machine-based
intelligence, as opposed to the biological intelligence of
humans and animals. AI refers to machines performing functions
of cognition (of the mind), such as learning and solving problems.

Disciplines of AI
Speech synthesis is just one of many branches of AI. Although
AI is ever-expanding through industries and disciplines, there
are several branches we are focused on. For example, some
applications include:

O Machine learning
O Knowledge reasoning
O Robotics
O Virtual reality
O Data mining
O Game theory
O Natural language processing
O Computer vision
O Speech recognition
O Speech synthesis

AI is an integral part of our world, embedded in nearly every
technology we have. AI is in the Google searches we run, the voice
commands we tell Alexa and the map directions we follow. It’s part
of ordering our morning coffee and in the navigation system in our
cars. Our AI-powered phones, that are never out of reach, have
become an extension of our physical selves, our very identity. AI
holds the promise of making almost everything we do easier and
vastly improving our world.

DEFINING AI


IN-DEPTH

Composer, run the following commands in order to
install it.


php -r “copy(‘https://getcomposer.org/installer’,
‘composer-setup.php’);”
php -r “if (hash_file(‘sha384’, ‘composer-setup.
php’) === ‘c5b9b6d368201a9db6f74e2611
495f369991b72d9c8cbd3ffbc63edff210eb73d4
6ffbfce88669ad33695ef77dc76976’) { echo ‘Installer
verified’; } else { echo ‘Installer corrupt’; unlink(‘composer-
setup.php’); } echo PHP_EOL;”
php composer-setup.php
php -r “unlink(‘composer-setup.php’);”


If you ever get stuck setting up Composer, you can
follow this resource here: https://getcomposer.org/.
To install the Text-to-Speech SDK, simply run the
following command:


php composer.phar require google/cloud-text-to-speech


Composer makes a vendor folder in your project
folder and installs all the dependancies for you.


STEP 8:&5($7($1(:3+3),/(
Now that everything is installed, you can create
a new PHP file in your project folder. Set it up
however you like but include a simple HTML form to
indicate what text you want to synthesise and some
options for voice types.
To get you started, here is an example PHP file
with the form included:


<!DOCTYPE html>




NET -Text to Speech Tutorial



Text to Speech


name=”submit”>



// main php code to go here
?>



STEP 9:(7,1&20,19$5,$%/(6
Next, assign the incoming variables from the posted
form to some variables. We’ll add the form fields


“The data we send is


comprised of three


main nodes; input, voice


dqg#dxglrFrqĽjĤ

Free download pdf