| foundry_speak | R Documentation |
Use a Microsoft Foundry speech deployment to synthesize audio and save it to
a local file. The v1 data-plane path is used by default; set
api = "deployment" for a deployment exposed only on the classic
/openai/deployments/{model}/audio/speech path.
foundry_speak(
text,
model = NULL,
voice = "alloy",
path = NULL,
response_format = "mp3",
instructions = NULL,
speed = NULL,
overwrite = FALSE,
api = c("v1", "deployment"),
api_key = NULL,
token = NULL,
endpoint = NULL,
api_version = NULL
)
text |
Character. Text to synthesize. |
model |
Character. Speech model deployment name. |
voice |
Character. Voice name supported by the deployed model. |
path |
Character. Output file path. Defaults to a temporary file. |
response_format |
Character. Audio format such as |
instructions |
Character. Optional style or pronunciation instructions. |
speed |
Numeric. Optional speech speed. |
overwrite |
Logical. Whether to overwrite an existing file. |
api |
Character. |
api_key |
Character. Optional API key override. |
token |
Character. Optional bearer token override. |
endpoint |
Character. Optional endpoint override. |
api_version |
Character. Optional API version. Defaults to
|
A tibble with the output path, byte count, model, voice, and format.
## Not run:
# Requires a configured Azure endpoint, credentials, and a speech deployment.
local({
path <- tempfile(fileext = ".mp3")
on.exit(unlink(path))
foundry_speak(
"Hello from R.", model = "gpt-4o-mini-tts", voice = "alloy", path = path
)
})
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.