tts.picovoice#
Description#
This TTS plugin enables you to render text as audio using Picovoice’s (still experimental) Orca TTS engine.
Take a look at
platypush.plugins.assistant.picovoice.AssistantPicovoicePlugin
for details on how to sign up for a Picovoice account and get the API key.
Also note that using the TTS features requires you to select Orca from the list of products available for your account on the Picovoice console.
Configuration#
tts.picovoice:
# [Optional]
# Picovoice access key. If it's not specified here,
# then it must be specified on the configuration of
# `AssistantPicovoicePlugin <https://docs.platypush.tech/platypush/plugins/assistant.picovoice.html#platypush.plugins.assistant.picovoice.AssistantPicovoicePlugin>`_.
# access_key: # type=str | None
# [Optional]
# Path of the TTS model file (default: use the default
# English model).
# model_path: # type=str | None
# [Optional]
# Language code (default: ``en-US``).
# language: en-US
# [Optional]
# Audio output device to use for playback.
# Supported formats: PortAudio/sounddevice device index,
# PortAudio/sounddevice device name, or PulseAudio/PipeWire sink name
# (e.g. ``alsa_output.pci-...``; requires ``pactl``). If specified,
# it is passed as the ``device`` argument to
# `SoundPlugin.play <https://docs.platypush.tech/platypush/plugins/sound.html#platypush.plugins.sound.SoundPlugin.play>`_.
# output_device: # type=int | str | None
# [Optional]
# Playback volume, as a percentage. ``100`` means
# unchanged, values below ``100`` attenuate, and values above ``100``
# amplify with clipping in the playback path. It is passed as the
# ``volume`` argument to `SoundPlugin.play <https://docs.platypush.tech/platypush/plugins/sound.html#platypush.plugins.sound.SoundPlugin.play>`_.
# output_volume: # type=float | None
Dependencies#
pip
pip install numpy sounddevice pvorca
Alpine
apk add py3-numpy ffmpeg
Debian
apt install python3-numpy ffmpeg
Fedora
yum install python-numpy ffmpeg
Arch Linux
pacman -S python-numpy ffmpeg python-sounddevice
Actions#
Module reference#
- class platypush.plugins.tts.picovoice.TextConversionUtils[source]#
Bases:
objectUtility class to convert text to a format that is supported by the Orca TTS engine.
This pre-processing step is necessary until the issue is fixed: Picovoice/orca#10.
- __init__()#
- class platypush.plugins.tts.picovoice.TtsPicovoicePlugin(access_key: str | None = None, model_path: str | None = None, **kwargs)[source]#
Bases:
TtsPluginThis TTS plugin enables you to render text as audio using Picovoice’s (still experimental) Orca TTS engine.
Take a look at
platypush.plugins.assistant.picovoice.AssistantPicovoicePluginfor details on how to sign up for a Picovoice account and get the API key.Also note that using the TTS features requires you to select Orca from the list of products available for your account on the Picovoice console.
- __init__(access_key: str | None = None, model_path: str | None = None, **kwargs)[source]#
- Parameters:
access_key – Picovoice access key. If it’s not specified here, then it must be specified on the configuration of
platypush.plugins.assistant.picovoice.AssistantPicovoicePlugin.model_path – Path of the TTS model file (default: use the default English model).
- say(text: str, *_, output_file: str | None = None, output_device: int | str | None = None, output_volume: float | None = None, speech_rate: float | None = None, model_path: str | None = None, **__)[source]#
Say some text.
- Parameters:
text – Text to say.
output_file – If set, save the audio to the specified file. Otherwise play it.
output_device – Audio output device to use for playback. Supported formats: PortAudio/sounddevice device index, PortAudio/sounddevice device name, or PulseAudio/PipeWire sink name (e.g.
alsa_output.pci-...; requirespactl). Overrides the plugin’s configuredoutput_device.output_volume – Playback volume, as a percentage.
100means unchanged, values below100attenuate, and values above100amplify with clipping. Overrides the plugin’s configuredoutput_volume.speech_rate – Speech rate (default: None).
model_path – Path of the TTS model file (default: use the default configured model).