PipeSpeechGen
The PipeSpeechGen operator speaks a text with a speech generation model and produces an Audio, the recording of the speech, stored like any other file a run produces. Its text is a template over the pipe's inputs.
How it works
[pipe.announce_departure]
type = "PipeSpeechGen"
description = "Speaks the notice of a ferry's new departure time"
inputs = { ferry_name = "Text", departure_time = "Text" }
output = "Audio"
text = "The $ferry_name ferry now leaves at $departure_time."
model = "$speech-narration"
speed = 0.9
output_format = "mp3"
output_filename = "{{ ferry_name }} departure notice"
The text is spoken as it renders. text is a template with the same shorthand as a PipeLLM prompt, but its inputs render as plain text with no tags around them, since a tag or a markup sign would be read aloud. Every declared input must be read by the text or by output_filename, and an input neither reads is refused when the method loads. The text cannot be empty, and a text that renders to nothing but whitespace fails the step with pipe.prompt_empty. The text is for words: a text reading an Audio, an Image or a Document is refused when the method loads.
One text in, one recording out. The output is an Audio or a concept refining it, and is not a list. To speak every text of a list, map the PipeSpeechGen over it with a PipeBatch. The produced Audio carries the text it speaks as its source_text.
How it is spoken. Optional fields say how:
| Field | What it sets |
|---|---|
voice |
The name of one of the model's voices, such as en-US-AvaNeural. It overrides the voice the model reference sets; left out on both, the model speaks in its own default voice. |
speed |
The pace, from 0.5 to 2.0, 1.0 being the model's normal pace. It overrides the speed the model reference sets. |
output_format |
The file format, mp3, wav or ogg_opus. Left out, the model writes its own default. |
The speech generation model
A step names its model with model, a model handle, an alias such as @speech-neural or a preset such as $speech-narration, and a preset may carry a voice and a speed besides its model. Pipelex serves no speech generation model out of the box and its deck names no default: a speech backend comes with an inference backend plugin, and a step naming no model where the deck names no default is refused when the method loads with model.unspecified (see Transcription and speech generation models).
What the model can do is read off its spec, when this boot serves it. When the method loads, a voice the model does not speak with and a format it does not write are refused with model.capability_unsupported. A format the model does not write passes when the runtime has an audio converter ([runtime.audio_conversion], off by default): the model then speaks in a format it writes, and the step delivers the speech converted into the one asked (see Audio Conversion). A voice the step does not set comes from the deck, from the preset it names or the deck's default, and one the deck pairs with a model that does not speak it is the deployment's to fix: it is refused with pipelex.config.invalid, naming the deck's setting rather than the step. Before the call, in a dry run as in a live one, those are checked again, and a rendered text longer than the model speaks in one request is refused with pipe.prompt_too_long, its size and limit in characters. A model this boot does not serve is accepted, its capabilities unknown, and whichever runtime serves it checks them in turn.
Pricing
A speech generation is priced by the characters the model spoke, at the rates its model configuration states.