Synchronous short speech detection
The synchronous short audio moderation operation uses an HTTP or HTTPS interface to detect content in audio files. It converts audio to text in real time and returns content moderation results and risk tags to help you improve your review efficiency. This topic describes how to call the /green/voice/syncscan operation to moderate audio content.
Usage notes
API operation: /green/voice/syncscan. This operation performs synchronous audio moderation.
You can call this operation to create synchronous audio moderation tasks. For more information about how to construct an HTTP request, see Request structure. You can also use a pre-built HTTP request. For more information, see SDK overview.
By default, audio moderation detects Mandarin Chinese. To detect other languages or dialects, contact your account manager. Other languages include English, Japanese, Spanish, Arabic, French, Indonesian, and Vietnamese. Dialects include Cantonese, Sichuanese, Hubei dialect, Shaanxi dialect, Shanxi dialect, Henan dialect, Northeastern dialect, Tianjin dialect, Gansu dialect, Guizhou dialect, Yunnan dialect, Jiangxi dialect, Guangxi dialect, Hunan dialect, Shandong dialect, Suzhou dialect, Zhejiang dialect, Shanghainese, and Minnan.
- Billing information:
This is a paid API operation. For more information about billing, see Content Moderation Pricing.
- Audio file requirements:
- The size of an audio file cannot exceed 20 MB.
- The duration of an audio file cannot exceed 1 minute.
- Supported audio file formats: MP3, WAV, AAC, WMA, OGG, M4A, and M3U8.
- Supported video file formats that contain audio: AVI, FLV, MP4, MPG, ASF, WMV, MOV, RMVB, and RM.
QPS limit
The queries per second (QPS) limit for this API is 50 per user. Exceeding this limit triggers throttling, which can impact your business. Plan your calls accordingly.
Request parameters
| Name | Type | Required | Example value | Description |
| bizType | String | No | default | This field identifies your business scenario. You can create a business scenario in the Content Moderation console. For more information, see Customize moderation rules. |
| scenes | StringArray | Yes | antispam | The detection scenario. Set the value to antispam. |
| tasks | JSONArray | Yes | The detection objects. Each element in the JSON array is a struct for a detection task. You can specify up to 100 elements, which means you can submit up to 100 content entries for detection at a time. To submit 100 elements, you must increase the number of concurrent tasks to more than 100. For more information about the structure of each element, see task. |
| Name | Type | Required | Example | Description |
| clientInfo | JSONObject | No | {"userId":"120234234","userNick":"Mike","userType":"others"} | The client information. For more information, see the common query parameters in Common parameters. The server merges the global clientInfo with the individual clientInfo specified for the request. Note
The individual clientInfo has a higher priority. |
| dataId | String | No | abc_123 | The data ID of the detection object. This ID can contain uppercase and lowercase letters, digits, underscores (_), hyphens (-), and periods (.), and must be 128 characters or less. Use it to uniquely identify your business data. |
| url | String | Yes | http://aliyundoc.com/test.mp3 | The URL of the object to detect.
|
Returned Data
| Name | Type | Example | Description |
| code | Integer | 200 | The error code. It is the same as the HTTP status code. For more information, see Common error codes. |
| msg | String | OK | The message returned for the request. |
| dataId | String | abc_123 | The data ID of the detection object. Note
If dataId was passed in the detection request, the same dataId is returned here. |
| taskId | String | vc_f_1OsjIYTukH@4@AXkIQ9xxx-1ov52Y | The ID of the detection task. |
| url | String | http://aliyundoc.com/test.mp3 | The URL of the object to detect.
|
| results | JSONArray | The detection results returned when the call is successful (code=200). The results contain one or more elements. Each element is a struct. For more information about the structure of each element, see result. |
| Name | Type | Example | Description |
| scene | String | antispam | The detection scenario. This corresponds to the scenario in the request. The value is fixed as antispam. |
| label | String | customized | The category of the detection result. Valid values:
|
| suggestion | String | block | The recommended subsequent operation. Valid values:
|
| rate | Float | 99.91 | The confidence score. Valid values: 0 (lowest confidence) to 100 (highest confidence). If the suggestion is pass, the higher the confidence score, the more likely the content is compliant. If the suggestion is review or block, the higher the confidence score, the more likely the content is non-compliant. Important
We recommend that you use the suggestion and label (or sublabel, for some API operations) fields to determine whether the content is in violation. |
| details | JSONArray | The details of the text that corresponds to the audio. This can contain one or more elements. Each element corresponds to a sentence. For more information about the structure of each element, see detail. |
| Name | Type | Example | Description |
| startTime | Integer | 0 | The start timestamp of the sentence, in seconds. |
| endTime | Integer | 4065 | The end timestamp of the sentence, in seconds. |
| text | String | Disgusting | The text converted from the audio. |
| label | String | politics | The category of the detection result. Valid values:
|
| persons | JSONArray | [{"name":"Sensitive Person A"}] | The voiceprint recognition result. This field is returned if the voiceprint of a sensitive person is hit. The structure is as follows:
Note This field is not returned by default. If you need this feature, contact your account manager. |
| keyword | String | Disgusting | If a user-defined keyword is hit, the keyword is returned. |
| libName | String | test | If a user-defined keyword is hit, the corresponding thesaurus is returned. |
Examples
http(s)://[Endpoint]/green/voice/syncscan
&<Common request parameters>{
"scenes":[
"antispam"
],
"tasks":[
{
"dataId":"abcd-123",
"url":"http://aliyundoc.com/test.mp3"
}
]
}{
"msg":"OK",
"code":200,
"data":[
{
"code":200,
"dataId":"abcd-123",
"results":[
{
"rate":99.91,
"suggestion":"block",
"details":[
{
"libName":"test",
"startTime":0,
"endTime":4065,
"label":"customized",
"text":"Disgusting",
"keyword":"Disgusting"
},
{
"startTime":4430,
"endTime":10065,
"label":"normal",
"persons": [
{
"name": "Sensitive Person A"
}
],
"text":"Hahaha"
},
{
"libName":"Audio",
"startTime":11670,
"endTime":14685,
"label":"customized",
"text":"Clearance sale",
"keyword":"Sale"
},
{
"startTime":14685,
"endTime":16065,
"label":"ad",
"text":"12345"
}
],
"label":"customized"
}
],
"taskId":"vc_f_1OsjIYTukH@4@AXkIQ9xxx-1ov52Y"
}
],
"requestId":"5A7A6198-6960-4DDC-B67E-58A111A4B20F"
}