VOOZH about

URL: https://qiita.com/ikasamah/items/48ca06c5a4e0421b8756

⇱ Google Homeに任意の言葉を喋ってもらう方法 Golang編 #GoogleHome - Qiita


👁 Image
32

Go to list of users who liked

36

Share on X(Twitter)

Share on Facebook

Add to Hatena Bookmark

More than 5 years have passed since last update.

@ikasamah

Google Homeに任意の言葉を喋ってもらう方法 Golang編

32
Last updated at Posted at 2018-02-11

Google Homeに任意の言葉をしゃべって欲しい、そんな時ってありますよね?

現在は google-home-notifier というプログラムを使う方法が主流ですが、
この記事では、Goのパッケージを利用した方法を紹介します。

コードの取得

# Goがインストールされていない場合
# $ brew install go

$ go get -u github.com/ikasamah/homecast

サンプル実行

まずは example を起動してみます

$ go run $GOPATH/src/github.com/ikasamah/homecast/example/main.go

# GOPATHが設定されていない場合は以下
# $ go run ~/go/src/github.com/ikasamah/homecast/example/main.go

これで、ローカルネットワーク内のGoogle Homeが Hello Worldと喋ります。

次は、サンプルのHTTPサーバーを起動しましょう。

$ go run $GOPATH/src/github.com/ikasamah/homecast/example/server.go

サーバーが起動したら、ブラウザ等で次のURLにアクセスしましょう
http://localhost:8080/?text=こんにちは&lang=ja

textパラメータで指定された内容をGoogle Homeが喋ってくれます。

32

Go to list of users who liked

36
1

Go to list of comments

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
32

Go to list of users who liked

36