接口
查询参数
响应
data 字段是一个归一化振幅值数组(0.0 到 1.0),以固定间隔采样自片段全程。
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
获取用于音频可视化的波形振幅数据
GET /api/v1/music/waveform?clip_id={clip_id}
| 参数 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
clip_id | string | 必填 | 要获取波形的音频片段 ID。通过 音频上传 获取(data.clipId),或使用生成任务完成后的 results[].id。 |
{
"code": 0,
"message": "ok",
"request_id": "req-1710000000000",
"data": [0.12, 0.45, 0.78, 0.56, 0.34, ...]
}
data 字段是一个归一化振幅值数组(0.0 到 1.0),以固定间隔采样自片段全程。
curl "https://api.example.com/api/v1/music/waveform?clip_id=abc123def456" \
-H "Authorization: Bearer sk-mm-your-key"
function drawWaveform(canvas, amplitudes) {
const ctx = canvas.getContext('2d');
const w = canvas.width, h = canvas.height;
amplitudes.forEach((amp, i) => {
const x = (i / amplitudes.length) * w;
const barH = amp * h;
ctx.fillRect(x, (h - barH) / 2, 1, barH);
});
}