Skip to main content

Icespeak - Icelandic TTS library

Project description

License: GPL v3 Python 3.9 Release PyPI pre-commit Ruff tests

Icespeak

Icespeak is a Python 3.9+ library that makes Icelandic-language speech synthesis easy.

Local installation

Note: The Azure TTS package currently only supports OpenSSL version 3.0.*

Clone the repository and cd into the folder. Then create and activate a virtual environment:

python3 -m venv venv
source venv/bin/activate

Install minimal set of dependencies to use the library:

python3 -m pip install .

In order to use the CLI interface, tts, install with:

python3 -m pip install '.[cli]'

Alternatively, to install in editable mode with extra dev dependencies:

python3 -m pip install -e '.[dev]'

Usage

Before using, place API keys for the relevant services in the /keys folder (or a folder specified by the ICESPEAK_KEYS_DIR environment variable).

Alternately, you can set the following environment variables:

export ICESPEAK_AWSPOLLY_API_KEY=your-aws-polly-api-key
export ICESPEAK_AZURE_API_KEY=your-azure-api-key
export ICESPEAK_GOOGLE_API_KEY=your-google-api-key
export ICESPEAK_OPENAI_API_KEY=your-openai-api-key

Output audio files are saved to the directory specified by the ICESPEAK_AUDIO_DIR environment variable. By default Icespeak creates the directory <TEMP DIR>/icespeak where <TEMP DIR> is the temporary directory on your platform, fetched via tempfile.gettempdir().

By default, generated audio files are removed upon a clean exit, but this can be disabled by setting ICESPEAK_AUDIO_CACHE_CLEAN=0.

Text-to-speech

Simple example of TTS, which includes phonetic transcription:

from icespeak import tts_to_file, TTSOptions
text = """\
Þetta er texti fyrir talgervingu. \
Í honum er ýmislegt sem mætti vera hljóðritað, \
t.d. ræður talgerving oft illa við íslenskar skammstafanir, \
tölvupósta eins og ekki.tolvupostur@vefsida.is,
eða prósentur eins og 48,3%, o.fl.\
"""
tts_out = tts_to_file(
    text,
    TTSOptions(
        text_format="text", # Set to 'ssml' if SSML tags in text should be interpreted
        audio_format="mp3", # Output audio will be in mp3 format
        voice="Gudrun" # Azure TTS voice
    ),
    transcribe=True # Default is True
)
print(tts_out.file) # pathlib.Path instance pointing to file on local file system
print(tts_out.text) # text that was sent to the TTS service (after the phonetic transcription)

Results are cached, so subsequent calls with the same arguments should be fast.

License

Icespeak is Copyright © 2024 Miðeind ehf.

Miðeind ehf.

This set of programs is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This set of programs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

The full text of the GNU General Public License v3 is included here and also available here: https://www.gnu.org/licenses/gpl-3.0.html.

If you wish to use this set of programs in ways that are not covered under the GNU GPLv3 license, please contact us at mideind@mideind.is to negotiate a custom license. This applies for instance if you want to include or use this software, in part or in full, in other software that is not licensed under GNU GPLv3 or other compatible licenses.

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

icespeak-0.3.7.tar.gz (131.3 kB view details)

Uploaded Source

Built Distribution

icespeak-0.3.7-py3-none-any.whl (71.3 kB view details)

Uploaded Python 3

File details

Details for the file icespeak-0.3.7.tar.gz.

File metadata

  • Download URL: icespeak-0.3.7.tar.gz
  • Upload date:
  • Size: 131.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for icespeak-0.3.7.tar.gz
Algorithm Hash digest
SHA256 b11da9985f7409dcc722c1e40e355e212f1e9e4ff702647a7780bd5ade61f911
MD5 d0567f4de909722c7476474a4b620a0b
BLAKE2b-256 4f41bb62bf347c99f399f2f0c2cbe8d050b6bad4b7be115470ae1d9028a31b12

See more details on using hashes here.

File details

Details for the file icespeak-0.3.7-py3-none-any.whl.

File metadata

  • Download URL: icespeak-0.3.7-py3-none-any.whl
  • Upload date:
  • Size: 71.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for icespeak-0.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ac322bdbd02ccd4c9361572869f39a7495661a9c1ebd094cb88a1c8ffab489bc
MD5 9f67e0f7969eee121ec6d73f8c68081c
BLAKE2b-256 2f65ac2e7e4eb16db96274ccef5ab0fd5579d0867e135d6886173676907f0f11

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page