Sambert client events

更新时间:
复制 MD 格式

For model details and recommendations, see Speech synthesis.

Important

Sambert is available only in the China (Beijing) region.

Important

Model Studio has released a workspace-specific domain for the China (Beijing) region: https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com. The new dedicated domain delivers superior performance and higher stability for inference requests. We recommend migrating from https://dashscope.aliyuncs.com to the new domain.

{WorkspaceId} is your workspace ID, which can be found on the Workspace Details page in the Model Studio console. The existing domain remains fully functional.

run-task

Description: Starts a speech synthesis task and sends the text to synthesize in a single request.

When to send: Send this event immediately after establishing the WebSocket connection.

Response event: The server returns a task-started event.

Important

Sambert doesn't support streaming input or the continue-task and finish-task events. Send the full text in the input.text field of the run-task event.

header object (required)

Attributes

action string (required)

The event type. Must be run-task.

task_id string (required)

A client-generated task ID in UUID format, used to correlate subsequent events.

streaming string (required)

Must be out.

{
    "header": {
        "action": "run-task",
        "task_id": "2bf83b9a-baeb-4fda-8d9a-xxxxxxxxxxxx",
        "streaming": "out"
    },
    "payload": {
        "task_group": "audio",
        "task": "tts",
        "function": "SpeechSynthesizer",
        "model": "sambert-zhichu-v1",
        "parameters": {
            "text_type": "PlainText",
            "format": "wav",
            "sample_rate": 16000,
            "volume": 50,
            "rate": 1.0,
            "pitch": 1.0,
            "word_timestamp_enabled": true,
            "phoneme_timestamp_enabled": true
        },
        "input": {
            "text": "Before my bed, moonlight shines bright, I suspect it's frost upon the ground."
        }
    }
}

payload object (required)

Attributes

task_group string (required)

The task group. Must be audio.

task string (required)

The task type. Must be tts.

function string (required)

The function type. Must be SpeechSynthesizer.

model string (required)

The model name, such as sambert-zhichu-v1.

input object (required)

The input data. Contains a text field for the text to synthesize.

text string (required)

The text to synthesize.

parameters object (required)

Speech synthesis parameters.

Attributes

text_type string (required)

Must be PlainText.

format string (optional)

The audio format.

Valid values:

  • pcm

  • wav (default)

  • mp3

sample_rate integer (optional)

The audio sample rate, in Hz.

Valid values: 8000, 16000 (default), 22050, and 24000.

volume integer (optional)

The volume level.

Default value: 50.

Valid values: 0 to 100.

rate float (optional)

The speech rate.

Default value: 1.0.

Valid values: 0.5 to 2.0.

pitch float (optional)

The pitch level.

Default value: 1.0.

Valid values: 0.5 to 2.0.

word_timestamp_enabled boolean (optional)

Specifies whether to enable word-level timestamps.

Default value: false.

Applies to all Sambert models.

phoneme_timestamp_enabled boolean (optional)

Specifies whether to enable phoneme-level timestamps.

Default value: false.

word_timestamp_enabled must be true before you enable this parameter.