Hey Athena

Review

Review, written April 4, 2016: installation is tougher than expected. It involved downloading something compiled by a third party, as the alternative appeared to be to use a compiler.

Once installed, it did work... once. After the first question, the program did not wake up to the command. Quitting and restarting repeated the situation of working... once. (A later attempt seemed to work better.)

One of the sample questions is related to weather. The program outputs a list of modules, including one named 'weather'. Speculation, based on these observations, is that this program might be quite limited except for behaviors specified by modules. That would mean that it is likely far less developed than some of the commercial offerings, like Microsoft Cortana and Apple's Siri. (At the time of this writing, Microsoft Cortana seems to be heavily reliant on a service provided by a network “cloud”.)

HeyAthena API info shows that “athena.tts.speak” will raise “HTTPError - if Google TTS fails to respond”. So it sounds like a lot of speaking may be going through Google.

Installation

Hey Athena installation notes has a section for Microsoft Windows.

The same site has a Hey Athena Installer (batch file), kindly pointed out by GitHub's Hey Athena page. However, that does require Python to be installed.

Here is a process that worked.

  • Obtain Python 3 for Microsoft Windows
    • The list of latest releases showed the most recent releases, listed in order from recent to older, were 3.44, 3.5.1, 2.7.11, and 3.5.0. This guide was based on Python 3.5.1 for Microsoft Windows.
  • Installation notes/requirements:
    • During installation, choose “Install launcher for all users (recommended)” (which is checked by default), and “Add Python 3.5 to PATH” (which is unchecked by default).
      • Placing this in the path might be completely unnecessary. However, that is what was done during the creation of these instructions. These instructions are likely to be updated after further testing finds that to be unnecessary (if that does indeed happen).
    • If you “Customize installation” (which is generally a good approach), make sure you do not uncheck “pip”, because pip will be needed. Later, you will see that the “Install launcher for all users (recommended)” option seemed to be ingored, as the “Install for all users” check box defaults to being unchecked. Do check it, which will change the default install location (from what appears to be %LOCALAPPDATA\Programs\Python\Python35-32\ to what appears to be the%ProgramFiles(x86)\Python35-32\ directory). Expect checking the box to change parts of the screen other than the checkbox.
    • Do check the “Download debugging symbols” checkbox, and the &dlquo;Download debug binaries (requires VS 2015 or later)” (even if you don't have VS 2015).
    • Installation took quite a while, mostly hanging on “C Runtime Update (KB2999226)”.
  • Go to Swig download to obtain Swig, which can be obtained by Swig Project page: Windows section.
    • The zip file for Swig 3.0.8 for Microsoft Windows contained 5,157 files in 459 directories.
  • If User Account Control is being used, open an elvated command prompt
  • Make sure that python and swig.exe are in the PATH.

    e.g., customize as needed:

    • echo %PATH%
      SET PATH=%PATH%;C:\Temp\Swig\swigwin-3.0.8\;
  • Upgrade pip
    • You are using pip version 7.1.2, however version 8.1.1 is available.
      You should consider upgrading via the 'python -m pip install --upgrade pip' comm
      and.

      C:\> python -m pip install --upgrade pip
      Collecting pip
        Downloading pip-8.1.1-py2.py3-none-any.whl (1.2MB)

          100% |################################| 1.2MB 344kB/s
      Installing collected packages: pip
        Found existing installation: pip 7.1.2
          Uninstalling pip-7.1.2:
            Successfully uninstalled pip-7.1.2
      Successfully installed pip-8.1.1

      C:\>
  • Install pyaudio
    • C:\> python -m pip install pyaudio
      Collecting pyaudio
        Using cached PyAudio-0.2.9-cp35-none-win32.whl
      Installing collected packages: pyaudio
      Successfully installed pyaudio-0.2.9

      C:\>
  • Upgrade pyaudio
    • namely because: why not?
    • --upgrade pyaudio
      C:\> python -m pip install --upgrade pyaudio
  • Obtain AVBin 10. (AVbin Downloads has downloads for multiple operating systems, including AVbin for Microsoft Windows x64 and AVbin for Microsoft Windows 32-bit (x86). (GPLv3)
    • The “Show details” button may show:
      “Extract: C:\Windows\system32\avbin64.dll
      Error creating: C:\Program Files\AVbin\AVbin10-win64-uninstaller.exe
      Completed”
      The error seems harmless.
  • After installing the AVbin, chances are that it installed to the wrong place (as shown in the message above). The avbin.dll or avbin64.dll must not be in System32, but instead should go to SysWOW64. (This step might be x64-specific?) From an elevated command prompt:
    • dir %windir%\System32\avbin*.dll %windir%\SysWOW64\avbin*.dll
      move %windir%\System32\avbin*.dll %windir%\SysWOW64\
  • Install PocketSphinx
  • Install HeyAthena

    • pip3 install HeyAthena
  • At this point, it is probably safe to uninstall SWIG? (Remove it from your path.)
  • At this point, it is probably safe to stop using the elevated command prompt?
Changing Athena's name

GitHub: Hey Athena client, Readme.rst says, “Don't like the name "Athena"? Change it to anything you want, like "Joe" or "Swagger Bot".”

Not that the web page is kind enough to say how to do that...

This guide is providing instructions about how to customize the name, even before providing details about how to use the software, because changing the name may be a very good idea. The simple problem is that the author of this guide frequently had a notably challenging time getting the software to recognize the default wake-up word of “Athena”, even though other words were generally recognized with fairly good accuracy.

dir "%ProgramFiles(x86)%\Python35-32\Lib\site-packages\athena\settings.py

In that file (or the equivilent for your version of Athena), adjust the part between the apostrophes in the non-commented line (which is the last non-blank line) of this quoted section:


# Wake-up Word(s) must be in the sphinx dict file
# Change to 'hey athena' if background noise triggering occurs
WAKE_UP_WORD = 'athena'

Although the example of “Joe” is rather easy to say, the voice (at least by default?) is a female voice. So, a female name would seem to be preferred. Furthermore, it is probably a good idea to pick a name that is less likely to show up in other words. I suspect that “Anna” might be more likely to show up in some other words that a person may say when the person isn't trying to interact with the voice bot. Therefore, some other names might be preferable, such as:

  • “Ruby” (no tongue movement makes this a rather lazy option... some computer programmers know a language called “Ruby”)
  • “Ariel” (a name famous from Disney's rendition of “The Little Mermaid”)
  • (or maybe “arrow”, which is a bit less common/traditional for a name, but a bit easier to say)
  • “Asha”
  • “Sasha”
  • “Babe” (or “Hey babe”)
  • Jill
  • Joy
  • Leah (Lee-uh)
  • Tess
  • Tessa
  • Tina

Some of these names are on a list of single-syllable female names. They were basically selected on how easy they are likely to be recognized.

The comment from the configuration file references a dictionary. CMU Spinx: CMUDict has a “Download Zip” button, and shows multiple individual dictionary files, including CMU Sphinx Dictionary. That dictionary shows not only words, but how the words are pronounced.

Optional: Edit the %ProgramFiles(x86)\Python35-32\lib\site-packages\athena\brain.py file. (Microsoft Windows users should do so from a text editor that has UAC-elevated permissions.) Change:

        print('  - "Athena (double beep) what\'s the weather like in DFW?"')         print('  - "Athena (double beep) what is the capital of Tanzania?"')         print('  - "Athena (double beep) open facebook.com"\n')
to:
        print('  - "' + settings.WAKE_UP_WORD + ' (double beep) what\'s the weather like in DFW?"')
        print('  - "' + settings.WAKE_UP_WORD + ' (double beep) what is the capital of Tanzania?"')
        print('  - "' + settings.WAKE_UP_WORD + ' (double beep) open facebook.com"\n')

Simiarly, in %ProgramFiles(x86)\Python35-32\lib\site-packages\athena\stt.py (from a UAC-elevated command prompt), change:

    print('~ Waiting to be woken up... ')
to
    print('~ Waiting for \'' + settings.WAKE_UP_WORD + '\' to be woken up... ')
and later, also change...
        print('\n~ Active listening... ')
to
        print('\n~ \'' + settings.WAKE_UP_WORD + '\' : Active listening... ')

The only cosmetically unpleasant part of this is that the initial code showed an uppercase name, but the WAKE_UP_WORD must be lowercase (or else Python will show a Traceback, report a RuntimeError, and discontinue the Athena module).

Using “Hey Athena”

Load Python, and have it run the main code from the Athena module.

python -c "from athena import __main__"
  • This involves two underscores before the word main, and two underscores after.
  • Another way is to first open up Python 3, and then, from its internal command line, run “from athena import __main__”, as shown in the following example session.
    C:\> python
    Python #.#.# (v#.#.#:############, MMM  D YYYY, hh:mm:ss) [MSC v.1900 32 bit (In tel)] on win32
    Type "help", "copyright", "credits" or "license" for more information. >>> blahblah
    >>>  from athena import __main__
  • The first time this is run, a few questions will be made about making a user:
    >>> from athena import __main__
    ~ Looking for APIs in: 'C:\Program Files (x86)\Python35-32\lib\site-packages\ath
    ena\api_library'
    ~ No users found. Please create a new user.

    ####################################
    #                                  #
    #    USER CONFIG FILE GENERATOR    #
    #                                  #
    ####################################

    ~ Please let me learn some things about you :)

    ~ Required fields are denoted with a '*'

    ##################
    #                #
    #    User Api    #
    #                #
    ##################

    * Username:(enter-username-here)

    ~ Input: (username-shows-here)
    ~ Confirm (Y / N): y

    Full Name: (enter user's name here)

    Nickname: (enter user's nickname here)

    Phone: (enter user's phone number)

    Email: (enter user's E-Mail address here)

    #####################
    #                   #
    #    Spotify Api    #
    #                   #
    #####################

    * Username: (username-shows-here)

    ~ Input: (enter user's username here)
    ~ Confirm (Y / N): Y

    * Password:(enter a password)

    ~ Input: (the password is shown here!)
    ~ Confirm (Y / N): y

    ~ Writing to: C:\Program Files (x86)\Python35-32\lib\site-packages\athena\data\u sers\(customized-username).yml
    ~ Success! You can now log in with this user.


    ~ Logged in as: (username-shows-here)
    ~ APIs: 'weather_api', 'voice_browse_api', 'spotify_api', 'user_api'
    ~ Looking for modules in: 'C:\Program Files (x86)\Python35-32\lib\site-packages\ athena\modules\active'
    ~ Module Order: 'athena_control', 'emotion', 'bitcoin', 'conversation', 'geo_inf o', 'music', 'spotify', 'twitter', 'voice_browse', 'weather', 'wolfram'

      _    _                      _   _
     | |  | |                /\  | | | |
     | |__| | ___ _   _     /  \ | |_| |__   ___ _ __   __ _
     |  __  |/ _ \ | | |   / /\ \| __| '_ \ / _ \ '_ \ / _` |
     | |  | |  __/ |_| |  / ____ \ |_| | | |  __/ | | | (_| |
     |_|  |_|\___|\__, | /_/    \_\__|_| |_|\___|_| |_|\__,_|
                   __/ |
                  |___/

    ~ Hey there, (your username)!

    ~ Try asking:
      - "Athena (double beep) what's the weather like in DFW?"
      - "Athena (double beep) what is the capital of Tanzania?"
      - "Athena (double beep) open facebook.com"

    ~ Waiting to be woken up...

    Hmm... a Bitcoin module? One may want to be careful when seeing an Open Source program, seemingly unrelated to Bitcoin, loading a Bitcoin module. For people who aren't involved in using Bitcoins, the concern is simply making sure that nobody is trying to profit from mining with your equipment (without foreknowledge approving of such a thing). In the case of “Hey Athena”, there is a known legitimate Bitcoin module. In fact, at the time of this writing, the Hey Athena website's introduction tutorial page shows a page named “Hello World” that shows a sample module, named hellow_world.py, which looks up the price of Bitcoin.

    ~ Active listening...
Quitting

Ctrl-Break worked well (in Microsoft Windows).

Another way is to say “Athena”, and then, after the couple of beeps, “quit”.

Another way is to try pressing Ctrl-C. If the user previously entered Python and then typed at Python's command line to load the Hey Athena module, then Python will show a “>>> ” prompt. Simply type “quit()” (followed by the Enter key).

If Python doesn't show that prompt, there may simply be a need to press Ctrl-C a second time. Once, however, the voice used by “Hey Athena” simply repeatedly said “Something went wrong.” Further Ctrl-C presses had no effect (but Ctrl-Break did stop the program).

Commentary on an example session

I simply said the word “Bitcoin”, hoping to get a Bitcoin price spoken to me.

~ Looking for APIs in: 'C:\Program Files (x86)\Python35-32\lib\site-packages\ath ena\api_library'

~ Logged in as: (username-shows-here)
~ APIs: 'user_api', 'voice_browse_api', 'spotify_api', 'weather_api'
~ Looking for modules in: 'C:\Program Files (x86)\Python35-32\lib\site-packages\ athena\modules\active'
~ Module Order: 'athena_control', 'emotion', 'bitcoin', 'conversation', 'geo_inf o', 'music', 'spotify', 'twitter', 'voice_browse', 'weather', 'wolfram'

  _    _                      _   _
 | |  | |                /\  | | | |
 | |__| | ___ _   _     /  \ | |_| |__   ___ _ __   __ _
 |  __  |/ _ \ | | |   / /\ \| __| '_ \ / _ \ '_ \ / _` |
 | |  | |  __/ |_| |  / ____ \ |_| | | |  __/ | | | (_| |
 |_|  |_|\___|\__, | /_/    \_\__|_| |_|\___|_| |_|\__,_|
               __/ |
              |___/

~ Hey there, (example username)!

~ Try asking:
  - "Athena (double beep) what's the weather like in DFW?"
  - "Athena (double beep) what is the capital of Tanzania?"
  - "Athena (double beep) open facebook.com"

~ Waiting to be woken up...

~ Active listening...

~ 'Bitcoin'

~ You are a fascinating human.


~ 424.48

~ Waiting to be woken up...

~ Active listening...

~ 'Bitcoin'

~ First let me say, today is a great day.


~ 424.2

~ Waiting to be woken up...

~ Active listening...

~ 'Bitcoin'

~ 424.19

~ Waiting to be woken up...

Well, I did get the desired goal accomplished. However, two of the times, there was also some additional output which wasn't expected. Why did it call me fascinating?

The answer appears to be that “Hey Athena” used the emotion module.

Another example
~ Waiting to be woken up...

~ Active listening...

~ 'what is the weather in Bellingham Washington'

~ Location: Bellingham, WASHINGTON

~ The condition in Bellingham, WASHINGTON is A few showers early with overcast s
kies later in the day. High 56F. Winds SSE at 10 to 15 mph. Chance of rain 30%.

~ Waiting to be woken up...

The first sentence was read just fine. (Instead of “South South-East”, it simply said “S S E”.) However, then it said “C H” (spelled out, pronounced like “see aych”). Umm... did the verbal part get passed a string of just 140 characters, and have the rest of the sentence be truncated?

Some other sample(s)
time
“time” quotes the current time. However, sometimes the single word might be less likely to be recognized (seemingly dismissed as if it is background noise), so you may actually get better results by asking “What time is it?”
Weather
checking current weather

“What is the weather in City, state?”

Athena will report what city and state the data is about, and then read the data.

If Athena doesn't figure out what city and state is being requested, the default seems to be “Austin, TX”.

forecast

“What is the forecast for tomorrow in City, state?”

or maybe: “List forecast for tomorrow in City, state?”

Athena will report what city and state the data is about, and then report the forecast. Multiple experiments showed that the forecast was silent; the voice did not read the forecast out loud.

If Athena doesn't figure out what city and state is being requested, the default seems to be “Austin, TX”.

Weather module

Additional modules

To see the modules:

dir "%ProgramFiles(x86)%\Python35-32\Lib\site-packages\athena\modules\active

HeyAthena.com API Modules (Active) shows some technical information about various modules. You can look at the module names, followed by the “Usage Examples” section of each module. This one page has such information for multiple pre-installed modules.

Another place you can find usage examples is at the top of each of the modules. Hey Athena modules... look under the entries that start with “athena.modules.active.”. Or, HeyAthena.com API Modules.

HeyAthena.com Tutorial page about modules

Problems
UAC preventing logging
Symptoms

After Athena calls greet(), it shows:
ERROR: "pocketsphinx.c", line 250: Cannot redirect log output
followed by a TraceBack.

Troubleshooting/verification

Find the log file. e.g.:

dir "%ProgramFiles(x86)\Python35-32\lib\site-packages\athena\data\logs\"

Then, try writing to that directory.

echo hi>> "%ProgramFiles(x86)\Python35-32\lib\site-packages\athena\data\logs\testout.txt"
ren "%ProgramFiles(x86)\Python35-32\lib\site-packages\athena\data\logs\passive-listen.log" "%ProgramFiles(x86)\Python35-32\lib\site-packages\athena\data\logs\passive-listen.old"

The inability to write to that directory is causing that file to be unwritable.

Solutions

First, a basic requirement will be to elevate privileges with UAC. This guide will be based on what to do after a user gets a UAC-enabled elevated command prompt. (See: user account control, pehraps especially Interacting with UAC from the command line.)

Once a UAC-elevated command prompt is obtained, if you just want a short-term fix, simply run Python from that elevated command prompt.

For a longer term fix, there is another approach which will then allow Python to be run without requiring the UAC command prompt.

notepad "%ProgramFiles(x86)\Python35-32\lib\site-packages\athena\settings.py"

(That should be done from the UAC-elevated command prompt. If notepad is started without suitable permissions, then there will be challenge with saving the updated file.)

Replace:

LOGS_DIR =      path.join(,   'logs'                    )

with:

LOGS_DIR =      path.join('C:\\Temp\\logs', '')

(A better location is likely something under %USERPROFILE%.)

Make sure that directory exists.

Once the text file is successfully saved, then verify that Python will gladly run the Athena module.