Customizing Alf 1.1

1) alf.ini

botDisplayName
//this is the bot's name as it appears in the flash movie.

clientDisplayName //a name for your user.

movie
//this is the character template. There are some templates available for download here. You can also design your own templates from a master template.

soundPath //the (relative) path to the sound and amplitude files.

botNameFont //the font you want to see your bot's name displayed in.
botNameSize, botNameColor //font size and color (color=0xhexadecimal color code, e.g. white=0xFFFFFF).
botNameBold, botNameItalic, botNameUnderline //1 means yes, 0 means no.
botNameX, botNameY //x and y coordinates of the botDisplayName field.
botNameWidth, botNameHeight, botNameBorder, botNameBorderColor, botNameBackground, botNameBackgroundColor //more parameters for the botName field.

You can set similar parameters for the clientName field (clientNameFont...), the bot output field (botAnswerFont...) and the client input field (clientAnswerFont...)

oddMenuItemFont... //Format parameters for the odd menu items (1st, 3rd and 5th)

firstMenuItemDepth... //Parameters for the first menu item text field. Similar parameters for the 3rd and 5th menu item text fields.

evenMenuItemFont... //Format parameters for the even menu items (2nd and 4th)

secondMenuItemDepth... //Parameters for the second menu item text field. Similar parameters for the 4th menu item text field.

IMPORTANT NOTE: make sure every parameter is between &-signs. Clear cache before viewing changes in browser.

2) alf_brains.txt

welcomeText
//what you want your bot to say when the page loads.

hideWelcomeText //set to Y if you don't want your bot to say anything when the page loads.

questionArray, answerArray //here goes the bot's Nascent Artificial Intelligence.

menuQuestionArray //here you put the questions you want to appear in the menu items. Make sure you also included them in your NAI questionArray.

IMPORTANT NOTE: make sure to surround every parameter with &-signs. questionArray, answerArray and menuQuestionArray all count as 1 parameter. Clear cache before viewing changes in browser.

3) /soundfiles/

The soundfiles directory contains 2 types of files: audio files (.mp3) and amplitude files (.txt). The latter ones contain the data by which the lip movements are controlled.

You can record your own audio files with any recording software available to you. I use Audacity. Note: if you want to export MP3 files from Audacity you'll also have to get the LAME encoder.

Naming your files - You should name both your audio files and amplitude files before the extension the first 25 characters of the corresponding NAI answerArray element (= the corresponding text output), all lowercase, replacing special characters with hyphens (-) and spaces with underscores (_). Example: if you program the answerArray element "I'm being sold like hot cakes!", you have to name the corresponding mp3 file: "i-m_being_sold_like_hot_c.mp3". Please note not all special signs are converted to hyphens, only the ones I found on my keyboard. To get an idea of the filename the bot will be looking for for its reply, use the fileNameTool that comes with the bot engine (in the tools folder). Just type or paste the NAI answerArray element in the botOutput field and press Enter. In fact, as the fileNameTool contains the same filename algorithm the bot does, I'd recommend to always use it to name your files. In case the filename it generates still contains special characters (apart from "-" and "_"), change the bot output.

Generating the amplitude files - the free way

Download WaveSurfer and use it to open the sound file, e.g. an MP3 file (set file type when opening). First time, choose standard Configuration. Right-click on the wave form and select Create Pane -> Power Plot. Right-click the Power Plot that was generated and choose Properties. Under the Power plot tab set Frame interval to 0.0666666666667, click Apply and OK. Right-click the Power Plot again and this time choose Save Configuration. Next time when opening a file, instead of choosing standard configuration, choose the configuration you just saved. For now, right-click the Power Plot again and select Save Data File. Keep the name if you generated it with the fileNameTool. Then go to the file you just saved (it will be a PWR file) and open it in a text editor. Select everything, copy and paste in the pwrPlotValues window of the amplitudeConvertor which comes with the bot engine download (in the tools folder) and press Enter. Copy the array that appears in the amplitude window and paste in a text file with the following format:

&faFile=i-m_being_sold_like_hot_c.mp3&fps=15&scale=10&smoothing=0&dBValues=0&amplitude=(0, 0, 0, 0, 1, 1, 3, 1, 2, 3, 2, 2, 2, 1, 1, 4, 2, 2, 2, 2, 7, 8, 8, 1, 4, 4, 3, 2, 3, 4, 5, 6, 3, 7, 6, 6, 2, 3, 7, 5, 5, 4, 3, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0)&ampDone=1

Replace the amplitude array with the array generated by the amplitudeConvertor and the faFile name with the name of the sound file. Save this file under the same name (replace the extension with ".txt"). Example: if your sound file is called "my_name-s_alfredo.mp3", faFile will be called the exact same and your amplitude file will be called "my_name-s_alfredo.txt". Note that amplitude files are the same type as alf.ini and alf_brains.txt described above, which means: no formatting and no white space between the "&"-separated parameters. Upload both sound and amplitude files to the soundfiles folder (http://www.yoursite.com/alf/soundfiles).

For a description of the use of Wavesurfer in a similar context go here. Don't use the EasyLipSyncConverter you'll find over there, however. Instead, use the amplitudeConvertor you'll find in the tools folder of the Alf distribution.

Generating the amplitude files - the fast way

Flashamp does all of the above in the wink of an eye. With the standard version you can even batch-process a whole folder of sound files at the same time! Except for the About and Registration tabs (the unregistered version only turns out 10 values per amplitude array) the tool has 3 other tabs. For best lip sync performance in conjunction with Alf you should tick "Amplitude list" and "Normalize" under the Settings tab. Scale should be set to 10 and Frame rate to 15. Under the Input tab browse for the file or folder of files (standard version) you want to process and choose Runtime LoadVariables() under Output. When you press the Process button, Flashamp generates the amplitude file(s).


© 2005 The Bot Factory

For support, character templates and tools, visit www.thebotfactory.com