Skip to contents

Generate speech audio from text and write it to disk. The public `hf-inference` provider did not expose a broadly available TTS model during verification; use this with a compatible model/provider or dedicated Inference Endpoint.

Usage

hf_text_to_speech(
  text,
  output = NULL,
  model = hf_default_model("text_to_speech"),
  token = NULL,
  endpoint_url = NULL,
  overwrite = FALSE,
  ...
)

Arguments

text

Character vector of text to synthesize.

output

Character path(s) or NULL. When NULL, files are written to temporary paths with an extension inferred from the response content type.

model

Character string. Model ID from Hugging Face Hub. Default: "facebook/mms-tts-eng".

token

Character string or NULL. API token for authentication.

endpoint_url

Character string or NULL. A custom Inference Endpoint URL.

overwrite

Logical. If TRUE, overwrite existing output files.

...

Additional generation parameters passed to the model.

Value

A tibble with columns: text, path, content_type, audio.

Examples

if (FALSE) { # \dontrun{
hf_text_to_speech("Hello from R.")
} # }