Skip to main content

特定の文字でピッチが変わる改造版Open JTalk(ビルド済みバイナリ同梱版)

Project description

「3」と「3の倍数」でピッチシフトが発生する OpenJtalk

「3」と「3の倍数」でを検知した際に、自動的にピッチを跳ね上げて読み上げる改造版 Open JTalk です。

概要

通常の Open JTalk にC言語で処理を追加し、特定の条件下で音声合成エンジン(hts_engine)のピッチパラメータを動的に変更するように改造しています。

インストール

⭐︎注意 このインストールができるのは現時点でmacOSのみです。 WindowsPCが治り次第、ビルドしてWindowsでも実行できるようにします。

pip install pitsh
python3
import pitsh
pitsh.speak("1、2、3、4、5、6、7、8、9、10")

speak() を実行したあと、音が聞こえるか確認するには、Python の中で以下を打ってください。

import os
os.system("afplay output_pitch_shift.wav")

ライセンス

本プログラムはOpenJtalkのライセンスであるBSDライセンスに準じます。

動作環境 Windows / macOS 対応

必要ツール ⭐︎Windows

sudo apt update
sudo apt install build-essential automake autoconf libtool

⭐︎macOS

brew install automake autoconf libtool

ビルド方法

1.土台の「hts_engine_API」のビルド

cd hts_engine_API-1.10
chmod +x ./configure
./configure
make

2.OpenJtalk本体のビルド ⭐︎Windowsの場合

cd ../open_jtalk-1.11
chmod +x ./configure
./configure \
--with-hts-engine-header-path=../hts_engine_API-1.10/include \
--with-hts-engine-library-path=../hts_engine_API-1.10/lib
make

⭐︎macOSの場合

cd ../open_jtalk-1.11
chmod +x ./configure
./configure LIBS="-liconv" \
--with-hts-engine-header-path=../hts_engine_API-1.10/include \
--with-hts-engine-library-path=../hts_engine_API-1.10/lib
make

3.実行方法 ビルド完了後、リポジトリのルートディレクトリで以下のコマンドを実行してください。 ※ fish シェルや zsh での改行エラーを防ぐため、1行にまとめて記述しています。 下は「1、2、3、4、5、6、7、8、9、10」を読み上げるコマンドです。

echo "1、2、3、4、5、6、7、8、9、10" | ./open_jtalk-1.11/bin/open_jtalk -x ./dict -m ./voice/nitech_jp_atr503_m001.htsvoice -ow output.wav -r 0.7 -fm 2.0 -a 0.55

ここまでで「3」と「3の倍数」でピッチシフトが発生する OpenJtalkのビルドは終了です。 話す速度や音声全体のピッチの指定、音量の指定については補足に記載しています。

ディレクトリ構成

・open_jtalk-1.11/: 改造済みソースコード本体 ・hts_engine_API-1.10/: 音声合成エンジンライブラリ ・dict/: 辞書ファイル (UTF-8) ・voice/: HTS Voice モデルファイル

============ ⭐︎補足 Open JTalkを実行する際は、通常以下の3つのオプション指定が必要です。

  1. -x: 辞書ディレクトリのパス
  2. -m: 音響モデル(.htsvoice)のパス
  3. -ow: 出力する音声ファイル(.wav)の名前

使用例

⭐︎⭐︎以下のコマンドを使用する際はパスの指定に気をつけてください。

1. 基本的な音声生成

テキストファイル input.txt を読み込み、音声 output.wav を生成する場合。

open_jtalk \
  -x /path/to/dic_dir \
  -m /path/to/voice.htsvoice \
  -ow output.wav \
  input.txt

2. コマンドラインから直接テキストを入力

echo コマンドを使ってテキストを渡す場合。

echo "こんにちは" | open_jtalk \
  -x /path/to/dic_dir \
  -m /path/to/voice.htsvoice \
  -ow output.wav

3. 声の調整(速度・高さ・音量)

  • 話速を速くする (-r 1.2)
  • 声を少し高くする (-fm 2.0)
  • 音量を上げる (-g 5.0)
open_jtalk \
  -x /path/to/dic_dir \
  -m /path/to/voice.htsvoice \
  -ow output.wav \
  -r 1.2 \
  -fm 2.0 \
  -g 5.0 \
  input.txt

オプション一覧

⭐︎⭐︎以下のオプションを使用することで多様な読み上げ音声を生成することもできます。

オプション 引数 説明 デフォルト値 設定可能範囲
-x dir 【重要】 辞書ディレクトリの指定 N/A -
-m file 【重要】 HTSボイスファイル(.htsvoice)の指定 -> 話者 N/A -
-ow file 【重要】 生成される音声ファイル(.wav)の出力先 N/A -
-ot file トレース情報の出力ファイル N/A -
-s int サンプリング周波数 (Hz) auto 1以上
-p int フレーム周期 (point) auto 1以上
-a float オールパス定数 -> 声質 auto 0.0 - 1.0
-b float ポストフィルタ係数 0.0 0.0 - 1.0
-r float 話速 (読み上げスピード) -> 話速 1.0 0.0以上
-fm float 追加ハーフトーン (声の高さ調整) ->ピッチシフト 0.0 -
-u float 有声/無声の閾値 0.5 0.0 - 1.0
-jm float スペクトラム系列内変動の重み 1.0 0.0以上
-jf float F0系列内変動の重み 1.0 0.0以上
-g float 音量 (dB) 0.0 -
-z int オーディオバッファサイズ (0でオフ) 0 0以上

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pitsh-0.1.15.tar.gz (24.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pitsh-0.1.15-py3-none-any.whl (24.6 MB view details)

Uploaded Python 3

File details

Details for the file pitsh-0.1.15.tar.gz.

File metadata

  • Download URL: pitsh-0.1.15.tar.gz
  • Upload date:
  • Size: 24.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pitsh-0.1.15.tar.gz
Algorithm Hash digest
SHA256 869a5115bb00ed48783481073fcac4cf24ad2f8123681d87bd7a357956f69aef
MD5 190044b63000d693eefe852309001bed
BLAKE2b-256 0806f9d5c38df64676953009f1372e9026391ebd16bb545eeb5410eb5df6bf19

See more details on using hashes here.

File details

Details for the file pitsh-0.1.15-py3-none-any.whl.

File metadata

  • Download URL: pitsh-0.1.15-py3-none-any.whl
  • Upload date:
  • Size: 24.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pitsh-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 9d86a02b1363f0d38b717a9c60078727f11131d44c3b81e9bde889c03925c025
MD5 67cdf38111dcac032695658e6b56ec18
BLAKE2b-256 909d09bf358b865ce31d5fc952c7578c61e09de2d409f5454bc6fc02d4d4c8a3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page