Synchronous short speech detection

Updated at:

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.

Note

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

NameTypeRequiredExample valueDescription
bizTypeStringNodefault

This field identifies your business scenario. You can create a business scenario in the Content Moderation console. For more information, see Customize moderation rules.

scenesStringArrayYesantispamThe detection scenario. Set the value to antispam.
tasksJSONArrayYesThe 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.
Table 1. task
NameTypeRequiredExampleDescription
clientInfoJSONObjectNo{"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.

dataIdStringNoabc_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.

urlStringYeshttp://aliyundoc.com/test.mp3

The URL of the object to detect.

  • A public HTTP or HTTPS URL. The URL cannot exceed 2,048 characters in length.

  • The path of a file stored in an Alibaba Cloud OSS bucket. You must first grant Content Moderation permissions to access the OSS bucket. The OSS bucket must be in the same region as the Content Moderation service. For more information, see Authorize Content Moderation to access an OSS bucket.

    File path format: oss://<bucket-name>.<endpoint>/<object-name>

Returned Data

NameTypeExampleDescription
codeInteger200

The error code. It is the same as the HTTP status code.

For more information, see Common error codes.

msgStringOKThe message returned for the request.
dataIdStringabc_123

The data ID of the detection object.

Note

If dataId was passed in the detection request, the same dataId is returned here.

taskIdStringvc_f_1OsjIYTukH@4@AXkIQ9xxx-1ov52YThe ID of the detection task.
urlStringhttp://aliyundoc.com/test.mp3

The URL of the object to detect.

  • A public HTTP or HTTPS URL. The URL cannot exceed 2,048 characters in length.

  • The path of a file stored in an Alibaba Cloud OSS bucket. You must first grant Content Moderation permissions to access the OSS bucket. The OSS bucket must be in the same region as the Content Moderation service. For more information, see Authorize Content Moderation to access an OSS bucket.

    File path format: oss://<bucket-name>.<endpoint>/<object-name>

resultsJSONArrayThe 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.
Table 2. result
NameTypeExampleDescription
sceneStringantispamThe detection scenario. This corresponds to the scenario in the request. The value is fixed as antispam.
labelStringcustomizedThe category of the detection result. Valid values:
  • normal: normal text
  • spam: Contains spam messages.
  • ad: ads
  • politics: political content
  • terrorism: terrorist content
  • abuse: Offensive or insulting language
  • porn: pornographic content
  • flood: excessive junk content
  • contraband: prohibited content
  • meaningless: No meaning.
  • harmful: undesirable scenarios (for protecting minors, including worshiping money, fan culture, negative emotions, and negative guidance)
  • customized: custom content (such as a hit on a custom keyword)
suggestionStringblockThe recommended subsequent operation. Valid values:
  • pass: The content is normal. No further action is required.
  • review: The result is inconclusive and requires manual review.
  • block: The content is non-compliant. We recommend that you delete the content or restrict its visibility.
rateFloat99.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.

detailsJSONArrayThe 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.
Table 3. detail
NameTypeExampleDescription
startTimeInteger0The start timestamp of the sentence, in seconds.
endTimeInteger4065The end timestamp of the sentence, in seconds.
textStringDisgustingThe text converted from the audio.
labelStringpoliticsThe category of the detection result. Valid values:
  • normal: normal text
  • spam: Contains spam messages.
  • ad: ads
  • politics: political content
  • terrorism: terrorist content
  • abuse: Offensive or insulting language
  • porn: pornographic content
  • flood: excessive junk content
  • contraband: prohibited content
  • meaningless: No meaning.
  • harmful: undesirable scenarios (for protecting minors, including worshiping money, fan culture, negative emotions, and negative guidance)
  • customized: custom content (such as a hit on a custom keyword)
personsJSONArray[{"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:
  • name: a string that indicates the sensitive person information identified from the audio.
Note This field is not returned by default. If you need this feature, contact your account manager.
keywordStringDisgustingIf a user-defined keyword is hit, the keyword is returned.
libNameStringtestIf a user-defined keyword is hit, the corresponding thesaurus is returned.

Examples

Sample request
http(s)://[Endpoint]/green/voice/syncscan
&<Common request parameters>{
    "scenes":[
        "antispam"
    ],
    "tasks":[
        {
            "dataId":"abcd-123",
            "url":"http://aliyundoc.com/test.mp3"
        }
    ]
}
Sample response
{
    "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"
}