piper-whistle


Namepiper-whistle JSON
Version 1.6.253 PyPI version JSON
download
home_pagehttps://gitlab.com/think-biq/piper-whistle
SummaryCLI tool to manage piper voices.
upload_time2024-01-17 19:27:06
maintainer
docs_urlNone
authorbiq
requires_python>=3.8
license
keywords text-to-speech piper voice model tool
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # piper-whistle

![gitlab-pipieline-release-name](https://gitlab.com/think-biq/piper-whistle/-/badges/release.svg) ![gitlab-pipeline-release-status](https://gitlab.com/think-biq/piper-whistle/badges/release/pipeline.svg?ignore_skipped=true) ![readthedocs-status](https://readthedocs.org/projects/piper-whistle/badge/?version=latest)

Tool to manage voices used with the [piper][1] speech synthesizer. You may also browse the [docs online][2] at https://think-biq.gitlab.io/piper-whistle/
There is also [a quick guide](https://hackernoon.com/how-to-set-up-piper-speech-synthesizer-on-a-local-machine) on how to setup and use piper and (piper-)whistle.

## usage

```bash
usage: piper_whistle [-h] [-d] [-v] [-V] [-P DATA_ROOT] [-R]
                     {refresh,guess,path,speak,list,preview,install,remove}
                     ...

positional arguments:
  {refresh,guess,path,speak,list,preview,install,remove}

optional arguments:
  -h, --help            Show help message.
  -d, --debug           Activate very verbose logging.
  -v, --verbose         Activate verbose logging.
  -V, --version         Show version number.
  -P DATA_ROOT, --data-root DATA_ROOT
                        Root path where whistle should store config and data in.
  -R, --refresh         Refreshes (or sets up) language index by downloading the latest lookup.
```

## commands

### guess

```bash
usage: piper_whistle guess [-h] [-v] language_name

positional arguments:
  language_name  A string representing a language name (or code).

optional arguments:
  -h, --help     Show help message.
  -v, --verbose  Activate verbose logging.
```

Tries to guess the language you are looking for (and is supported by [piper][1]) from the name you provide.

### path

```bash
usage: piper_whistle path [-h] [-v] voice_selector

positional arguments:
  voice_selector  Selector of voice to search.

optional arguments:
  -h, --help      show this help message and exit
  -v, --verbose   Activate verbose logging.
```

Shows the local path to a specific model. The voice_selector has the format:
```
${CODE}:${NAME}@${QUALITY}/${SPEAKER}
```
The ```${SPEAKER}``` part is optional; as is the ```${CODE}``` part. So if you want to select the voice named 'alba' in quality 'medium', you could simply query: ```alba@medium```

The language code is infered.
Alternatively, you can just query with the model name listed by the `list` command.  
```
${CODE}-${NAME}-${QUALITY}
```
So for the example above, that would be ```en_GB-alba-medium```

### speak

```bash
usage: piper_whistle speak [-h] [-c CHANNEL] [-j] [-r] [-o OUTPUT] [-v]
                           something

positional arguments:
  something             Something to speak.

optional arguments:
  -h, --help            Show help message.
  -c CHANNEL, --channel CHANNEL
                        Path to channel (named pipe (aka. fifo)) to which piper is listening.
  -j, --json            Encode the text as json payload. Is on by default.
  -r, --raw             Encode the text directly.
  -o OUTPUT, --output OUTPUT
                        Instead of streaming to audio channel, specifies a path to wav file where speech will be store in.
  -v, --verbose         Activate verbose logging.
```

Currently only works on linux / bsd systems, with a FIFO (aka. named pipes) setup. The basic idea is, having one pipe accepting json input (provided by this command), which is listened to by [piper][1]. After [piper][1] has processed the audio, it is either saved to file or passed on to another FIFO, which can then be read by a streaming audio player like `aplay`.

Example:
Assuming [piper][1] is installed at /opt/wind/piper, the named pipes are located at /opt/wind/channels and whistle is available in $PATH, the aformentioned setup could look like the following:

pipes:

* /opt/wind/channeld/speak - accepts json payload
* /opt/wind/channeld/input - read by [piper][1]
* /opt/wind/channeld/ouput - written by [piper][1]

processes:

* tty0: tail -F /opt/wind/channels/speak | tee /opt/wind/channels/input
* tty1: /opt/wind/piper/piper -m $(piper_whistle path alba@medium) --debug --json-input --output_raw < /opt/wind/channels/input > /opt/wind/channels/output
* tty2: aplay --buffer-size=777 -r 22050 -f S16_LE -t raw < channels/output

The tail command makes sure, that the payload on speak is send to input,
thereby keeping the file open after processing. Otherwise, the setup would exit
after [piper][1] has finished the first payload. This way you can continually prompt.

### list

```bash
usage: piper_whistle list [-h] [-v] [-I] [-a] [-L] [-g] [-U] [-S] [-p]
                          [-l LANGUAGE_CODE] [-i VOICE_INDEX]

optional arguments:
  -h, --help            Show help message.
  -v, --verbose         Activate verbose logging.
  -I, --installed       Only list installed voices.
  -a, --all             List voices for all available languages.
  -L, --languages       List available languages.
  -g, --legal           Show avaiable legal information.
  -U, --show-url        Show URL of voice on remote host.
  -S, --omit-speakers   Omit speakers form listing.
  -p, --install-path    Show path of voice (if installed).
  -l LANGUAGE_CODE, --language-code LANGUAGE_CODE
                        Only list voices matching this language.
  -i VOICE_INDEX, --voice-index VOICE_INDEX
                        List only specific language voice.
```

This command lets you investigate available voices for specific languages, or
simply list all available voices. Using the --installed switch, you can filter
voices that are currently installed in the local cache directory. The cache is
located in the user app path, as provided by [userpaths](https://pypi.org/project/userpaths/) pip package. On linux this would be `${HOME}/.config/piper-whistle`. You may also get the model path on the remote host using -U.

### preview

```bash
usage: piper_whistle preview [-h] [-v] [-l LANGUAGE_CODE] [-i VOICE_INDEX]
                             [-s SPEAKER_INDEX] [-D]

optional arguments:
  -h, --help            Show help message.
  -v, --verbose         Activate verbose logging.
  -l LANGUAGE_CODE, --language-code LANGUAGE_CODE
                        Select language.
  -i VOICE_INDEX, --voice-index VOICE_INDEX
                        Specific language voice. (defaults to first one)
  -s SPEAKER_INDEX, --speaker-index SPEAKER_INDEX
                        Specific language voice speaker. (defaults to first one)
  -D, --dry-run         Build URL and simulate download.
```

With `preview`, you can download and play samples audio files, for any voice
supported by [piper][1]. It currently uses [mplayer](http://www.mplayerhq.hu/) to play the audio file.

### install

```bash
usage: piper_whistle install [-h] [-v] [-D] language_code voice_index

positional arguments:
  language_code  Select language.
  voice_index    Specific language voice. (defaults to first one)

optional arguments:
  -h, --help     Show help message.
  -v, --verbose  Activate verbose logging.
  -D, --dry-run  Simulate download / install.
```

With `install` you can fetch available voice models and store them locally for
use with [piper][1]. You may first want to search for a voice you like with `list`
and then note the language code and index, so install knows where to look.
The model file (onnx) as well as its accompanying config (json) file, will be
stored in the local user data path as provide by [userpaths](https://pypi.org/project/userpaths/). On linux this would be `${HOME}/.config/piper-whistle`.

### remove

```bash
usage: piper_whistle remove [-h] [-v] voice_selector

positional arguments:
  voice_selector  Selector of voice to search.

optional arguments:
  -h, --help      Show help message.
  -v, --verbose   Activate verbose logging.
```

Any installed voice model can be deleted, via `remove`. You may pass the model name or shorthand selector.

[1]: https://github.com/rhasspy/piper
[2]: https://think-biq.gitlab.io/piper-whistle/

            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/think-biq/piper-whistle",
    "name": "piper-whistle",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "text-to-speech piper voice model tool",
    "author": "biq",
    "author_email": "sven.freiberg@biq.solutions",
    "download_url": "https://files.pythonhosted.org/packages/2c/61/4e618a31674078962c4fe15547cf42a6c000c47a0ef051497f34874bc170/piper_whistle-1.6.253.tar.gz",
    "platform": null,
    "description": "# piper-whistle\n\n![gitlab-pipieline-release-name](https://gitlab.com/think-biq/piper-whistle/-/badges/release.svg) ![gitlab-pipeline-release-status](https://gitlab.com/think-biq/piper-whistle/badges/release/pipeline.svg?ignore_skipped=true) ![readthedocs-status](https://readthedocs.org/projects/piper-whistle/badge/?version=latest)\n\nTool to manage voices used with the [piper][1] speech synthesizer. You may also browse the [docs online][2] at https://think-biq.gitlab.io/piper-whistle/\nThere is also [a quick guide](https://hackernoon.com/how-to-set-up-piper-speech-synthesizer-on-a-local-machine) on how to setup and use piper and (piper-)whistle.\n\n## usage\n\n```bash\nusage: piper_whistle [-h] [-d] [-v] [-V] [-P DATA_ROOT] [-R]\n                     {refresh,guess,path,speak,list,preview,install,remove}\n                     ...\n\npositional arguments:\n  {refresh,guess,path,speak,list,preview,install,remove}\n\noptional arguments:\n  -h, --help            Show help message.\n  -d, --debug           Activate very verbose logging.\n  -v, --verbose         Activate verbose logging.\n  -V, --version         Show version number.\n  -P DATA_ROOT, --data-root DATA_ROOT\n                        Root path where whistle should store config and data in.\n  -R, --refresh         Refreshes (or sets up) language index by downloading the latest lookup.\n```\n\n## commands\n\n### guess\n\n```bash\nusage: piper_whistle guess [-h] [-v] language_name\n\npositional arguments:\n  language_name  A string representing a language name (or code).\n\noptional arguments:\n  -h, --help     Show help message.\n  -v, --verbose  Activate verbose logging.\n```\n\nTries to guess the language you are looking for (and is supported by [piper][1]) from the name you provide.\n\n### path\n\n```bash\nusage: piper_whistle path [-h] [-v] voice_selector\n\npositional arguments:\n  voice_selector  Selector of voice to search.\n\noptional arguments:\n  -h, --help      show this help message and exit\n  -v, --verbose   Activate verbose logging.\n```\n\nShows the local path to a specific model. The voice_selector has the format:\n```\n${CODE}:${NAME}@${QUALITY}/${SPEAKER}\n```\nThe ```${SPEAKER}``` part is optional; as is the ```${CODE}``` part. So if you want to select the voice named 'alba' in quality 'medium', you could simply query: ```alba@medium```\n\nThe language code is infered.\nAlternatively, you can just query with the model name listed by the `list` command.  \n```\n${CODE}-${NAME}-${QUALITY}\n```\nSo for the example above, that would be ```en_GB-alba-medium```\n\n### speak\n\n```bash\nusage: piper_whistle speak [-h] [-c CHANNEL] [-j] [-r] [-o OUTPUT] [-v]\n                           something\n\npositional arguments:\n  something             Something to speak.\n\noptional arguments:\n  -h, --help            Show help message.\n  -c CHANNEL, --channel CHANNEL\n                        Path to channel (named pipe (aka. fifo)) to which piper is listening.\n  -j, --json            Encode the text as json payload. Is on by default.\n  -r, --raw             Encode the text directly.\n  -o OUTPUT, --output OUTPUT\n                        Instead of streaming to audio channel, specifies a path to wav file where speech will be store in.\n  -v, --verbose         Activate verbose logging.\n```\n\nCurrently only works on linux / bsd systems, with a FIFO (aka. named pipes) setup. The basic idea is, having one pipe accepting json input (provided by this command), which is listened to by [piper][1]. After [piper][1] has processed the audio, it is either saved to file or passed on to another FIFO, which can then be read by a streaming audio player like `aplay`.\n\nExample:\nAssuming [piper][1] is installed at /opt/wind/piper, the named pipes are located at /opt/wind/channels and whistle is available in $PATH, the aformentioned setup could look like the following:\n\npipes:\n\n* /opt/wind/channeld/speak - accepts json payload\n* /opt/wind/channeld/input - read by [piper][1]\n* /opt/wind/channeld/ouput - written by [piper][1]\n\nprocesses:\n\n* tty0: tail -F /opt/wind/channels/speak | tee /opt/wind/channels/input\n* tty1: /opt/wind/piper/piper -m $(piper_whistle path alba@medium) --debug --json-input --output_raw < /opt/wind/channels/input > /opt/wind/channels/output\n* tty2: aplay --buffer-size=777 -r 22050 -f S16_LE -t raw < channels/output\n\nThe tail command makes sure, that the payload on speak is send to input,\nthereby keeping the file open after processing. Otherwise, the setup would exit\nafter [piper][1] has finished the first payload. This way you can continually prompt.\n\n### list\n\n```bash\nusage: piper_whistle list [-h] [-v] [-I] [-a] [-L] [-g] [-U] [-S] [-p]\n                          [-l LANGUAGE_CODE] [-i VOICE_INDEX]\n\noptional arguments:\n  -h, --help            Show help message.\n  -v, --verbose         Activate verbose logging.\n  -I, --installed       Only list installed voices.\n  -a, --all             List voices for all available languages.\n  -L, --languages       List available languages.\n  -g, --legal           Show avaiable legal information.\n  -U, --show-url        Show URL of voice on remote host.\n  -S, --omit-speakers   Omit speakers form listing.\n  -p, --install-path    Show path of voice (if installed).\n  -l LANGUAGE_CODE, --language-code LANGUAGE_CODE\n                        Only list voices matching this language.\n  -i VOICE_INDEX, --voice-index VOICE_INDEX\n                        List only specific language voice.\n```\n\nThis command lets you investigate available voices for specific languages, or\nsimply list all available voices. Using the --installed switch, you can filter\nvoices that are currently installed in the local cache directory. The cache is\nlocated in the user app path, as provided by [userpaths](https://pypi.org/project/userpaths/) pip package. On linux this would be `${HOME}/.config/piper-whistle`. You may also get the model path on the remote host using -U.\n\n### preview\n\n```bash\nusage: piper_whistle preview [-h] [-v] [-l LANGUAGE_CODE] [-i VOICE_INDEX]\n                             [-s SPEAKER_INDEX] [-D]\n\noptional arguments:\n  -h, --help            Show help message.\n  -v, --verbose         Activate verbose logging.\n  -l LANGUAGE_CODE, --language-code LANGUAGE_CODE\n                        Select language.\n  -i VOICE_INDEX, --voice-index VOICE_INDEX\n                        Specific language voice. (defaults to first one)\n  -s SPEAKER_INDEX, --speaker-index SPEAKER_INDEX\n                        Specific language voice speaker. (defaults to first one)\n  -D, --dry-run         Build URL and simulate download.\n```\n\nWith `preview`, you can download and play samples audio files, for any voice\nsupported by [piper][1]. It currently uses [mplayer](http://www.mplayerhq.hu/) to play the audio file.\n\n### install\n\n```bash\nusage: piper_whistle install [-h] [-v] [-D] language_code voice_index\n\npositional arguments:\n  language_code  Select language.\n  voice_index    Specific language voice. (defaults to first one)\n\noptional arguments:\n  -h, --help     Show help message.\n  -v, --verbose  Activate verbose logging.\n  -D, --dry-run  Simulate download / install.\n```\n\nWith `install` you can fetch available voice models and store them locally for\nuse with [piper][1]. You may first want to search for a voice you like with `list`\nand then note the language code and index, so install knows where to look.\nThe model file (onnx) as well as its accompanying config (json) file, will be\nstored in the local user data path as provide by [userpaths](https://pypi.org/project/userpaths/). On linux this would be `${HOME}/.config/piper-whistle`.\n\n### remove\n\n```bash\nusage: piper_whistle remove [-h] [-v] voice_selector\n\npositional arguments:\n  voice_selector  Selector of voice to search.\n\noptional arguments:\n  -h, --help      Show help message.\n  -v, --verbose   Activate verbose logging.\n```\n\nAny installed voice model can be deleted, via `remove`. You may pass the model name or shorthand selector.\n\n[1]: https://github.com/rhasspy/piper\n[2]: https://think-biq.gitlab.io/piper-whistle/\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "CLI tool to manage piper voices.",
    "version": "1.6.253",
    "project_urls": {
        "Homepage": "https://gitlab.com/think-biq/piper-whistle"
    },
    "split_keywords": [
        "text-to-speech",
        "piper",
        "voice",
        "model",
        "tool"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "81595cd842c7104f2faf5bd2ffb4ba408e353a616fa7962bda4b94de22cca5be",
                "md5": "dfc59483788317751c20424ddcb46507",
                "sha256": "f567c07733af882cdfed14e798a2c219b3245e807602fc1dfddebdeb583ad9fe"
            },
            "downloads": -1,
            "filename": "piper_whistle-1.6.253-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dfc59483788317751c20424ddcb46507",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 23924,
            "upload_time": "2024-01-17T19:27:04",
            "upload_time_iso_8601": "2024-01-17T19:27:04.991032Z",
            "url": "https://files.pythonhosted.org/packages/81/59/5cd842c7104f2faf5bd2ffb4ba408e353a616fa7962bda4b94de22cca5be/piper_whistle-1.6.253-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2c614e618a31674078962c4fe15547cf42a6c000c47a0ef051497f34874bc170",
                "md5": "3a415733d149bfb804264f1725d8f549",
                "sha256": "fe3d4bb07a25423927088600708f06947915e5f7a7b0a7a3ed657d55641a2959"
            },
            "downloads": -1,
            "filename": "piper_whistle-1.6.253.tar.gz",
            "has_sig": false,
            "md5_digest": "3a415733d149bfb804264f1725d8f549",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 20569,
            "upload_time": "2024-01-17T19:27:06",
            "upload_time_iso_8601": "2024-01-17T19:27:06.138367Z",
            "url": "https://files.pythonhosted.org/packages/2c/61/4e618a31674078962c4fe15547cf42a6c000c47a0ef051497f34874bc170/piper_whistle-1.6.253.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-17 19:27:06",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "think-biq",
    "gitlab_project": "piper-whistle",
    "lcname": "piper-whistle"
}
        
biq
Elapsed time: 1.21871s