Vocal Score

Feature Introduction

Music scoring provides users with multi-dimensional singing scoring capabilities. Currently supported scoring dimensions include: pitch, rhythm, with the following features:

  • High real-time performance: Able to complete all indicator evaluations within 1/6-1/8 of the singing duration
  • High accuracy: Able to accurately evaluate core indicators such as pitch and rhythm for each sung line
  • High adaptability: Able to score singing for various timbres including male, female, children, youth, and elderly voices

API Description

Request Method: POST (HTTP)

Request URL: https://api.mediax.tencent.com/job

Request Header: Content-Type: application/json

Request Flow: The API includes 'Create Task' and 'Query Task'. After creating a task, users can actively query the task to know the result, or input a callback address when creating the task, and the task will automatically callback to that address after completion

Other Requirements: File format: Common audio formats are recommended, such as mp3, wav

Create Task

Parameter Description

Parameter Required Type Description
action Yes string Common parameter, here is CreateJob
secretId Yes string Common parameter, user SecretId
secretKey Yes string Common parameter, user SecretKey
createJobRequest Yes object
- inputs Yes Array of Input Input, input structure array
- outputs Yes Array of Output Output, output structure array
- callback No string Callback address, default: callback disabled
- customId No string User-defined task ID, less than 64 characters
- timeout No int Task timeout, in seconds. Task will be set to ERROR after timeout

Input

Parameter Required as Parameter Type Description
url No string Source URL address of the music file to be scored, choose one with source field
source No object Repository source settings for the music file to be scored, choose one with url field
- contentId Yes string Repository ID
- path Yes string Source path

Note: Only one of the source and url fields can be present

Output

Parameter Required as Parameter Type Description
inputSelectors Yes Array of int Input source for this output
smartContentDescriptor Yes SmartContentDescriptor Smart capability description, default: empty
- outputPrefix No string Output file prefix, less than 20 characters, default: empty
- vocalScore Yes object Music scoring options
-- rawAudio No object Evaluation standard file. Original audio file without standardization, choose one with standardAudio field
--- url No string Source URL address of original audio file, choose one with source field
--- source No object Repository source settings for original audio file, choose one with url field
---- contentId Yes string Repository ID
---- path Yes string Source path
-- standardAudio No object Evaluation standard file. Related files after standardization of original audio, choose one with rawAudio field
--- midi Yes object MIDI file
---- url No string Source URL address of MIDI file, choose one with source field
---- source No object Repository source settings for MIDI file, choose one with url field
----- contentId Yes string Repository ID
----- path Yes string Source path
--- alignWav Yes object Audio file without silence at the beginning
---- url No string Source URL address of audio file without silence at the beginning, choose one with source field
---- source No object Repository source settings for audio file without silence at the beginning, choose one with url field
----- contentId Yes string Repository ID
----- path Yes string Source path
--- standardWav Yes object Standardized audio file
---- url No string Source URL address of standardized audio file, choose one with source field
---- source No object Repository source settings for standardized audio file, choose one with url field
----- contentId Yes string Repository ID
----- path Yes string Source path

Request Example:

{
  "action": "CreateJob",
  "secretId": "{secretId}",
  "secretKey": "{secretKey}",
  "createJobRequest": {
    "customId": "{customId}",
    "callback": "{callback}",
    "inputs": [{ "url": "{url}" }],
    "outputs": [
      {
        "inputSelectors": [0],
        "smartContentDescriptor": {
          "outputPrefix": "{outputPrefix}",
          "vocalScore": {
            "standardAudio": {
              "midi": {"url":"{url}"},
              "standardWav": {"url":"{url}"},
              "alignWav": {"url":"{url}"}
            }
          }
        }
      }
    ]
  }
}

Response Example:

{
    "requestId": "ac004192-110b-46e3-ade8-4e449df84d60",
    "createJobResponse": {
        "job": {
            "id": "13f342e4-6866-450e-b44e-3151431c578b",
            "state": 1, // See state description below
            "customId": "{customId}",
            "callback": "{callback}",
            "inputs": [ { "url": "{url}" } ],
            "outputs": [
                {
                    "inputSelectors": [ 0 ],
                    "smartContentDescriptor": {
                        "outputPrefix": "{outputPrefix}",
                        "vocalScore": {
                          "standardAudio": {
                            "midi": {"url":"{url}"},
                            "standardWav": {"url":"{url}"},
                            "alignWav": {"url":"{url}"}
                          }
                        }
                    }
                }
            ],
            "timing": {
                "createdAt": "1603432763000",
                "startedAt": "0",
                "completedAt": "0"
            }
        }
    }
}

State

Value Meaning
1 SUBMITTED
2 PROCESSING
3 COMPLETED
4 ERROR
5 CANCELED

Get Task Information

There are two ways to get information: active query and passive callback.

  • Active query has two types of query interfaces based on id category: one is to query based on user-defined id, since the platform cannot guarantee the uniqueness of this id, it returns a Job array (see 1); the other is to query by the id in the response after creating the task (see 2)
  • Passive callback requires filling in the callback field when creating the task, the platform will send the Job structure to the address specified by callback after the task enters the completion state (COMPLETED/ERROR) (see 3), the platform recommends using passive callback to get task results.

In the music scoring capability, if the queried task is successful (state=3), the task's Output will carry a smartContentResult structure, in which the vocalScore field stores the scoring result JSON string, including pitch score PitchPerformance, range 0-100, rhythm score RhythemPerformance, range 0-100.

1. Active Query, Based on User-Defined customId Passed When Creating Task

Request Example:

{
  "action": "ListJobs",
  "secretId": "{secretId}",
  "secretKey": "{secretKey}",
  "listJobsRequest": {
    "customId": "{customId}"
  }
}

Note: jobs in the listJobs response is an array

Response Example:

{
  "requestId": "c9845a99-34e3-4b0f-80f5-f0a2a0ee8896",
  "listJobsResponse": {
    "jobs": [
      {
        "id": "a95e9d74-6602-4405-a3fc-6408a76bcc98",
        "state": 3,
        "customId": "{customId}",
        "callback": "{callback}",
        "timing": {
          "createdAt": "1610513575000",
          "startedAt": "1610513575000",
          "completedAt": "1610513618000"
        },
        "inputs": [
          {
            "url": "{url}"
          }
        ],
        "outputs": [
          {
            "inputSelectors": [0],
            "smartContentDescriptor": {
              "outputPrefix": "{outputPrefix}",
              "vocalScore": {
                "standardAudio": {
                  "midi": {"url":"{url}"},
                  "standardWav": {"url":"{url}"},
                  "alignWav": {"url":"{url}"}
                }
              }
            },
            "smartContentResult": {
              "vocalScore": "{ \"PitchPerformance\":70.0850183393764, \"RhythemPerformance\":99.99999999999999 }"
            }
          }
        ]
      }
    ],
    "total": 1
  }
}

2. Active Query, Based on id in Response After Creating Task

Request Example:

{
  "action": "GetJob",
  "secretId": "{secretId}",
  "secretKey": "{secretKey}",
  "getJobRequest": {
    "id": "{id}"
  }
}

Response Example:

{
  "requestId": "c9845a99-34e3-4b0f-80f5-f0a2a0ee8896",
  "getJobResponse": {
    "job": {
      "id": "a95e9d74-6602-4405-a3fc-6408a76bcc98",
      "state": 3,
      "customId": "{customId}",
      "callback": "{callback}",
      "timing": {
        "createdAt": "1610513575000",
        "startedAt": "1610513575000",
        "completedAt": "1610513618000"
      },
      "inputs": [{ "url": "{url}" }],
      "outputs": [
        {
          "inputSelectors": [0],
          "smartContentDescriptor": {
            "outputPrefix": "{outputPrefix}",
            "vocalScore": {
              "standardAudio": {
                "midi": {"url":"{url}"},
                "standardWav": {"url":"{url}"},
                "alignWav": {"url":"{url}"}
              }
            }
          },
          "smartContentResult": {
              "vocalScore": "{ \"PitchPerformance\":70.0850183393764, \"RhythemPerformance\":99.99999999999999 }"
          }
        }
      ]
    }
  }
}

3. Passive Callback

The entire Job structure of the task that enters the completion state (COMPLETED/ERROR) will be sent to the address corresponding to the callback field specified by the user when creating the task. See the active query example (under getJobResponse) for the Job structure

cURL Example

Create Task

curl --location --request POST 'https://api.mediax.tencent.com/job' \
--header 'Content-Type: application/json' \
--data-raw '{
  "action": "CreateJob",
  "secretId": "{secretId}",
  "secretKey": "{secretKey}",
  "createJobRequest": {
    "customId": "{customId}",
    "callback": "{callback}",
    "inputs": [{
      "url": "{url}"
    }],
    "outputs": [{
      "inputSelectors": [0],
      "smartContentDescriptor": {
        "outputPrefix": "{outputPrefix}",
          "vocalScore": {
            "standardAudio": {
              "midi": {"url":"{url}"},
              "standardWav": {"url":"{url}"},
              "alignWav": {"url":"{url}"}
            }
          }
        }
      }
    ]
  }
}'

Query Task

# Based on customId
curl --location --request POST 'https://api.mediax.tencent.com/job' \
--header 'Content-Type: application/json' \
--data-raw '{
    "action": "ListJobs",
    "secretId": "{secretId}",
    "secretKey": "{secretKey}",
    "listJobsRequest": {
        "customId": "{customId}"
    }
}'

# Based on id
curl --location --request POST 'https://api.mediax.tencent.com/job' \
--header 'Content-Type: application/json' \
--data-raw '{
    "action": "GetJob",
    "secretId": "{secretId}",
    "secretKey": "{secretKey}",
    "getJobRequest": {
        "id": "{id}"
    }
}'
Tencent Media Lab
We would like to use performance and analytics cookies (“Cookies”) to help us recognize whether you are a returning visitor and to track the number of website views and visits. For more information about the Cookies we use and your options (including how to change your preferences) see our Cookies Policy.