diff --git a/requirements.txt b/requirements.txt index 4b43f7e..985057b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ -matplotlib \ No newline at end of file +matplotlib +pyttsx3 \ No newline at end of file diff --git a/voice/README.md b/voice/README.md new file mode 100644 index 0000000..1a5f380 --- /dev/null +++ b/voice/README.md @@ -0,0 +1,45 @@ +## Install + +```sh +pip install pyttsx3 +``` + +## How To Use + +```sh +import pyttsx3 + +engine = pyttsx3.init() +engine.say("Hello, World!") +engine.runAndWait() +``` + + +日本語音声エンジンのインストール + +```sh +apt install -y open-jtalk +``` + +Open JTalkには、日本語音声ファイルが必要です。 +日本語音声ファイルをダウンロードする。 + +```sh +apt install -y open-jtalk-mecab-naist-jdic hts-voice-nitech-jp-atr503-m001 +``` + +ダウンロードした日本語音声ファイルを以下のパスに配置する + +```sh +/usr/share/hts-voice/nitech-jp-atr503-m001/nitech_jp_atr503_m001.htsvoice +``` + + +```python +import pyttsx3 + +engine = pyttsx3.init() +engine.setProperty('voice', 'japanese') +engine.say("こんにちは、世界!") +engine.runAndWait() +``` diff --git a/voice/tsx_helloworld.py b/voice/tsx_helloworld.py new file mode 100644 index 0000000..437e91d --- /dev/null +++ b/voice/tsx_helloworld.py @@ -0,0 +1,5 @@ +import pyttsx3 + +engine = pyttsx3.init() +engine.say("Hello, World!") +engine.runAndWait() diff --git a/voice/tsx_helloworld_jpn.py b/voice/tsx_helloworld_jpn.py new file mode 100644 index 0000000..472d07b --- /dev/null +++ b/voice/tsx_helloworld_jpn.py @@ -0,0 +1,8 @@ +import pyttsx3 + +engine = pyttsx3.init() +voices = engine.getProperty('voices') +engine.say("こんにちは") +engine.runAndWait() +engine.say("これはテキストの読み上げ機能です") +engine.runAndWait()