197 Lotus blogs updated hourly. Who will post next? Home | Blogs | Search | About 
 
Latest 7 Posts
Issues with IBM Connections 5 / 5.5 and Chrome 60
Fri, Aug 18th 2017 9
Connections 6 migration observations
Tue, Jul 25th 2017 11
It’s that time of year again ..
Fri, Jun 16th 2017 3
Let’s get Stitch talking – Project #talkie pt 3
Mon, Jun 5th 2017 10
Building the AIY – Project #talkie pt2
Sat, May 27th 2017 9
Who knew my love for StarWars would win me a prize
Sat, May 27th 2017 6
Project #talkie pt1 – getting to grips with a rasberrypi
Sat, May 27th 2017 8
Top 10
Connections 6 migration observations
Tue, Jul 25th 2017 11
Let’s get Stitch talking – Project #talkie pt 3
Mon, Jun 5th 2017 10
Can you spare an item to help raise money for two amazing causes?
Wed, Jan 13th 2016 9
Been kinda busy .. BUT
Thu, Mar 3rd 2016 9
A new challenge …
Tue, Jul 5th 2016 9
Migrating Connections DB from Oracle to DB2 part 1
Wed, Nov 23rd 2016 9
Building the AIY – Project #talkie pt2
Sat, May 27th 2017 9
Issues with IBM Connections 5 / 5.5 and Chrome 60
Fri, Aug 18th 2017 9
So Docs 2 CR1 and iFix 1 is not playing ball
Mon, Nov 28th 2016 8
Project #talkie pt1 – getting to grips with a rasberrypi
Sat, May 27th 2017 8


Let’s get Stitch talking – Project #talkie pt 3
Twitter Google+ Facebook LinkedIn Addthis Email Gmail Flipboard Reddit Tumblr WhatsApp StumbleUpon Yammer Evernote Delicious
Sharon    

So after building the kit and testing that it worked .. It was time to get creative ..

there are some examples on what to do code wise on the AIY kit voice site

First I had to go through the billing set up and processes. Even though the code is free, and the kit is free and they give you $300 worth of credit – you still have to set up billing. It was a pain as I already had a cloud dev account for some of the APIs I use on bit of my sites, but eventually I worked it out – I may have cussed a little. Once that was sorted and I created the credentials I needed I could copy those to the right place and I was good to start experimenting.

There is even a quick script that checks it all for you .. if there are any errors – you have missed a step.

 

 

 

 

 

 

 

 

 

 

 

 

 

Now its all set up to use the cloud speach API we are good to start playing.

First thing is to change the default API to use the cloud speech .. edit the

/home/pi/.config/voice-recognizer.ini

ensure that the cloud-speech = true line is uncommented

# Uncomment to enable the Cloud Speech API for local commands.
cloud-speech = true

Now we are all set to use local commands and not the google assistant.

Firstly I wanted to make sure I could get a sound to play when I pressed the button, in the /home/pi/voice-recognizer-raspi/src directory I created a new file and called it raspi-audio-button.py

#!/usr/bin/env python

import vlc

from time import sleep
 
import RPi.GPIO as GPIO
 
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN)

while True:
    if (GPIO.input(23) == False):
        p=vlc.MediaPlayer('file:///home/pi/Downloads/StitchSounds/hi.mp3')
        p.play()

    sleep(0.1);

This basically tells the AIY kit to play the hi sound when I press the button. After a bit of a fiddle to get vlc working (but that was my lack of skills) it works great .. I run the script from the src directory using the “dev terminal” on the desktop (which in turn is just another script /home/pi/bin/voice-recognizer-shell.sh) and it works ..

I press the button and the box says Hi in Stitch’s voice 🙂

 

 

Awesome ..  so lets move on to actually creating the code to get Stitch to talk.

 

Edit the action.py which lives in /home/pi/voice-recognizer-raspi/src

There are 2 chunks of code we needed to add ..

a class and a set of voice commands

 

The Class

We took the code from the RepeatAfterMe class and editied it .. I couldn’t have done this piece without my good friend Tim Clark who managed to work out what we needed to do to.

 

RepeatAfterMe Example

# Example: Repeat after me
# ========================
#
# This example will repeat what the user said. It shows how you can access what
# the user said, and change what you do or how you respond.

class RepeatAfterMe(object):

"""Repeats the user's command."""

def __init__(self, say, keyword):
 self.say = say
 self.keyword = keyword

def run(self, voice_command):
 # The command still has the 'repeat after me' keyword, so we need to
 # remove it before saying whatever is left.
 to_repeat = voice_command.replace(self.keyword, '', 1)
 self.say(to_repeat)

 

Stich Says Class

We have created the class below if the keyword = a certain word spoken the coresponding mp3 is played using vlc player

 

# STITCH : Classes
# ========================
#
# Classes to make Stitch talk are here
# 

class StitchSays(object):
    """Plays a Stich sound file based on the user's command."""

    def __init__(self, keyword):
        self.keyword = keyword


    def run(self, voice_command):
        keyword = self.keyword
        if keyword == 'Thanks':
            soundmp3 = "file:///home/pi/Downloads/StitchSounds/thankyou.mp3"
        elif keyword == 'Laugh':
            soundmp3 = "file:///home/pi/Downloads/StitchSounds/laugh.mp3"
        elif keyword == 'Nutty':
            soundmp3 = "file:///home/pi/Downloads/StitchSounds/nutty.mp3"
        elif keyword == 'No':
            soundmp3 = "file:///home/pi/Downloads/StitchSounds/noTalk.mp3"
        elif keyword == 'Sing':
            soundmp3 = "file:///home/pi/Downloads/StitchSounds/sing.mp3"
        elif keyword == 'Behind':
            soundmp3 = "file:///home/pi/Downloads/StitchSounds/ohana.mp3"
        elif keyword == 'With':
            soundmp3 = "file:///home/pi/Downloads/StitchSounds/withFamily.mp3"
        elif keyword == 'Love':
            soundmp3 = "file:///home/pi/Downloads/StitchSounds/loveyou.mp3"
        elif keyword == 'Name':
            soundmp3 = "file:///home/pi/Downloads/StitchSounds/nameStitch.mp3"

        p = vlc.MediaPlayer(soundmp3)
        p.play()

 

Once we have a class defined the keywords must be added. Again we used repeat after me as an example

    actor.add_keyword(_('repeat after me'),
                      RepeatAfterMe(say, _('repeat after me')))

 

We add the word I wll speak, then the class and keyword

For example I say "Thanks" and the thanks mp3 is played

    # =========================================
    # STITCH! voice commands here.
    # =========================================

    actor.add_keyword(_('Thanks'), StitchSays(_('Thanks')))
    actor.add_keyword(_('Giggle'), StitchSays(_('Laugh')))
    actor.add_keyword(_('Nutty'), StitchSays(_('Nutty')))
    actor.add_keyword(_('No'), StitchSays(_('No')))
    actor.add_keyword(_('Sing'), StitchSays(_('Sing')))
    actor.add_keyword(_('Oh'), StitchSays(_('Behind')))
    actor.add_keyword(_('Family'), StitchSays(_('With')))
    actor.add_keyword(_('Love'), StitchSays(_('Love')))
    actor.add_keyword(_('Name'), StitchSays(_('Name')))

 

This is probably not the most elegant way to do this .. but it WORKS ..

I was SO pleased that we managed to get this far ..

The issue now is that if the Pi can’t understand what i say .. it throws an error and speaks in the robot voice .. that is the next thing to fix – we will do that in part 4 of #projecttalkie

 

The post Let’s get Stitch talking – Project #talkie pt 3 appeared first on Social Shazza.



---------------------
http://feedproxy.google.com/~r/socialshazza/~3/WCfmVpveWC4/
Jun 05, 2017
11 hits



Recent Blog Posts
9
Issues with IBM Connections 5 / 5.5 and Chrome 60
Fri, Aug 18th 2017 9:58a   Sharon Bellamy
There is a known issue with Connections 5 CR4 and all versions of Connections 5.5 when using Chrome version 60. It affects events not being displayed and errors relating to events in the UI. It has also been reported that comments can be affected also. After multiple BP’s and Customers reported this IBM Support have come up with a fix very quickly. The fix you need is IFLO92844 – currently it is only available from IBM support – not sure how long it will be until it is availabl
11
Connections 6 migration observations
Tue, Jul 25th 2017 4:00p   Sharon Bellamy
I am sure that lots of you have installed or started migrations to Connections 6 by now .. but I have found a couple of gotchas across the installs and updates that I have managed so far. I am listing them here for sanities sake as I know when we google an error – this blog will show up Connections 6 itself Generally this was a nice smooth install and all worked as it should in a clean 6 environment On testing a migration though I found issues when trying to migrate some of the DBs. A
3
It’s that time of year again ..
Fri, Jun 16th 2017 5:38p   Sharon Bellamy
I am Running for Feel the Force Day …. My partner in crime Sam will be joining me again this year, along with Jonathan and Mandy will make up the #TeamRun4FTFD to raise funds. Jonathan has cerebal palsy and he doesn’t let that slow him down. Mad on trucks, cars and any kind of awesome vehicle (just see Shaw on Tour for details), he has recently done a bunch of exciting stuff including running (in a race chair), ice skating and trampolining. Mandy is the biscuit queen Famous for her
11
Let’s get Stitch talking – Project #talkie pt 3
Mon, Jun 5th 2017 2:41p   Sharon Bellamy
So after building the kit and testing that it worked .. It was time to get creative .. there are some examples on what to do code wise on the AIY kit voice site First I had to go through the billing set up and processes. Even though the code is free, and the kit is free and they give you $300 worth of credit – you still have to set up billing. It was a pain as I already had a cloud dev account for some of the APIs I use on bit of my sites, but eventually I worked it out – I may have
9
Building the AIY – Project #talkie pt2
Sat, May 27th 2017 11:55p   Sharon Bellamy
Before I could attempt to get creative with the code examples – we first had to build the kit and make sure it worked with the things and code that was provided. I have used the images from the aiyprojects.withgoogle.com/voice page. They are great pictures and show step by step how to put things together, I may have forgotten to take step by step pics as we built it too. Prep the SD Card With the voice SD image we downloaded in pt1 – use etcher to flash the SD card and get it ready f
6
Who knew my love for StarWars would win me a prize
Sat, May 27th 2017 10:29p   Sharon Bellamy
On May the 4th (also known as StarWars day – you work it out) one of my good friends and former co worker (not sure how he put up sitting opposite me for 2 and a half years ) Mr Dave Sheryn pinged me with an interesting link to a starwars costume competition .. “That’ll be fun”, I thought, “will give it ago .. have a snowballs chance in hell of winning” – so I posted this pic of me With the message O well if we are showing off star wars costumes .. thi
8
Project #talkie pt1 – getting to grips with a rasberrypi
Sat, May 27th 2017 9:45p   Sharon Bellamy
What’s all this #talkie stuff about then? So I have been posting stuff on facebook twitter and instragram with the #projecttalkie or #talkie hash tag .. Most of you know that I costume .. and as well as my love for star wars (and my mandalorian costume), I also LOVE to costume as Stitch … You can see me here as my favourite fluffy blue alien experiment (626) with my good pal and all around lovely Captain America friend Mr James Budd. Again most of you know that i am a HUGE supporte
5
Migrating Connections DB from Oracle to DB2 part 3
Sat, May 27th 2017 8:48p   Sharon Bellamy
In part 3 of the series we will actually attempt to migrate the data. Migrating Connections DB from Oracle to DB2 In my experience the database migration is always most time consuming, so I always do the database first Use the text file of Commands that we created in part 2. Back up the exisitng Connections databases Drop database, create database, app grants (for homepage also initdata, and re org and run stats) CR update scripts Pre DB fixer script Run the DBT command Application specific s
0
Docs 2.0 CR2 – here we go again
Sat, May 27th 2017 8:05p   Sharon Bellamy
I am blogging this mainly so I remember how to solve this Big thanks to fellow ICS community member and all round great guy Robert Farstad for blogging this Again you can see a problem when patching Docs 2 to CR2 as it can’t find the FQDN of the hosts. The code has changed so it’s not possible to use the work around that we had previously. There is a slight twist to getting it to work which Rob has explained fabulously so thank you mate .. you saved me a lot of grief .. and even IBM
1
Connections 6 system requirements are available
Wed, Mar 29th 2017 2:21p   Sharon Bellamy
thanks to my friend and co-speaker Roberto Boccadoro for sharing these .. you can find the system requirements for Connections 6 here The basic info is: WAS 8.5.5.10 IBM install manager 1.8.5 DB2 11.1.0 / Oracle 12.1.0.2.0 (enterprise) / MS SQL 2016 TDI 7.1.1 fix pack 6 Connections 6 is going to be released on Friday 31st of March – happy downloading and installing The post Connections 6 system requirements are available appeared first on Social Shazza.




Created and Maintained by Yancy Lent - About - Planet Lotus Blog - Advertising - Mobile Edition