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
from pitsh.speak_logic import speak
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.16.tar.gz (27.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.16-py3-none-any.whl (27.6 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pitsh-0.1.16.tar.gz
  • Upload date:
  • Size: 27.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.16.tar.gz
Algorithm Hash digest
SHA256 6f13415481720476b8b77620a87a58f5737cab64b905bd768b5a2dae9807c907
MD5 8986e56dbb820e8b63d18eccc124378b
BLAKE2b-256 3633ab8552f180b8a8ac68533b0cb38d39954218de868f23d6927320ccae801f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pitsh-0.1.16-py3-none-any.whl
  • Upload date:
  • Size: 27.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.16-py3-none-any.whl
Algorithm Hash digest
SHA256 7c55a74a83734285f543993bb13d577311648b81bb1a032e2d6c7559bf03b457
MD5 9e13603b057aab30db48ca76b1259007
BLAKE2b-256 a18f82780018dfe9e13eb10cca3e42b6fa3eaea050ee92996021d4ae34545742

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