Get Adobe Flash player

Flash AIML TTS Chatbot – ‘HAL9000′ using PHP and Festival

16. October 2009 – 23:42

Tags: , , , , , , ,

Flash AIML TTS Chatbot - 'HAL9000' using PHP and Festival

Ever dreamed of having a chat with you own personal AI?

Well, we are still a bit behind Arthur C. Clarke´s dream of a self-aware AI like the HAL9000 but with AIML, Festival and Flash you can build your own talking chatbot in no time.

Have a chat with HAL first.


brainroom

The Brain room:

So we are going to build ourselves the poor man’s version of a “Heuristically programmed ALgorithmic Computer” and of course we start with its brain.

The Program E – AIML Manager will function as the brain room and during the setup we install a set of data crystals (aka an AIML set).
Program E runs on PHP and parses and stores the actual “brain” within a mysql database.

So create a new database, install Program E to “mydir/programe” and upload the “talk2me.php” from the project package at the end of this article into “programe/src”.

Then upload and parse an AIML brain file into the db – call the new bot “HAL”.


module1

The speech module:

We will use the Festival Text To Speech package to make HAL talk.
This needs a Unix based system and the installation is quite simple – refer to this tutorial if you encounter problems.

Festival comes with a “text2wave” script and a suitable default language.

We will also need the LAME mp3 encoder in order to convert those created wav files to a transferable mp3 because speed is critical.

Within the package you will find some PHP files including a “config.php”.
Upload and chmod them and modify the config to fit your servers directory structure.


hal3

The eye:

Now we setup an interface to Program E and our TTS system – HAL´s famous “eye”.

Open the “src/hal9000.fla” and the “src/Main.as” and change the variable “path” in line 31.

Upload the recompiled “index.swf” along with the HTML and JS file and have a first small talk with your chatbot.


Download the project here !



Note: This is the poor – AND the lazy man´s way to build a talking chatbot.
This could be implemented in many more elegant ways – it´s even possible to have a bidirectional voice communication with HAL by using an rmtp server and a speach recognition sdk.

Post a Comment

Security Code: