音声データを追加する

This commit is contained in:
ry.yamafuji 2025-03-20 10:19:41 +09:00
parent 087d3d3650
commit 339cf8e1fd
4 changed files with 60 additions and 1 deletions

View File

@ -1 +1,2 @@
matplotlib
matplotlib
pyttsx3

45
voice/README.md Normal file
View File

@ -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()
```

5
voice/tsx_helloworld.py Normal file
View File

@ -0,0 +1,5 @@
import pyttsx3
engine = pyttsx3.init()
engine.say("Hello, World!")
engine.runAndWait()

View File

@ -0,0 +1,8 @@
import pyttsx3
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.say("こんにちは")
engine.runAndWait()
engine.say("これはテキストの読み上げ機能です")
engine.runAndWait()