Skip to main content

Speech Translation: start task

POST 

/api/technology/speech-translation-whisper-enhanced

Start an Enhanced Speech Translation Built on Whisper task for a media file.

Enhanced Speech Translation Built on Whisper features

  • Multi-channel audio files are supported.
  • Channel id is included in individual translation segments.
  • Source language for translation of the whole audio can be specified as a query parameter. It is mutually exclusive with the language_switching parameter.
  • Language switching can be activated via a query parameter. With this feature, the technology automatically identifies the predominant language spoken within each thirty-second segment of audio and uses it as the source language for translating that particular segment. It is mutually exclusive with the source_language parameter.
  • To use a specific language as the source, it must be licensed. Otherwise, an error is raised.
  • If you use auto-detect or language switching, only licensed languages are considered as the source for the translation. In case the actually detected language is not licensed, the closest licensed language is used instead.

Request

Query Parameters

    channel_mode Channel Mode

    Possible values: [split, mix]

    A string enumeration value representing the channel mode for conversion. This value indicates how the audio channels should be processed during conversion. Only the channels with the specified indices (channels parameter) will be processed, and others will be ignored.

    Default value: split
    channels Channels

    A string of integers separated by comma (without spaces), representing the channels that should be kept during conversion. If specified, only the channels with the specified indices will be processed, and others will be ignored. If empty, all channels in the audio data will be processed. Note that channels is 0-based.

    Default value:
    range_from Range From

    Possible values: >= 0

    Specifies the time in the input file where processing starts. If the parameter equals 0 (the default value), the recording is processed from the beginning. Time is given in seconds.

    Default value: 0
    range_to Range To

    Possible values: >= 0

    Specifies the time in the file where processing ends. If the parameter is not specified, the input file is processed to the end. Time is given in seconds.

    source_language Source Language

    A string specifying the source language for Enhanced Speech Translation Built on Whisper. The value should follow RFC 5646. It can consist of the "language", "region", and "privateuse" subtags. Refer to supported languages for a complete list of supported language tags. Omit the parameter altogether for automatic detection of the language.

    language_switching Language Switching

    By default, the language of the audio is detected once at the beginning of processing. Setting language_switching to true allows for dynamic language switching in the audio, with the language being detected approximately every 30 seconds.

    Default value: false

Header Parameters

    x-correlation-id X-Correlation-Id

    Correlation ID is a special type of request ID which is unique over a series of requests and responses, identifying a transaction in a distributed system. Correlation ID will be generated if not provided.

    Default value:
    x-request-id X-Request-Id

    In distributed system architecture (microservices architecture) it is a unique ID of request and response combination throughout all components of a distributed system. Request ID will be generated if not provided.

    Default value:

Bodyrequired

    filestring<binary>required

    Input media file.

Responses

Speech translation task was accepted. Follow the Location header to poll for the task state.

Response Headers
    X-Location

    ⚠️ Deprecated - use Location header instead.

    Example: /api/technology/speech-translation-whisper-enhanced/123e4567-e89b-12d3-a456-426614174000
    Location

    A URL the client should poll for task state and result.

    Example: /api/technology/speech-translation-whisper-enhanced/123e4567-e89b-12d3-a456-426614174000
Schema
    task objectrequired
    task_idstring<uuid>required
    stateTaskInfoState (string)required

    Possible values: [pending, running, rejected, failed, done]

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://docs.cloud.phonexia.com/api/technology/speech-translation-whisper-enhanced");
request.Headers.Add("Accept", "application/json");
var content = new StringContent(string.Empty);
content.Headers.ContentType = new MediaTypeHeaderValue("multipart/form-data");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());