Perform audio alignment

Audio and text files are submitted via a HTTP multipart form POST. Each file is included as a multipart file attachment within the POST. The service supports several different formats for the audio file. The text must be a plain utf-8 encoded text file.

Request body

The body of the request must contain text and audio file fields.

E.g.

Content-Type: multipart/form-data; boundary=------------------------2e3fcd51d85aad0a

------------------------2e3fcd51d85aad0a
Content-Disposition: form-data; name="audio"; filename="abc.wav"
Content-Type: audio/wav
audio data

------------------------2e3fcd51d85aad0a
Content-Disposition: form-data; name="text"; filename="abc.txt"
Content-Type: text/plain
untimed text data

------------------------2e3fcd51d85aad0a--

In addition to the required audio and text files, a third param file can be provided which includes control values for the formatting of the primary SRT output. The param file is a json object with the following values:

Parameter

description

chars_per_sec

Character timing used when determining the compliance to other supplied limits.

chars_per_line

The maximum number of characters that can appear on a line of text.

min_line_time

The minimum length, in milliseconds, of a line of text.

max_frame_time

The maximum duration of an SRT frame (milliseconds).

min_frame_gap

The minimum amount of time between SRT frames (milliseconds).

avg_frame_pop_delay

The average amount of time an SRT frame should remain visible after the text for this frame has been spoken.

max_lines_per_frame

Maximum number of lines per SRT frame.

ellipse_min_silence

If the time between two SRT frames is above this value, ellipses (…) are added to the end of the last line of the current SRT frame and added to the beginning of the first line of the second frame to indicate a continuation

Sample param JSON file:

{
    "chars_per_sec": 25,
    "chars_per_line": 42,
    "min_line_time": 700,
    "max_frame_time": 7000,
    "min_frame_gap": 80,
    "avg_frame_pop_delay": 480,
    "max_lines_per_frame": 2,
    "ellipse_min_silence": 1200
}

User request completion callback

When submitting a request, an optional HTTP callback can be specified which will be invoked when the request completes or fails. The callback is an HTTP POST to the exact URL provided. Only one attempt is made to reach the URL provided. The contents of the HTTP request match the response from the Query audio alignment request status and retrieve results method.

Headers

  • x-requestid - Contains the request_id received when the request was submitted
  • x-status - One of the following indicating the status of the request:

Status

Description

“Completed”

The request has finished processing and the user callback, if provided has been called.

“Failed”

An error occurred processing the request.

  • x-error - If the request failed, this would contain an error message.
  • x-userdata - This will contain the user data supplied with the original request.

Body

If the status is “Completed” the body of the request contains the default SRT result from the alignment. If the status is “Failed” the body of the request contains the same error message provided in the “x-error” header.

Details

Language
Credentials
Header
Click Try It! to start a request and see the response here!