Contents
BytePlus LAS lets you call Volcano Engine's text-to-speech API from a Daft operator to convert text into audio data. Enterprise verification is required, so first check your verification status and API connection details.
Key Points#
- The feature is called “Text-to-Speech (Doubao Speech Large Model).”
- It takes a text column as input and produces an audio data column; failures and empty strings return
None. appid,token,uid, andclusterare required;appidandtokencan be passed through environment variables.- You can specify the audio format, voice, speed, sample rate, emotion, and other settings.
- This feature is available to users who have completed enterprise verification.
What It Does#
This operator integrates text-to-speech into Daft data processing. It supports bulk text processing and parallel processing of multiple inputs. Audio results include Base64-encoded audio and the original response.
Listed use cases include voice guidance, customer support audio, narration for short videos, and read-aloud content. For any use case, first check whether the API settings support the voices and formats you need.
What to Check Before Use#
First, complete Volcano Engine's enterprise verification. Until verification is complete, you cannot test or use this feature.
Next, prepare your appid, token, uid, and cluster. The documentation's code example reads appid and token from the environment variables OPENSPEECH_APPID and OPENSPEECH_TOKEN. This keeps the token in the runtime environment rather than directly in the source code.
Calling It from Daft#
The documentation's example passes AudioTtsDoubao to las_udf and applies it to a text column. A minimal setup looks like this:
appid = os.getenv("OPENSPEECH_APPID")
token = os.getenv("OPENSPEECH_TOKEN")
df = daft.from_pydict({
"text_input": ["今天天气真好,适合出去走走。"]
})
df = df.with_column(
"tts_audio",
las_udf(
AudioTtsDoubao,
construct_args={
"appid": appid,
"token": token,
"uid": "test",
"concurrency": 1,
"timeout": 60,
},
num_cpus=1,
batch_size=1,
concurrency=1,
)(col("text_input")),
)To run this, you need an environment with daft and the relevant LAS modules available. When running with Ray, initialize Ray before calling daft.set_runner_ray(), as shown in the example. The sample sets both processing concurrency and batch size to 1.
Choosing Audio Parameters#
The defaults are zh_female_wanqudashu_moon_bigtts for the voice, mp3 for the format, 1.0 for speed, 24000 for the sample rate, and 160 for the bitrate. Emotional expression is disabled by default; when enabled, the default emotion is happy with an intensity of 4.
An easy starting point is to process a short text with the defaults and check the voice and output format. If you change the speed or emotion, listen to the output to confirm it suits your content before applying the settings in production. Additional audio and request parameters can be specified through extra_audio_params and extra_request_params, respectively.
Limits and Failure Handling#
The default timeout is 60 seconds, and the coroutine count is 1. If the input is an empty string or synthesis fails, the corresponding output is None. Make sure downstream processing can detect rows with missing audio.
The documentation does not provide specific pricing, usage limits, or a list of supported languages. Before deployment, check the terms of availability for your enterprise account and whether your desired languages and voices are currently available through the BytePlus console or your support contact.
Next Step#
Confirm enterprise verification and the four connection details, set the environment variables, then synthesize one short text using the default MP3 settings and check the output.
Source: https://docs.byteplus.com/en/docs/Byteplus_LAS/Text-to-Speech-doubao
Contents
