PCに日本語テキストを音読させてみます。 mac と fodora33 で試したので インストールのコマンドと簡単なスクリプトを記載します。
mac版
環境
uname -a
Darwin macbook1010390.local 19.6.0 Darwin Kernel Version 19.6.0: Thu Oct 29 22:56:45 PDT 2020; root:xnu-6153.141.2.2~1/RELEASE_X86_64 x86_64
brew --version
Homebrew 2.7.5
afplay -h
Audio File Play
Version: 2.0
インストール
brew install open-jtalk
バージョンやファイルパスなど表示されるので確認します。
以上、あとはスクリプトを書いて実行するだけです。Homebrew ありがたや。
スクリプト
cat ~/bin/mei
#!/bin/bash
OJT_DIC=/usr/local/Cellar/open-jtalk/1.11/dic
OJT_VOICE=/usr/local/Cellar/open-jtalk/1.11/voice/mei/mei_normal.htsvoice
OJT_TMP=/tmp/out.wav
if [ -p /dev/stdin ]; then
cat -
else
echo $@
fi | open_jtalk -x $OJT_DIC -m $OJT_VOICE -ow $OJT_TMP
afplay $OJT_TMP
実行例
chmod u+x ~/bin/mei
mei 厳密に言うとトマトは果物です。
mei その家には人間と豚と犬と鶏と家鴨が住んでいたが、まったく、住む建物も各々の食物も殆ど変っていやしない。
fedora33版
環境
uname -a
Linux kiwi.kadosawa6 5.10.11-200.fc33.x86_64 #1 SMP Wed Jan 27 20:21:22 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
ffmpeg --version
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
インストール
# いろいろ取ってくるので適当なアーカイブ置き場へ移動します。
cd /usr/local/src
# 音声作成エンジンをインストールします。
wget https://downloads.sourceforge.net/project/hts-engine/hts_engine%20API/hts_engine_API-1.10/hts_engine_API-1.10.tar.gz
tar zxvf hts_engine_API-1.10.tar.gz
cd hts_engine_API-1.10/
make
make install
# open-jtalk本体をインストールします。
cd /usr/local/src
wget https://downloads.sourceforge.net/project/open-jtalk/Open%20JTalk/open_jtalk-1.11/open_jtalk-1.11.tar.gz
tar zxvf open_jtalk-1.11.tar.gz
cd open_jtalk-1.11/
./configure --with-charset=UTF-8
make
make install
# 音響モデルをインストールします。
cd /usr/local/src
wget http://sourceforge.net/projects/mmdagent/files/MMDAgent_Example/MMDAgent_Example-1.8/MMDAgent_Example-1.8.zip
unzip MMDAgent_Example-1.8.zip
# 呼び出し易いようにシンボリックリンクを作成しておきます。
cd /usr/local/share/
ln -s /usr/local/src/MMDAgent_Example-1.8/Voice hts_voice
スクリプト
cat ~/bin/mei
#!/bin/bash
OJT_DIC=/usr/local/src/open_jtalk-1.11/mecab-naist-jdic
OJT_VOICE=/usr/local/share/hts_voice/mei/mei_normal.htsvoice
OJT_TMP=/dev/shm/out.wav
if [ -p /dev/stdin ]; then
cat -
else
echo $@
fi | open_jtalk -x $OJT_DIC -m $OJT_VOICE -ow $OJT_TMP
aplay $OJT_TMP
on run {input, parameters}
tell application "System Events"
keystroke "cd"
key code 49 -- space bar
keystroke "~/Desktop"
keystroke return
end tell
return input
end run
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, set ANDROID_SDK_ROOT to that location.
You may also want to add it to your PATH environment variable.
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
✗ Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
AndroidSDKを更新した後にこのエラーが表示されます。ライセンス確認が必要となるようですので、指定されたコマンドflutter doctor --android-licensesを実行しましょう。
複数回Accept?を確認されるので[y]を入力していきます。
[!] Xcode - develop for iOS and macOS (Xcode 11.2)
✗ CocoaPods installed but not working.
You appear to have CocoaPods installed but it is not working.
This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
This can usually be fixed by re-installing CocoaPods. For more info, see https://github.com/flutter/flutter/issues/14293.
To re-install CocoaPods, run:
sudo gem install cocoapods
[!] Android Studio (version 4.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
✗ Unable to determine bundled Java version.
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.4, on Mac OS X 10.15.7 19H2 darwin-x64, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.2)
[✓] VS Code (version 1.52.1)
まず、[⌘]+[Shift]+[P]キーでコマンドパレットを開き、[Flutter: New Application Project]を起動します。プロジェクトを作成する場所を選択し、続けてプロジェクト名を入力します。今回はmtestというプロジェクト名にしました。これだけでFlutterプロジェクトが作成され、VSCodeの新しいウィンドウが開かれます。libフォルダ内のmain.dartがこれから編集するファイルですので、開きましょう。
VSCode左側メニューからデバッグボタンを選択し、[Run and Debug]から[Start iOS Simulator]を実行しましょう。XCodeで用意されているiOSシミュレータが起動し、ここで編集しているプロジェクトがiOSアプリとして実行されます(初回はビルドに非常に時間がかかるので待ちましょう)。