diff --git a/examples/other/g2p/get_g2p_data.py b/examples/other/g2p/get_g2p_data.py index 61ef3d09..9b43ca62 100644 --- a/examples/other/g2p/get_g2p_data.py +++ b/examples/other/g2p/get_g2p_data.py @@ -15,7 +15,7 @@ import argparse from collections import defaultdict from pathlib import Path -from praatio import tgio +from praatio import textgrid def get_baker_data(root_dir): @@ -28,7 +28,7 @@ def get_baker_data(root_dir): alignment_files = [f for f in alignment_files if f.stem not in exclude] data_dict = defaultdict(dict) for alignment_fp in alignment_files: - alignment = tgio.openTextgrid(alignment_fp) + alignment = textgrid.openTextgrid(alignment_fp, includeEmptyIntervals=True) # only with baker's annotation utt_id = alignment.tierNameList[0].split(".")[0] intervals = alignment.tierDict[alignment.tierNameList[0]].entryList diff --git a/examples/other/g2p/path.sh b/examples/other/g2p/path.sh new file mode 100755 index 00000000..98fb9609 --- /dev/null +++ b/examples/other/g2p/path.sh @@ -0,0 +1,10 @@ +#!/bin/bash +export MAIN_ROOT=`realpath ${PWD}/../../../` + +export PATH=${MAIN_ROOT}:${MAIN_ROOT}/utils:${PATH} +export LC_ALL=C + +export PYTHONDONTWRITEBYTECODE=1 +# Use UTF-8 in Python to avoid UnicodeDecodeError when LC_ALL=C +export PYTHONIOENCODING=UTF-8 +export PYTHONPATH=${MAIN_ROOT}:${PYTHONPATH} diff --git a/examples/other/tn/path.sh b/examples/other/tn/path.sh new file mode 100755 index 00000000..98fb9609 --- /dev/null +++ b/examples/other/tn/path.sh @@ -0,0 +1,10 @@ +#!/bin/bash +export MAIN_ROOT=`realpath ${PWD}/../../../` + +export PATH=${MAIN_ROOT}:${MAIN_ROOT}/utils:${PATH} +export LC_ALL=C + +export PYTHONDONTWRITEBYTECODE=1 +# Use UTF-8 in Python to avoid UnicodeDecodeError when LC_ALL=C +export PYTHONIOENCODING=UTF-8 +export PYTHONPATH=${MAIN_ROOT}:${PYTHONPATH} diff --git a/paddlespeech/t2s/exps/voice_cloning/tacotron2_ge2e/process_wav.py b/paddlespeech/t2s/exps/voice_cloning/tacotron2_ge2e/process_wav.py index c1be0a37..56d8e4c3 100644 --- a/paddlespeech/t2s/exps/voice_cloning/tacotron2_ge2e/process_wav.py +++ b/paddlespeech/t2s/exps/voice_cloning/tacotron2_ge2e/process_wav.py @@ -19,12 +19,12 @@ from pathlib import Path import librosa import numpy as np import soundfile as sf -from praatio import tgio +from praatio import textgrid from tqdm import tqdm def get_valid_part(fpath): - f = tgio.openTextgrid(fpath) + f = textgrid.openTextgrid(fpath, includeEmptyIntervals=True) start = 0 phone_entry_list = f.tierDict['phones'].entryList diff --git a/requirements.txt b/requirements.txt index 3708bb06..42cb33f6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,7 @@ paddlespeech_feat pandas phkit Pillow -praatio~=4.1 +praatio==5.0.0 pre-commit pybind11 pypi-kenlm diff --git a/setup.py b/setup.py index a5b773ed..9d680ea8 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ requirements = { "pandas", "paddleaudio", "paddlespeech_feat", - "praatio~=4.1", + "praatio==5.0.0", "pypinyin", "python-dateutil", "pyworld", diff --git a/utils/gen_duration_from_textgrid.py b/utils/gen_duration_from_textgrid.py index b2a5fa3d..9ee0c05c 100755 --- a/utils/gen_duration_from_textgrid.py +++ b/utils/gen_duration_from_textgrid.py @@ -18,12 +18,12 @@ from pathlib import Path import librosa import numpy as np import yaml -from praatio import tgio +from praatio import textgrid from yacs.config import CfgNode def readtg(tg_path, sample_rate=24000, n_shift=300): - alignment = tgio.openTextgrid(tg_path, readRaw=True) + alignment = textgrid.openTextgrid(tg_path, includeEmptyIntervals=True) phones = [] ends = [] for interval in alignment.tierDict["phones"].entryList: