Tingmao: Alexa client

It became apparent this week that we simply can’t use the test client on production, even though we had no other working solution. Specifically, the test alexa client page requires user to press down on the mic icon to speak to Alexa (as opposed to doing any sort of hot word detection), and user must release the mic when they finish speaking to let Alexa process the response. This means that we either have to implement both hot-word detection and speech-finish detection ourself, or find an alternative Alexa client for the project.

Some weeks ago, Brandon had some success running the official C++ client. However, when he tried to write the response audio data to an external file, the audio file come out corrupted. I tried to set up the client myself and asked Brandon for the code he used to hook and export the audio response, and I realized what’s wrong before after looking at the code:

std::ofstream out("result.mp3");
// ...
out.write(buf, len);
// ...

As it turns out, C++’s ofstream default to text mode, which will cause line terminators to be convered to the platform native format. However, our audio data (which is mp3) is obviously not text data, so we need to supress this behaviour. Changing the first line to:

std::ofstream out("result.mp3", std::ios::binary);

eventually solved the problem.

Victoria: Website updating

This week, I updated the website with our new requirements and added some more content to the home page - including a Gantt chart for our progress. I also added the personas, sketches and prototype from our HCI assignment and created a use case diagram and list.

Kaloyan: Getting the best route to each room

Being able to detect where the rooms are, this week I started working on getting the best route to each room. The algorithm for this is quite simple.

  1. It uses objects, to represent each possible route, that consist of the pixels the current route has already passed by, length of the route and the staright line distance from the last pixel to the desired end of the route. These objects are kept sorted in a linked list, based on the sum of the length of the route and the remaining distance.

  2. It starts from the pixel where the assistant is and from the 9 pixels around it creates 9 objects.

  3. After the initial 9 objects are created, it takes the first one (they are sorted, so this is the one which has the smallest sum of length and distance) and creates new objects from the pixels around it that haven’t been used. These objects contain the intial object’s list of previous pixels and add the new pixels to it.

  4. Step 3 is repeated until an object with distance to the end 0 is created. This is assumed to be the best route.