Skip to content

Commit

Permalink
Add phonemes for Czech
Browse files Browse the repository at this point in the history
  • Loading branch information
synesthesiam committed Aug 3, 2023
1 parent 7f7b5bd commit 41cfb05
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set(CMAKE_VERBOSE_MAKEFILE off)

project(
piper_phonemize
VERSION 1.1.0
VERSION 1.2.0
DESCRIPTION "Phonemization library for Piper text to speech system"
HOMEPAGE_URL "https://github.com/rhasspy/piper-phonemize"
LANGUAGES CXX
Expand Down
20 changes: 18 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ RUN curl -L "${ONNXRUNTIME_URL}" | \

# Build minimal version of espeak-ng
RUN curl -L "https://github.com/rhasspy/espeak-ng/archive/refs/heads/master.tar.gz" | \
tar -xzvf - && \
cd espeak-ng-master && \
tar -xzf -

RUN cd espeak-ng-master && \
export CFLAGS='-D_FILE_OFFSET_BITS=64' && \
./autogen.sh && \
./configure \
Expand All @@ -51,11 +52,26 @@ RUN curl -L "https://github.com/rhasspy/espeak-ng/archive/refs/heads/master.tar.
--without-mbrola \
--without-sonic \
--with-extdict-cmn \
--with-extdict-ru \
--prefix=/usr && \
make -j8 src/espeak-ng src/speak-ng && \
make && \
make install

# For future, not currently working
# cmake -Bbuild \
# -DCMAKE_INSTALL_PREFIX=/usr \
# -DCMAKE_BUILD_TYPE=Release \
# -DBUILD_SHARED_LIBS=ON \
# -DUSE_MBROLA=OFF \
# -DUSE_LIBSONIC=OFF \
# -DUSE_LIBPCAUDIO=OFF \
# -DUSE_KLATT=OFF \
# -DUSE_SPEECHPLAYER=OFF \
# -DUSE_ASYNC=OFF \
# -DEXTRA_cmn=ON \
# -DEXTRA_ru=ON && \

# Build libpiper_phonemize.so
COPY etc/libtashkeel_model.ort ./etc/
COPY CMakeLists.txt Makefile ./
Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

LIB_DIR := lib/Linux-$(shell uname -m)
DOCKER_PLATFORM ?= linux/amd64,linux/arm64,linux/arm/v7
VENV ?= .venv

release:
mkdir -p build
Expand All @@ -13,20 +14,20 @@ release:

test:
g++ -Wall -o test -Iespeak-ng/build/include -Lespeak-ng/build/lib -I$(LIB_DIR)/onnxruntime/include -L$(LIB_DIR)/onnxruntime/lib -Isrc -std=c++17 src/test.cpp src/phonemize.cpp src/phoneme_ids.cpp src/tashkeel.cpp -lespeak-ng -lonnxruntime
LD_LIBRARY_PATH="espeak-ng/build/lib:$(LIB_DIR)/onnxruntime/lib" ./test 'espeak-ng/build/share/espeak-ng-data'
LD_LIBRARY_PATH="espeak-ng/build/lib:$(LIB_DIR)/onnxruntime/lib:${LD_LIBRARY_PATH}" ./test 'espeak-ng/build/share/espeak-ng-data'

python:
cp -R espeak-ng/build/share/espeak-ng-data piper_phonemize/
cp etc/libtashkeel_model.ort piper_phonemize/
LD_LIBRARY_PATH='espeak-ng/build/lib' .venv/bin/pip3 install -e .
LD_LIBRARY_PATH="espeak-ng/build/lib:${LD_LIBRARY_PATH}" "$(VENV)/bin/pip3" install -e .

python-test:
LD_LIBRARY_PATH="espeak-ng/build/lib:$(LIB_DIR)/onnxruntime/lib" .venv/bin/python3 src/python_test.py
LD_LIBRARY_PATH="espeak-ng/build/lib:$(LIB_DIR)/onnxruntime/lib:${LD_LIBRARY_PATH}" "$(VENV)/bin/python3" src/python_test.py

python-wheel:
cp -R espeak-ng/build/share/espeak-ng-data piper_phonemize/
cp etc/libtashkeel_model.ort piper_phonemize/
LD_LIBRARY_PATH='espeak-ng/build/lib' .venv/bin/python3 setup.py bdist_wheel
LD_LIBRARY_PATH="espeak-ng/build/lib:${LD_LIBRARY_PATH}" "$(VENV)/bin/python3" setup.py bdist_wheel

docker:
docker buildx build . --platform "$(DOCKER_PLATFORM)" --output 'type=local,dest=dist'
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
_LIB_DIR = _DIR / "lib" / f"Linux-{platform.machine()}"
_ONNXRUNTIME_DIR = _LIB_DIR / "onnxruntime"

__version__ = "1.1.0"
__version__ = "1.2.0"

ext_modules = [
Pybind11Extension(
Expand Down
7 changes: 6 additions & 1 deletion src/phoneme_ids.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,12 @@ PhonemeIdMap DEFAULT_PHONEME_ID_MAP = {
// Luxembourgish
{U'g', {154}},
{U'ʦ', {155}},
{U'X', {156}}};
{U'X', {156}},

// Czech
{U'\u031d', {157}},
{U'\u030a', {158}},
};

// language -> phoneme -> [id, ...]
std::map<std::string, PhonemeIdMap> DEFAULT_ALPHABET = {
Expand Down

0 comments on commit 41cfb05

Please sign in to comment.