Amazon Polly + Google Home + Sonoff wifi [P018]





https://www.youtube.com/watch?v=IX2mUb73he8


GitHub : https://github.com/rdiot/rdiot-p018.git


* Parts

Google Home AI Speaker [B187]

Sonoff ITEAD WiFi Switch Module (ESP8266) [S198]

Amazon Polly TTS [P017]


* Contents

- Install AWS CLI in Raspberry Pi

wget https://s3.amazonaws.com/aws-cli/awscli-bundle.zip

$ unzip awscli-bundle.zip 

$ sudo ./install -i /usr/local/aws -b /usr/local/bin/aws


- Config AWS CLI

$ aws configure


- Java amazon polly development

 : maven : pom.xml : https://github.com/rdiot/rdiot-p018/blob/master/pom.xml

 : Source : https://github.com/rdiot/rdiot-p018/blob/master/PollyDemo.java

 : Binary :  polly_sonoff.tar.gz

 : command.txt : ON or OFF 



- Sonoff Work with Google Home 

- How to connect Sonoff smart ewelink to Google Assistant

1) Tap Home control in Googlt Home App Menu

2) Uner Devices, tap the + icon in the bootom right. (add devices)

3) Tap Smart We Link 

4) Enter Your eWeLink account email/phone number. (need countrycode and account, password)

5) After Logging in successfully, it will display the device.




- Run java amazon polly application

$ java - jar polly-0.0.1-SNAPSHOT.jar 



Posted by RD IoT RDIoT

댓글을 달아 주세요

Amazon Polly TTS(Text to Speech) [P017]





https://www.youtube.com/watch?v=1ehU_bueWdQ


GitHub : https://github.com/rdiot/rdiot-p017.git


* Specs

Amazon Polly is a service that turns text into lifelike speech, allowing you to create applications that talk, and build entirely new categories of speech-enabled products. Amazon Polly is a Text-to-Speech service that uses advanced deep learning technologies to synthesize speech that sounds like a human voice.


With dozens of lifelike voices across a variety of languages, you can select the ideal voice and build speech-enabled applications that work in many different countries.


* Contents

- Install AWS CLI in Raspberry Pi

wget https://s3.amazonaws.com/aws-cli/awscli-bundle.zip

$ unzip awscli-bundle.zip 

$ sudo ./install -i /usr/local/aws -b /usr/local/bin/aws


- config AWS CLI

$ aws configure


- java amazon polly library and text file


- run amazon polly application


- binary library download :  polly.tar.gz


- maven dependency 

 : https://github.com/rdiot/rdiot-p017/blob/master/pom.xml

<dependency>

<groupId>com.amazonaws</groupId>

<artifactId>aws-java-sdk-polly</artifactId>

<version>1.11.77</version>

</dependency>

<!-- https://mvnrepository.com/artifact/com.googlecode.soundlibs/jlayer -->

<dependency>

<groupId>com.googlecode.soundlibs</groupId>

<artifactId>jlayer</artifactId>

<version>1.0.1-1</version>

</dependency>


- Souce Code

 : https://github.com/rdiot/rdiot-p017/blob/master/PollyDemo.java


package com.rdiot.polly;


import java.io.BufferedReader;

import java.io.FileInputStream;

import java.io.IOException;

import java.io.InputStream;

import java.io.InputStreamReader;


import com.amazonaws.ClientConfiguration;

import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;

import com.amazonaws.regions.Region;

import com.amazonaws.regions.Regions;

import com.amazonaws.services.polly.AmazonPollyClient;

import com.amazonaws.services.polly.model.DescribeVoicesRequest;

import com.amazonaws.services.polly.model.DescribeVoicesResult;

import com.amazonaws.services.polly.model.OutputFormat;

import com.amazonaws.services.polly.model.SynthesizeSpeechRequest;

import com.amazonaws.services.polly.model.SynthesizeSpeechResult;

import com.amazonaws.services.polly.model.Voice;


import javazoom.jl.player.advanced.AdvancedPlayer;

import javazoom.jl.player.advanced.PlaybackEvent;

import javazoom.jl.player.advanced.PlaybackListener;


public class PollyDemo {


private final AmazonPollyClient polly;

private final Voice voice;

//private static final String SAMPLE = "Polly Test";

private static String SAMPLE;

public PollyDemo(Region region) {

// create an Amazon Polly client in a specific region

polly = new AmazonPollyClient(new DefaultAWSCredentialsProviderChain(), 

new ClientConfiguration());

polly.setRegion(region);

// Create describe voices request.

DescribeVoicesRequest describeVoicesRequest = new DescribeVoicesRequest().withLanguageCode("en-US");

// Synchronously ask Amazon Polly to describe available TTS voices.

DescribeVoicesResult describeVoicesResult = polly.describeVoices(describeVoicesRequest);

voice = describeVoicesResult.getVoices().get(0);

        

}

public static String roadLocalFile(String filepath) {

    String readFile= "";

    try {

        BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(filepath),"UTF-8"));

        String s;

        while ((s = in.readLine()) != null) {

            readFile+= s;

        }

        in.close();

    } catch (IOException e) {

        System.err.println(e);

        System.exit(1);

    }

 

    return readFile;

}


public InputStream synthesize(String text, OutputFormat format) throws IOException {

SynthesizeSpeechRequest synthReq = 

new SynthesizeSpeechRequest().withText(text).withVoiceId(voice.getId())

.withOutputFormat(format);

SynthesizeSpeechResult synthRes = polly.synthesizeSpeech(synthReq);


return synthRes.getAudioStream();

}


public static void main(String args[]) throws Exception {

SAMPLE = roadLocalFile("./text.txt");

//create the test class

PollyDemo helloWorld = new PollyDemo(Region.getRegion(Regions.AP_NORTHEAST_2));

//get the audio stream

InputStream speechStream = helloWorld.synthesize(SAMPLE, OutputFormat.Mp3);


//create an MP3 player

AdvancedPlayer player = new AdvancedPlayer(speechStream,

javazoom.jl.player.FactoryRegistry.systemRegistry().createAudioDevice());


player.setPlayBackListener(new PlaybackListener() {

@Override

public void playbackStarted(PlaybackEvent evt) {

System.out.println("#################################################################");

System.out.println("RD IoT Amazon Polly TTS");

System.out.println("#################################################################");

System.out.println("Playback started");

System.out.println("-----------------------------------------------------------------");

System.out.println("TTS : " + SAMPLE);

}

@Override

public void playbackFinished(PlaybackEvent evt) {

System.out.println("-----------------------------------------------------------------");

System.out.println("Playback finished");

System.out.println("#################################################################");

}

});

// play it!

player.play();

}


}




Posted by RD IoT RDIoT

댓글을 달아 주세요

 Google Home AI Speaker [B187]






https://www.youtube.com/watch?v=swZtIL98IKY


* Specs

Dimensions

Diameter: 3.79 in (9B6.4 mm)

Height: 5.62 in (142.8 mm)

Power cable: 70.8 in (1.8 m)


Weight

Device: 1.05 lbs (477 g)

Power adapter: 4.58 oz (130 g)


Colors

Body: White


Base: Standard base is slate fabric.


Supported Audio Formats

HE-AAC, LC-AAC+, MP3, Vorbis, WAV (LPCM), FLAC with support for high-resolution streams


Wireless network

802.11b/g/n/ac (2.4GHz/5Ghz) Wi-Fi for high-performance streaming

Note: WPA2-Enterprise is not supported.


Speaker

High excursion speaker with 2" driver + dual 2" passive radiators delivers clear highs and rich bass

Far-field voice recognition supports hands-free use


Power

Required 16.5V, 2A included


Power Adapter

100-240V-1.1A 50-60Hz


Ports & Connectors

DC power jack

Micro-USB port (for service only)


Supported Operating Systems

Android 4.1 and higher

iOS 8.0 and higher


* Contents

https://madeby.google.com/home/

Home Improvement Home Automation Smart Home Kits and Hubs

Powered by your very own Google assistant, Google Home is designed to help streamline your life and manage your everyday tasks. On hectic mornings, get your daily schedule, traffic, and flight info, or set an alarm by saying, Ok Google, wake me up tomorrow at 6:30am. Simplify your shopping duties by telling Google to add things to your shopping list, or use it to set a timer to keep you on track. And there's more ? you can ask it questions, tell it to do things, and use it to stream entertainment to your TV with Chromecast. It's your own Google, always ready to help. Just start by saying, "Ok Google."

Google Home:

Enjoy your music

With a simple voice command, play tunes from services like YouTube Music and Google Play Music. Enjoy even more compatible audio services by streaming directly from your phone to Google Home.

Get answers from Google

Get answers to things you want to know including the latest on weather, traffic, finance, sports and more. Plus, get information to help you do things in your world. Ask "What is the nearest pharmacy" and follow it up with "When does it close"

Manage your everyday tasks

With your permission, Google Home can help you with things like your commute, flight information and more. Plus it's a whiz at setting alarms, starting timers and adding items to your shopping list.

Control compatible smart devices

Simply ask Google Home to stream videos to your TV with Chromecast or to turn up your Nest thermostat.

Get superior sound and voice technology

Google Home's high excursion speaker delivers HiFi sound quality. It can also hear you reliably thanks to far-field microphones.


- Control by TTS (Amazon Polly)

<speak>
OK Google <break time="2s" />
What is google home?
</speak>


- Reference 

google home : https://madeby.google.com/home/

google home help : https://support.google.com/googlehome/topic/7196250?hl=en&ref_topic=7029677,7029097,7029808,



'7) IoT_AI > AI Speaker' 카테고리의 다른 글

Google Home AI Speaker [B187]  (0) 2018.03.22
SKT NUGU AI Speaker Ordering Pizza [B186.1]  (0) 2016.12.10
SKT NUGU AI Speaker [B186]  (0) 2016.11.28
Posted by RD IoT RDIoT

댓글을 달아 주세요