Skip to content

allpaqa-jgk/twitch_text_to_speech_bot

Repository files navigation

twitch text to speech bot for MacOS (, windows and linux via GoogleCloudTTS)

!!CAUTION!! / 注意
!!this readme might be incorrect / このREADMEは正しくない可能性があります!!

Concept / コンセプト

  1. Just double click and ready / ダブルクリックで起動するだけで使える
  2. No third party app for TTS (e.g. limechat) / メイン機能のTTSでは別のアプリケーション不要(limechatなど)
  3. Remember command for username and keywords / ユーザー名やキーワードを教育
  4. Listeners can check chat log before open the stream / 配信を開く前のチャットログをリスナーさんが見れる
    • This is using discord... / discordを利用します。。
    • Using discord, streamer can receive comment as notification of discord even if streaming with (via) iPhone or iPad. (e.g. I can't see "PC monitor" during playing Music Game)
      / discordを使うことでiPhone, iPad配信でもコメントを通知として受け取れます。(音ゲー中などPCを見れない場合でも通知であれば見れるという人
  5. TTS and Discord transfer functions should be turned off individually / TTSやdiscord転送は個別に使用・未使用を切り替えられる

Functions / 機能

  1. speak comment(this is main function. but optional) / コメントの読み上げ
    • comment will be converted to voice data via say command. / Macのsayコマンドを使ってtwitchのコメントを読み上げます
      ( Google TTS version is now developing. / Googleのテキスト読み上げサービスを利用したバージョンも開発中 )
    • add !remember {keyword}={how_to_read} and !forget {keyword} command for text to speech /
      読み方の教育機能つけました。!remember {keyword}={how_to_read} で教育、!forget {keyword}で忘却
    • add !dice {options} command. / !dice コマンド
      e.g.
      !dice 1d6 3d4 => throw one normal die, and three 4-sided dice /
      !dice 1d6 3d4 => 普通のサイコロを1個、4面サイコロを3個振る
  2. transfer comments to discord(optional)
    • if notification setting of discord was ON, you can receive comment as notification on mobile devise during streaming iOS games or something /
      discordの通知をONにしておけば、スマホ・タブレットなどでコメントを通知として表示できます。音ゲーなんかで目を離せない場合に便利

Requirement / 必要なもの

  • Generous heart(mandatory) / 優しい心(必須
  • Courage to talk to me when something wrong(optional) / 何かあったときに僕に話しかける勇気(任意

Mandatory for source use / sourceから使う場合に必須

  1. node(~12.6.0)
  2. yarn(~1.15.2)

Mandatory / 必須

  1. for text to speech / 読み上げに必要なもの

Optional / 省略可能

  1. for text to speech / 読み上げに必要なもの
    • mac
      1. install voice data via config / 音声データのインストール
    • cloudTTS ( 1~4 of GCP TTS document)
      1. create or login to GCP / 既存のGCPプロジェクトへログインor作成
      2. make new service accout for cloudTTS / cloudTTS 用のサービスアカウント作成・DL
      3. setup serviceAccount.json file to use (there is 2 method) / serviceAccount.json ファイルを使えるようにセットアップ(2つの中から好きな方法で)
        • place file in config dir / config フォルダへファイルを設置
          1. save to config dir as serviceAccount.json / config フォルダの中に serviceAccount.json という名前で保存
          2. ( OR
            • remove .sample from filename of config/serviceAccount.json.sample / config/serviceAccount.json.sample のファイル名から .sample を削除
            • paste contents of downloaded service account file / DLしたファイルの中身をリネームしたファイルにペースとして保存
        • add GOOGLE_APPLICATION_CREDENTIALS of Environment variable / 環境変数 GOOGLE_APPLICATION_CREDENTIALS へpathを追加
  2. for transfer to discord / discordへの転送に必要なもの

How to use / 使い方

Install / インストール

Using binary / こちらでビルドした実行ファイルを使う

  1. move to latest release / latest releaseに移動: https://github.com/allpaqa-jgk/twitch_text_to_speech_bot/releases/latest
    • download as zip & unzip / zipで落として解凍
    • download binary and place to same folder / 実行ファイルをDLして同じフォルダへ配置
      • mac: twitch_text_to_speech_bot
      • windows: twitch_text_to_speech_bot.exe
    • edit config/default.js / コンフィグファイルセットアップ

Using source / ソースコードからyarn, nodeで使う

  1. download this repo / 下記の中から好きな方法でリポジトリをダウンロード
    1. clone / クローン
      • use HTTPS
        • git clone https://github.com/allpaqa-jgk/twitch_text_to_speech_bot.git
      • use SSH
        • git clone git@github.com:allpaqa-jgk/twitch_text_to_speech_bot.git
  2. install node / nodeのインストール
    1. install using(homebrewを利用する場合
      • mac: run brew install node
    2. use n or nodenv / (nnodenvを使いたい人はご自由にどうぞ
  3. install yarn / yarnというパッケージマネージャを入れる(別にnpmでもいいっちゃいいんだけど
    1. run npm install -g yarn
  4. install packages / パッケージのインストール
    1. move to dir of this repository / このファイルのあるフォルダへ移動
    2. run yarn install to install packages to node_module directory.
  5. install voice data / 音声データのインストール スクリーンショット 2019-04-17 11 40 26 スクリーンショット 2019-04-17 11 41 59 スクリーンショット 2019-04-17 11 45 20

Setting / 初期設定・設定変更

  1. copy config.js.sample to config.js
  2. set token, ID and so on
  3. change setting if you need
    • TTS_MODE: only 'Mac' is available, Google Cloud TTS version is now developing. Windows is not supported /
      'Mac'のみ利用可能。Google Cloud TTS版開発中、Windowsはサポート外
    • READ_USERNAME: speak username who commented or not / コメントしたユーザー名も読み上げるかどうか
    • USE_SIMPLE_NAME: remove characters after '' or numbers end of username / '' や末尾の数字を除去して読み上げ
    • SPEAKER_ENGLISH: "Susan" / 英語時の読み上げ音声の名前
    • SPEAKER_JAPANESE: "Kyoko" / 日本語のような2バイト文字の読み上げ音声の名前
    • RATE_ENGLISH: 150 / 英語の読み上げスピード
    • RATE_JAPANESE: 200 / 日本語の読み上げスピード
    • BILINGAL_MODE: false / 英語日本語で読み分けるかどうか
    • COMMENT_REMEMVER_AVAILABLE: true / 教育機能オンオフ
    • COMMENT_REMEMVER_REGEXP: "^!(remember)" / 教育コマンドのパターン
    • COMMENT_FORGET_REGEXP: "^!(forget)" / 忘却コマンドのパターン
    • DISCORD_TOKEN: '' / discord botのtoken
    • DISCORD_CHANNEL_ID: '' / discordへ転送するチャンネルのID
    • TW_OAUTH_TOKEN: '' / twitchのコメントを取得したりコメントを書き込んだりするユーザーのtoken({username}_botなどのアカウントをもう一つ作ってそいつにやらせるのがおすすめ)
    • TW_CHANNEL_NAME: '' / twitchで監視するチャンネル名
    • BOT_USERNAME: '' / botの名前を変えたいときに使う(微妙

Exec / 起動

Binary

  1. exec binary file ( downloaded from https://github.com/allpaqa-jgk/twitch_text_to_speech_bot/releases/latest

Source

  1. start / スタート
    • move to repository dir / このリポジトリのディレクトリに移動
    • run yarn start
  2. stop / 終了
    • push ctrl - c on your keyboard / キーボードでctrl - c

Update / 更新

which way did you choose when you download repo? / ダウンロード方法によってアップデート方法が違うよ

  1. binary / 実行ファイルをダウンロードした場合
  2. clone as git repository / cloneした場合
    • git status
      check unstaged change. / コミットしていない変更がないかチェック
      memo which version you using. / 戻したいときに戻せるように使ってるバージョンをチェック
    • git pull origin master
  3. zip / zipでDLした場合
    • take backup of your setting and convert list / フォルダーごとバックアップをとる
    • download zip file of current master branch / DLし直します
    • unzip / 解凍
    • overwrite files / 上書き

FAQ

  1. Who are you? / お前誰
  2. Is this free to use? / ただで使える?
    • for Mac mode / Mac モード
      • YES! but I'm happy if you follow my twitch channel. /
        いいよ!もし気に入ったらtwitchのチャンネルをフォローしてもらえると嬉しいな
    • GoogleCloudTTS mode / GoogleCloudTTS モード
      • Free up to 1 million character/month / 100万文字/月まで無料
  3. How can I use on Windows? / windowsで使える?
    • This bot is available for only Mac OS. Windows can use only CloudTTS mode. /
      MacモードはMacのみ対応。WindowsはCloudTTSモードのみ対応
  4. Bug! / Question! / Great idea! / ばぐみつけた! / 質問がある! / いいこと思いついた!
    1. tell me via twitter / 問題があったときや質問があればツイッターで教えて欲しいな
    2. feel free to make issue / issueにしてくれてもOK
    3. or discord / discordも可
      (you can find invitation on info panel on my twitch channel / twitchのチャンネルの情報パネルに招待リンクあるはず
  5. How can I support of developing this repo? / 何かサポートしてやってもいいよって人
    • twitter
      • send message / リプ・DM多分返します。多分
    • twitch
      • make comment during streaming / コメント歓迎
      • follow/subscribe / フォロー・サブスク
      • donate / ドネーション(寄付)
        see info panel of my twitch channel / 情報パネルにリンクがあるよ
    • github
      • star this repo / このリポジトリにスターをつける
      • contribute to this repo / 開発社ぼしうちう
      • make issue about bug, idea and so on. / バグやアイディアをissueに書いて欲しいな
      • make PR for bugfix. / バグ修正

Special Thanks

Packages

  • discordjs/uws
  • google-cloud/text-to-speech
  • config
  • csv
  • csv-parse
  • discord.js
  • forever
  • forever-monitor
  • play-sound
  • request
  • request-promise
  • tmi.js

Packages for dev

  • eslint
  • nexe
  • prettier

I used this repository as reference

Please feel free to send message / なにかあればお気軽にー