Skip to main content

Utility for local generation of synthetic voice using Wyoming-Piper

Project description

YakYak

YakYak is a utility for the local generation of synthetic voice through use of Wyoming-Piper. It can be used from the command line or called from python. It opens a TCP socket to Wyoming-Piper running in Docker anywhere on your local area network. It scales to run efficiently on large multi-core computers or small single board computers.

Install YakYak, Docker Compose & FFMPEG

To install YakYak, a python virtual environment is recommended.

Step 1, create a python virtual environment and activate it

cd some_directory  
sudo apt install python3.8-venv
python3 -m venv .venv  
source .venv/bin/activate  

Step 2, install the YakYak package

pip install yakyak

Step 3, Install ffmpeg

Install ffmpeg for mac

brew install ffmpeg

Install ffmpeg for Ubuntu

sudo apt install ffmpeg

Setup wyoming-piper in docker, on your local area network.

If you don't already have docker, or better yet docker-desktop, you can download and install it from docker.com.

If you don't already have a wyoming-piper docker-compose.yml file, create one using YakYak. Warning, this will overwrite an existing docker-compose.yml file.

yakyak --docker > docker-compose.yml

Now you can start wyoming-piper in a docker container

docker compose up -d --force-recreate

Test installation

It will take a little longer the first time running YakYak, the Wyoming-Piper app needs time to download voice files.

piper -h localhost -t mp3

Observe successful test results

INFO:root:Server localhost:10200 is online
INFO:root:Success, test: mp3

How to use YakYak from the command line

As with many Linux applications, YakYak supports standard in, and standard out. It also supports file input with the -i command and -o for file output. For a complete set of commands type yakyak --help.

yakyak --help

Create an mp3 file with "Hello world"

echo Hello world | yakyak -f mp3 -o hello_world.mp3

If you are on Linux and have aplay installed, you can do this:

echo Hello world | yakyak | aplay

This assumes that Docker is running on the same machine.

If Docker is running on a different machine on your network, you can do this:

echo Hello world | yakyak --host a_different_machine.local | aplay

How to use YakYak from Python

Create the file test_yakyak.py with the following content:

from yakyak import is_server_online, piper_tts_server

print(f"{is_server_online(
        'localhost', 
        10200, 
        )=}")

print(f"{piper_tts_server(
        'localhost', 
        10200, 
        'Hello World',
        'hello_world.mp3',
        'mp3',
        'en_US-amy-medium'
        )=}")

Now test it

python3 test_yakyak.py  

Observe that the server is online and a file hello_world.mp3 is created. Play the mp3 and you will hear "Hello world".

run.py 
check_ffmpeg_version()='ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers'
is_server_online(
        'localhost', 
        10200, 
        )=True
INFO:root:Server localhost:10200 is online
run_test(
        'localhost', 
        10200, 
        'mp3',
        )=(True, 'Success, test: mp3')
INFO:root:Success, test: mp3
await piper_tts_server(
            'localhost', 
            10200, 
            'Hello World',
            'run_test.mp3',
            'mp3',
            'en_US-amy-medium'
            )=None

Process finished with exit code 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

yakyak-1.7.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

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

yakyak-1.7.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file yakyak-1.7.0.tar.gz.

File metadata

  • Download URL: yakyak-1.7.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for yakyak-1.7.0.tar.gz
Algorithm Hash digest
SHA256 fd03c1ced7fba636d424d65e05b73686e9f91ff184f5457e8622212519dc0fda
MD5 0d3efc25c22a5caf8b3aa4696c203c9f
BLAKE2b-256 10203bda266822c2426caca84f9edc5aa8fa0309da773482d0a3fea453ac6463

See more details on using hashes here.

File details

Details for the file yakyak-1.7.0-py3-none-any.whl.

File metadata

  • Download URL: yakyak-1.7.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for yakyak-1.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb1439c4b1ed32ccad8f481ae110bf506a3e1ca083acc9ec0c794aa0b9666f8b
MD5 3fe079e0655901d30dba8f7ed1e23760
BLAKE2b-256 cffa7449c4ee825d56c6caccd44008607107aed9f488e9f54feefc0d9f7314c1

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