Skip to content

v1.0.75

Choose a tag to compare

@github-actions github-actions released this 31 Oct 13:45
· 5 commits to main since this release

変更内容

1.0.59〜1.0.75: 声でスマホを操作できるようにしました。話した言葉を文字にするところから、曲送りやナビまでつながります。認識は端末の中だけで、声をネットへ出しません(Android 12 以降)。

(1) 声で操作

  • クイック設定の「声で操作」タイルか、端末の「デジタル アシスタント アプリ」に z2term を選ぶと(電源ボタン長押しなどで開けます)、小さな聞き取りの画面が出ます。話した内容は voice イベントになり、z2-when event:voice のルールで好きな操作につなげられます。
  • 受け口のマクロ voice を同梱しました。z2-macro install voice と sh ~/.z2term/macros/voice.sh setup で、「次の曲」「音量3段階下げて」「3分のタイマー」「7時に起こして」「明日の朝7時にゴミ出しをリマインド」「天気」「ニュース」「メモ牛乳を買う」「◯◯に電話」「◯◯を開いて」が使えます。「何ができる」で一覧が通知に出ます。
  • ナビと施設の電話番号: 「東京駅までナビ」「東京駅に行きたい」「東京駅の電話番号」で、端末の地図アプリがその場所を開きます。「ナビ」とだけ言うと、そのまま行き先を聞きます。
  • アプリを開く: 名前が英字のアプリも、カタカナの読みで開けます。「ブラウザ」「地図」「カメラ」「設定」などの種類の言葉では、端末の既定のアプリが開きます。開けないアプリは呼び名を登録できます。
  • 画面ロック中も使えます。ロック中は曲・音量・時刻・天気・タイマーなど、誰がしても困らないものだけをその場で動かします。電話・アプリ・ナビ・メモなどは、ロックを解除すると続けて動きます。
  • 言葉は言語ごとの言葉の表にあり、sh ~/.z2term/macros/voice.sh words で開いて言い方を足せます(日本語・英語・中国語(簡体・繁体)・スペイン語・韓国語)。voice.sh try <言葉> で話さずに試せ、voice.sh listen で端末から聞き取りの画面を開けます。AI への質問は最初はオフで、voice.sh ai <名前> でオンにします。

(2) 話した内容を文字にする

  • z2-listen: text=$(z2-listen) で話した内容を受け取れます。z2-listen -w "次の曲,止めて" なら、並べた言葉のどれかを言ったときだけ当たった言葉を出します。同じ読みの別の漢字で聞こえても当たります。
  • キーボードに 🎤 キー(voice_input)を足しました。既定のキーボードでは ⏎ を左にはらうと声で入力できます。Enter は押さないので、内容を見てから送れます。全部大文字で聞こえた英字の語(「エル エス」→ LS)は小文字にして入れます。

(3) 読み上げを途中で止める

  • z2-say で話している間は、話している文を出した通知が出ます。通知の「止める」、「声で操作」タイル、同じ音量ボタンの素早い 2 回押し(0.3 秒以内)のどれでも止められます。ふつうに押せば、今までどおり音量が変わります。

(4) 文字ファイルの編集画面 z2-edit

  • z2-edit <ファイル> で、文字ファイルを z2term の編集画面で書き換えます。ふつうの入力欄で直し、「保存」で元のファイルへ書き戻します。2 本指のピンチで文字の大きさを変えられます。
  • z2-intent に種類を指定する -c を足しました(-a android.intent.action.MAIN -c android.intent.category.APP_BROWSER で既定のブラウザ、など)。

Changes

1.0.59–1.0.75: You can now run the phone by voice, from turning speech into text all the way to skipping tracks and navigating. Recognition stays on the device and your voice never leaves it (Android 12 and later).

(1) Voice command

  • Add the "Voice command" tile to quick settings, or choose z2term as the device's digital assistant app (then it opens with a long press of the power button and the like), and a small listening screen appears. What you say becomes a voice event that a z2-when event:voice rule can connect to anything.
  • A receiver macro, voice, is bundled. After z2-macro install voice and sh ~/.z2term/macros/voice.sh setup, "next song", "volume down 3", "set a timer for 3 minutes", "wake me up at 7", "remind me to take out the bins tomorrow at 7 am", "weather", "news", "note buy milk", "call …" and "open …" work, and "what can I say" puts the list in a notification.
  • Navigation and a place's phone number: "navigate to Tokyo Station", "take me to …" and "phone number of …" open the place in the phone's map app. Saying just "navigate" asks for the destination right away.
  • Opening apps: an app opens even when you say its name the way it sounds rather than as it is written. Kinds of app such as "browser", "maps", "camera" and "settings" open the phone's default one, and you can give a nickname to an app that still does not open.
  • It works on the lock screen. While locked, only things that are fine for anyone to do — music, volume, time, weather, timers and so on — run at once; calls, apps, navigation, notes and the like go on once you unlock.
  • The words live in a word table per language; sh ~/.z2term/macros/voice.sh words opens it to add ways of saying things (English, Japanese, Chinese (Simplified and Traditional), Spanish and Korean). voice.sh try <phrase> tries one without speaking, and voice.sh listen opens the listening screen from a terminal. Asking AI is off at first; turn it on with voice.sh ai <name>.

(2) Speech to text

  • z2-listen: text=$(z2-listen) gives you what was said. With z2-listen -w "next song,stop" it prints the matching phrase only when you say one of them, even when it is heard as a different word that sounds the same.
  • The keyboard gets a 🎤 key (voice_input). On the default keyboard, swipe ⏎ to the left to type by voice. Enter is not pressed, so you can check before sending. A Latin word heard all in capitals is typed in lower case.

(3) Stopping speech midway

  • While z2-say speaks, a notification shows the sentence being spoken. "Stop" in it, the "Voice command" tile, or a quick double press of the same volume button (within 0.3 s) stops it. Normal presses still change the volume.

(4) z2-edit, an editor for text files

  • z2-edit <file> opens a text file in z2term's own editor. Change it in a plain text box and "Save" writes it back to the file. Pinch with two fingers to change the text size.
  • z2-intent gets -c to give a category (-a android.intent.action.MAIN -c android.intent.category.APP_BROWSER opens the default browser, and so on).

Full Changelog: v1.0.58...v1.0.75