Official website

Showing posts with label speech. Show all posts
Showing posts with label speech. Show all posts

Friday, February 3, 2017

Upgraded Android client with location-based check-in/check-out process

Check-in/check-out refers to built-in functions (%checkin%, %checkout%) and used to change the user status from present to absent (this also could be translated as locked/unlocked or arm/disarm flag to some) and vice versa. It also raises oncheckin/oncheckout events as described in AppConfig.xml. You can bypass defaults by using custom events (e.g. mycheckin/mycheckout).

Some things in technology are meant to be deprecated, but yet, it's our responsibility to follow and make upgrades, new versions and provide new features.

I’m always looking for the best approach to perform check-in/check-out operations when I arrive or leave home. Jubito has the check-in/check-out functionality that allows us to perform a sequence of tasks depending on the event. For instance, on check-in we can turn on an assistive light, disable the camera and motion detection, checking email, etc, and inverse actions on check-out.

In the early days, I used bluetooth scan as a means to check-in when my cellphone was in range, and check-out, when it was unreachable. Drawbacks such as limitation of bluetooth range, auto-disable to save battery when phone was idle etc, didn't make it the most preferable choice.

Then I introduced the Jubito client Android app that had the capability to track my device's location, checking if I was within radius of 500m of the point I’ve set as home and do the appropriate actions as described earlier, more elegant and with more precision.
Far from perfect also. For instance, the app had to run in foreground, but besides that, Google changed the API and service eventually stop working.

The ping methodology came along, which share the same concept as the bluetooth, with some drawbacks too. Of course, it's very valuable in other kind of scenarios, but still, not good for my check-in/check-out expectations.

Lately, I found some time to study the new API and decide to modernize and upgrade the app. Along with its old functionality, now can run  as a service in background, even if the phone is locked. By far the most convenient way, especially when we don't want to be distracted by manual input on phone and be spared the extra effort.
It is a very nice feel, returning home, and this would be ready welcomes you by your preferences! Trust me on that!

Usage is straightforward. First you need to enable location from android settings. If not, and you have auto check-in/check-out checked, you will be prompted to. To take effect you need to kill the app from task manager and re-open it.
Next, from Jubito app settings, select your location by pressing the button "Get Location". On apply, selected address will be set as your home point.


Location services allow app to obtain periodic updates of the device's geographical location, and fire an application-specified event (check-in/check-out) when the device enters the proximity of a given geographical location. In our case, within 500m radius of the home location.

Before I close, let's recap what features app brings besides serving Jubito UI.
  • Speech Recognition & Synthesizer. It allows to execute Instruction Sets with speech dictation and speak the result if any.
  • Location & Geocoder. Reverse geocoding is the process of transforming a (latitude, longitude) coordinate into a (partial) address. That allows the app to get location data (lat/long) and reverse it to an address in order to be user friendly. By pressing the "Get Location" button you can set your home location automatically.

Closing this post with the setup of my preferences.
oncheckin, oncheckout events:

<event id="oncheckin">%unmute%; *socket-d-on; salute; judo schedule enable mailcheck</event>
<event id="oncheckout">init; judo sleep 30000; goodbye;  lights_off; judo schedule disable mailcheck; %mute%</event>

Let's take a deeper look on implementation.
All steps can be made from the UI, but in this particular article I'd like to go behind the scenes for robust understanding.

Check-in Steps
%unmute% & %mute% are also built-in functions that disable/enable the speech synthesis. *socket-d-on is a pointer to the InstructionSet that turn on an assistive light. In my case the living room right. You can also evaluate the light conditions before proceeding.

<InstructionSet id="*socket-d-on">judo serial send 000000000101010100010001</InstructionSet>
<InstructionSet id="socket-d-on" descr="Turns on living room light" shortdescr="Living room light on" header="Socket D on" categ="Automation">*socket-d-on</InstructionSet>

Salute is what it says and implements like this...

<InstructionSet id="salute">Good %salute% %user%.</InstructionSet>

%salute% function returns the part of day e.g. morning, afternoon. %user% returns the logged user. So, the above will return "Good afternoon john" and vocalized by speech-synthesis.
judo schedule enable mailcheck, enable the gmail check that is scheduled to check every 5 minutes.

Check-out Steps
init command, just speak Initiate sequence.

<InstructionSet id="init">Initiate sequence</InstructionSet>

judo sleep 30000, is a 30 seconds sleep timer, to allow me leave the place without triggering anything.

goodbye command, again a simple goodbye verbal message.

<InstructionSet id="goodbye">Good bye %user%.</InstructionSet>

lights_off command, turn off any assistive light.

<InstructionSet id="*socket-a-off">judo serial send 000000000100010101011111</InstructionSet>
<InstructionSet id="*socket-b-off">judo serial send 000000000101000101010100</InstructionSet>
<InstructionSet id="*socket-c-off">judo serial send 000000000101010001010100</InstructionSet>
<InstructionSet id="*socket-d-off">judo serial send 000000000101010100010100</InstructionSet>
<InstructionSet id="lights_off" descr="Turns off the bedroom and living room lights" shortdescr="Bedroom and living room lights off" header="Lights off" categ="Automation">*socket-a-off *socket-b-off *socket-c-off *socket-d-off</InstructionSet>

An old showcase video.

Finally, the last two are self-described. judo schedule disable mailcheck; %mute%, disable mail check and speech-synthesis.

Binaries (000000000100010101011111) in above example, control appliances and explained in this how-to.

A basic Wiki for judo API and built-in functions.

In action...


I plan to make more enhancements in future versions. For example, change the radius, add zones on specific ranges and do different tasks (at 10m open garage door), etc.

Sunday, November 30, 2014

Set up a Gmail notifier

After setting up your gmail account, here's the post to show you how to use the %gmailcount% function to create a gmail notifier.

Go to Control Panel/Mail/Setup/Gmail


Type your username and your password and hit save.


Now we need to make a few scenarios. For instance when emails are more than one then respond with the number of them and so forth. But before we get into that, first we need to create the responses.

Go to Instruction Sets menu, hit Add New Instruction Set Add New Launcher and follow the screenshots. [ Update: For a more efficient way to create responses please read this post. ]

No new messages.
 You have, 1, unread message to your g-mail inbox.
You have, %gmailcount%, unread messages to your g-mail inbox.

Now we have to apply the logic we're talking about in a new Instruction Set.


In the action field copy/paste the following evalBool function...

{ evalBool(%gmailcount% <= 0); no-messages; ; } { evalBool(%gmailcount% == 1); gmail-one; ; } { evalBool(%gmailcount% > 1); gmail-count; ; }


One of each conditions will be evaluated and trigger the corresponding reply.

Finally we can make a daemon with the Scheduler, to perform checks every 5 minutes. From Scheduler menu hit Add New and type a name, select repeat in the period drop down, time in milliseconds e.g. 300000 for 5 minutes and action the Instruction Set that calls the evalBool function i.e. gmail. To avoid getting 'No new messages' every time, make a new Instruction Set that missing the no-messages evaluation.


Saturday, July 19, 2014

Jubito android app with voice control

The new coveted feature that incorporated in the new version of jubito app (v1.2) is the speech recognition and speech synthesis. It allows us to hit the speech button and come out with a preferred command. That means that from now on your instruction set names (including launchers and events) must listed speech friendly.


Assume that we have three different Instruction Sets that give us the weather conditions. Let's say 'weather today' that consists of a set of today's conditions, 'weather tomorrow' for the day after and 'forecast' for both situations.

For the example to take effect you need to check your weather settings.

Go to Control Panel/Instruction Sets/Add New Instruction Set enter weather_today as name (id) and set the line bellow as action...

Today %todayday% in Athens, %todayconditions%, between %todaylow% and %todayhigh% degrees.


For the other two options you can use...

weather_tomorrow
Tomorrow %tomorrowday% in Athens, %tomorrowconditions%, between %tomorrowlow% and %tomorrowhigh% degrees.

forecast
Today %todayday% in Athens, %todayconditions%, between %todaylow% and %todayhigh% degrees. Tomorrow %tomorrowday% in Athens, %tomorrowconditions%, between %tomorrowlow% and %tomorrowhigh% degrees.


Optionally fill description and any other field you want in order to be accessed from the dashboard.


The % enclosures represents the built-in functions that are responsible to translate the retrieved weather data to values. Find more weather functions.

Now open the app and press speech button. The approach is very simple, we just speak the instruction set id (name) and its posted to the server. Once it acknowledged we'll be able to hear the response (from speech synthesis) or see any kind of action that use this example, for instance turn on an appliance. The only limitation we should conform is that we need to replace blank spaces with underscores. Update: Latest versions of Jubito, automatically replace blanks with underscores.


Alternatively before create an instruction set you can perform a preferable command and see how it prints out.

Enjoy!

Video demo

Wednesday, May 28, 2014

Speech Synthesis & Server Installation [ Revised ]

The new core library (libJanet.dll 0.2.4) is speech independent and not a mandatory module in Jubito ecosystem. That means that you install a speech system at choice. It is convenient for those who don't have a sound card to their server and/or don't want to install extra software. However it can be installed later in case of need. Jubito will automatically determine when a speech widget is available.

For Windows version you have to install Speech SDK and copy jspeech.exe to directory where Jubito-server.exe is located.


For the Linux version install the festival speech synthesis system.
Open a terminal and type...

sudo apt-get install festival

Jubito Server Installation Process
To run Jubito server on Windows you need .NET Framework 4.0 and later and Mono for Linux (sudo apt-get install mono-complete). Then download and extract Jubito server in a directory of your choice. Please make sure you have setup properly the Jubito Server.
Additional information might be available at download section.

For the record, whether version you download will work fine at any OS in any case. The core library (libJanet.dll) is common and the only difference is the server GUI implementation which is Windows Forms & Gtk#.


0.2.4 version changes can be found here.

Friday, March 22, 2013

Linux voice configuration

The voice-installer script from download area installs the cmu_us_slt_arctic voice [1]. By default it's set to US English slt (female) voice. In this post we'll see how to make a different selection.

First listen voice examples here and choose which one you want to use. Then download the package from here and modify the voice-installer script to use that file. When installation completes, edit /etc/festival.scm file and jump to CMU Arctic voices. Comment the default one (in yellow) with double semicolons (;;) and remove them from your desirable choice. This is it. Save and close the file and you're done!

;;;; CMU Arctic voices
;;(set! voice_default 'voice_cmu_us_rms_arctic_clunits)
;;(set! voice_default 'voice_cmu_us_bdl_arctic_clunits)
(set! voice_default 'voice_cmu_us_slt_arctic_clunits)
;;(set! voice_default 'voice_cmu_us_clb_arctic_clunits)
;;(set! voice_default 'voice_cmu_us_awb_arctic_clunits)
;;(set! voice_default 'voice_cmu_us_jmk_arctic_clunits)

[1] By default the script checks if festival exists. If not, will ask you to install. Then you should re-run the script to proceed to voice installation.

* Automated scripts will follow for all arctic voices.