Translate Audio
Lara's Translate Audio feature enables you to automate the localisation of audio content through a direct audio-to-audio workflow. The system analyses the source track and generates a new translated version.
Thanks to native integration with Lara's computer-assisted translation ecosystem, the end result is not a simple, literal translation, but an output optimised for your specific linguistic domain and communication style.
Key Features:
- Adaptation to Context (Translation Memories & Glossaries): Through the ability to use translation memories and glossaries, the API ensures that technical terms, product names, and preferred terminology are translated consistently throughout the audio, in line with the linguistic resources available in your account.
- Control over Translation Style: Lara lets you shape the translated audio through the
styleparameter. Choose Faithful for a precise translation that preserves the original structure and meaning, Fluid for a smoother and more natural result, or Creative for a more expressive adaptation suited to marketing, literary, or highly engaging content. - Voice Gender Selection: Through the
voiceGenderparameter, the system allows you to specify the vocal characteristics of the output. You can choose between male or female voices to ensure the translated audio perfectly aligns with your brand identity or the nature of the original speaker. - Automatic Language Detection: The system can independently identify the language spoken in the source audio file, simplifying integration into platforms that manage content from international users.
- Extensive Multilingual Support: The API supports a wide range of language codes (from the most common ones, such as en-US and it-IT, to less widely used languages), enabling immediate global scalability of your audio assets.
Translate
To begin, you must first instantiate the Translator class. This is the mandatory first step for all operations within the Lara SDK.
All audio translation functionalities can be accessed via the same Translator (lara in the example) object of the above example, through the AudioTranslator class.
Audio translation is an asynchronous process consisting of three phases.
- Upload the audio file
- Wait for Lara to finish the process, polling the status at regular intervals until it changes to
translated - Download the file
Once uploaded with the upload method, Lara will return a Audio object; the id of this object can be used both to check the status with the status method, both to download the translated file with the download method once its status became translated.
Audio object
| Field | Type | Description |
|---|---|---|
| id | String | Unique ID of the document. Format: doc_xyz123 |
| status | String | The current status of the translation. |
| source | String | The source language of the document. |
| target | String | The target language of the translation. |
| voiceGender | String | Gender of the voice in the translation, available values: male, female |
| filename | String | Filename of the source file. |
| createdAt | DateTime | When the document is created. |
| updatedAt | DateTime | When the document is last updated (equal to created_at with no updates). |
| options | AudioOptions | Options related to the document translation. |
| translatedSeconds | Integer | The number of translated seconds. |
| totalSeconds | Integer | The number of seconds in the document. |
| errorReason | String | The reason of the error, if any. |
Translate method
The SDK contains a translate method that simplifies the process of translating audio file by uploading the file, checking the status at regular intervals, and returning the result of the download function.
Request
sample_audio_file = "sample_audio.mp3"
translated_audio = lara.audio.translate(
file_path=sample_audio_file,
filename=os.path.basename(sample_audio_file),
source="en-US",
voice_gender = "female",
target="it-IT",
adapt_to=["mem_1234..."],
glossaries=["gls_1234..."]
)
const options: AudioTranslateOptions = {
adaptTo: ['mem_1_id', 'mem_2_id'],
glossaries: ['gls_1_id', 'gls_2_id'],
voiceGender : 'male',
style: 'fluid'
};
// Translate an audio file
const translation = await lara.audio.translate(file, 'test.wav', 'en', 'it', options);File audioFile = new File("voice.mp3");
AudioUploadOptions options = new AudioUploadOptions();
options.setAdaptTo("mem_1234...");
options.setGlossaries("gls_1234...");
options.setVoiceGender = "female";
InputStream translated = lara.audio.translate(audioFile, "en-US", "it-IT", options);
$translateOptions = new AudioTranslateOptions([
"adaptTo" => ["mem_1_id", "mem_2_id"],
"glossaries" => ["gls_1_id", "gls_2_id"],
"voiceGender" => "male",
"style" => "fluid"
]);
// Translate an audio file
$translation = $lara->audio->translate($file_path, "en", "it", $translateOptions);// Sdk available soon
val audioFile = File("voice.mp3")
val options = AudioUploadOptions().apply {
adaptTo = "mem_1234..."
glossaries = "gls_1234..."
voiceGender = "female"
}
val translated: InputStream = lara.audio.translate(audioFile, "en-US", "it-IT", options)var options = new AudioTranslateOptions {
AdaptTo = new[] { "mem_1_id", "mem_2_id" },
Glossaries = new[] { "gls_1_id", "gls_2_id" },
Style = TranslationStyle.Fluid
};
// Translate an audio file
var translation = await lara.Audio.Translate("path/to/file", "en", "it", options);let sampleFilePath = "sample_audio.mp3" // Create this file with your content
let sourceLang = "en-US"
let targetLang = "de-DE"
let gender = "female"
print("Translating audio: \(FileManager.default.displayName(atPath: sampleFilePath)) from \(sourceLang) to \(targetLang)")
let audioData = try Data(contentsOf: URL(fileURLWithPath: sampleFilePath))
let translatedData = try await lara.audio.translate(
data: audioData,
voiceGender = gender,
filename: FileManager.default.displayName(atPath: sampleFilePath),
source: sourceLang,
target: targetLang
)
// Save translated audio - replace with your desired output path
let outputPath = "sample_audio_translated.mp3"
try translatedData.write(to: URL(fileURLWithPath: outputPath))Here follows the basic fields for the translate method:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| file / filePath | File / String | Yes | The input file/the path to input file to translate. | |
| filename | String | Yes* | Only the Typescript/Javascript SDK requires the filename as parameter. | |
| source | String | No | Autodetected | The source language code (e.g., "en-EN" for English). If not specified, the system will attempt to detect it automatically. |
| target | String | Yes | The target language code (e.g., "it-IT" for Italian). This specifies the language you want the audio translated into. | |
| options | AudioTranslateOptions | No | See the table below for details. |
Some options are available to customize the behavior of the translate method:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| adaptTo | String[] | No | Default is all Memories on your account | A list of translation memory IDs for adapting the translation. |
| glossaries | String[] | No | A list of glossary IDs. | |
| noTrace | Boolean | No | False | If set to True, source content and its translation will not be saved on our system. (AKA Incognito mode) |
| style | String | No | faithful | The style to apply to the translation. Available values:faithfulfluidcreative |
The following sections provide a detailed breakdown of the phases and methods utilized by the translate method.
Upload an audio file
The upload method will take care of uploading the source file to Lara and starting the translation process.
Request
sample_audio_file = "sample_audio.mp3"
audio = lara.audio.upload(
file_path=sample_audio_file,
filename=os.path.basename(sample_audio_file),
source="en-US",
target="it-IT",
adapt_to=["mem_1234..."]
glossaries=["gls_1234..."]
)
const options: AudioUploadOptions = {
adaptTo: ['mem_1_id', 'mem_2_id'],
glossaries: ['gls_1_id', 'gls_2_id'],
style: 'fluid',
};
// Upload an audio file and start the translation process
const audio: Audio = await lara.audio.upload(file, 'test.wav', 'en', 'it', options);File audioFile = new File("voice.mp3");
AudioUploadOptions options = new AudioUploadOptions();
options.setAdaptTo("mem_1234...");
options.setGlossaries("gls_1234...");
Audio audio = lara.audio.upload(audioFile, "en-US", "it-IT", options);
$translateOptions = new AudioUploadOptions([
"adaptTo" => ["mem_1_id", "mem_2_id"],
"glossaries" => ["gls_1_id", "gls_2_id"],
"style" => "fluid"
]);
// Upload a audio and start the translation process
$audio = $lara->audio->upload($file_path, "en", "it", $translateOptions);// Sdk available soon
val audioFile = File("voice.mp3")
val options = AudioUploadOptions().apply {
adaptTo = "mem_1234..."
glossaries = "gls_1234..."
}
val audio: Audio = lara.audio.upload(audioFile, "en-US", "it-IT", options)var options = new AudioUploadOptions {
AdaptTo = new[] { "mem_1_id", "mem_2_id" },
Glossaries = new[] { "gls_1_id", "gls_2_id" },
Style = TranslationStyle.Fluid
};
var audio = await lara.Audio.Upload("path/to/file", "en", "it", options); let sampleFilePath = "sample_audio.mp3" // Create this file with your content
let sourceLang = "en-US"
let targetLang = "de-DE"
let audioData = try Data(contentsOf: URL(fileURLWithPath: sampleFilePath))
let audio = try await lara.audio.upload(
data: audioData,
filename: FileManager.default.displayName(atPath: sampleFilePath),
source: sourceLang,
target: targetLang,
options: AudioUploadOptions(
adaptTo: ["mem_1A2b3C4d5E6f7G8h9I0jKl"], // Replace with actual memory IDs
glossaries: ["gls_1A2b3C4d5E6f7G8h9I0jKl"] // Replace with actual glossary IDs
)
)
// Check status with polling
var updatedAudio = try await lara.audio.status(id: audio.id)
while updatedAudio.status != .translated {
updatedAudio = try await lara.audio.status(id: audio.id)
if updatedAudio.status == .error {
throw NSError(domain: "AudioTranslationError",
code: 500,
userInfo: [NSLocalizedDescriptionKey: updatedAudio.errorReason ?? "Translation failed"])
}
try await Task.sleep(nanoseconds: 2_000_000_000) // 2 seconds
}
// Download translated audio
let translatedData = try await lara.audio.download(id: audio.id)
// Save translated audio - replace with your desired output path
let outputPath = "step_audio_translated.mp3"
try translatedData.write(to: URL(fileURLWithPath: outputPath))
Here follows the basic fields for the upload method:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| file | File | Yes | The input file to translate. | |
| filename | String | Yes* | The Typescript/Javascript and Python SDKs require the filename as a parameter. | |
| source | String | No | Autodetected | The source language code (e.g., "en-EN" for English). If not specified, the system will attempt to detect it automatically. |
| target | String | Yes | The target language code (e.g., "it-IT" for Italian). This specifies the language you want the audio translated into. | |
| options | AudioUploadOptions | No | See the table below for details. |
There are some options available to customize the behavior of the upload method:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| adaptTo | String[] | No | Default is all Memories on your account | A list of translation memory IDs for adapting the translation. |
| glossaries | String[] | No | A list of glossary IDs. | |
| noTrace | Boolean | No | False | If set to True, source content and its translation will not be saved on our system. |
| style | String | No | faithful | The style to apply to the translation. Available values:faithfulfluidcreative |
The result of the upload method is a Audio object that is needed to check the translation status and download the translated audio file.
Response
# audio
audio = Audio(
status="initialized",
id="doc_3TJ2ObqnrYTC2k5vSfLlqz",
filename="voice.mp3",
updatedAt="2025-05-29T18:00:24.779000+00:00",
createdAt="2025-05-29T18:00:24.779000+00:00",
source="en",
target="it"
)
// audio
{
status: 'initialized',
id: 'doc_3TJ2ObqnrYTC2k5vSfLlqz',
filename: 'test.wav',
updatedAt: 2025-05-15T09:28:14.626Z,
createdAt: 2025-05-15T09:28:14.626Z,
source: 'en',
target: 'it'
}// audio
Audio(
status="initialized",
id="doc_3TJ2ObqnrYTC2k5vSfLlqz",
filename="voice.mp3",
updatedAt=2025-05-15T09:28:14.626Z,
createdAt=2025-05-15T09:28:14.626Z,
source="en",
target="it"
)
// audio
$audio = [
"status" => "initialized",
"id" => "doc_3TJ2ObqnrYTC2k5vSfLlqz",
"filename" => "test.wav",
"updated_at" => "2025-05-29T18:00:24.779000+00:00",
"created_at" => "2025-05-29T18:00:24.779000+00:00",
"source" => "en",
"target" => "it"
];// Sdk available soon
val audio = Audio(
status = "initialized",
id = "doc_3TJ2ObqnrYTC2k5vSfLlqz",
filename = "voice.mp3",
updatedAt = ZonedDateTime.parse("2025-05-15T09:28:14.626Z"),
createdAt = ZonedDateTime.parse("2025-05-15T09:28:14.626Z"),
source = "en",
target = "it"
)// audio
var audio = new Audio(
id: "doc_3TJ2ObqnrYTC2k5vSfLlqz",
status: AudioStatus.Initialized,
filename: "test.wav",
target: "it",
createdAt: "2025-05-15T09:28:14.626Z",
updatedAt: "2025-05-15T09:28:14.626Z",
source: "en"
);// document
let document = Document(
id: "doc_3TJ2ObqnrYTC2k5vSfLlqz",
status: .initialized,
source: "en",
target: "it",
filename: "test.mp3",
createdAt: "2025-05-15T09:28:14.626Z",
updatedAt: "2025-05-15T09:28:14.626Z"
)
Check status
After the upload is finished, it is possible to check the status of the translation at regular intervals. This can be done with the status method:
Request
// Check the status of the audio translation
audio = lara.audio.status(audio.id)// check the status of the audio file
audio = await lara.audio.status(audio.id);// Check the status of the audio translation
audio = lara.audio.status(audio.getId());
// check the status of the audio file
$audio = $lara->audio->status($audio->getId());// Sdk available soon
// Check the status of the audio translation
audio = lara.audio.status(audio.id)// Check the status of the audio file
var audio = await lara.Audio.Status(audio.Id);// Check the status of the audio file
$updatedAudio = $lara->audio->status($audio->getId());
echo "Current status: " . $updatedAudio->getStatus() . "\n";The method takes as unique parameter the id of the Audio object obtained with the upload method.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| id | String | Yes | The audio file id obtained with the upload method. |
Response
# audio
audio = Audio(
status="initialized",
id="doc_3TJ2ObqnrYTC2k5vSfLlqz",
filename="vioce.mp3",
updatedAt="2025-05-29T18:00:24.779000+00:00",
createdAt="2025-05-29T18:00:24.779000+00:00",
source="en",
target="it"
)// document
{
status: 'translated',
id: 'doc_3TJ2ObqnrYTC2k5vSfLlqz',
filename: 'test.mp3',
updatedAt: 2025-05-15T09:28:22.347Z,
createdAt: 2025-05-15T09:28:14.626Z,
source: 'en',
target: 'it'
}// audio
Audio(
status="initialized",
id="doc_3TJ2ObqnrYTC2k5vSfLlqz",
filename="voice.mp3",
updatedAt=2025-05-15T09:28:14.626Z,
createdAt=2025-05-15T09:28:14.626Z,
source="en",
target="it"
)
// audio
$audio = [
"status" => "translated",
"id" => "doc_3TJ2ObqnrYTC2k5vSfLlqz",
"filename" => "test.mp3",
"updated_at" => "2025-05-29T18:00:32.519000+00:00",
"created_at" => "2025-05-15T09:28:14.626",
"source" => "en",
"target" => "it"
];// Sdk available soon
// Sdk available soon
val audio = Audio(
status = "initialized",
id = "doc_3TJ2ObqnrYTC2k5vSfLlqz",
filename = "voice.mp3",
updatedAt = ZonedDateTime.parse("2025-05-15T09:28:14.626Z"),
createdAt = ZonedDateTime.parse("2025-05-15T09:28:14.626Z"),
source = "en",
target = "it"
)// audio
var audio = new audio(
id: "doc_3TJ2ObqnrYTC2k5vSfLlqz",
status: DocumentStatus.Translated,
filename: "test.mp3",
target: "it",
createdAt: "2025-05-15T09:28:14.626Z",
updatedAt: "2025-05-15T09:28:22.347Z",
source: "en"
);// document
let audio = audio(
id: "doc_3TJ2ObqnrYTC2k5vSfLlqz",
status: .initialized,
source: "en",
target: "it",
filename: "test.mp3",
createdAt: "2025-05-15T09:28:14.626Z",
updatedAt: "2025-05-15T09:28:14.626Z"
)Download the translation
After updating the audio file status with the status method and setting it to translated, you can download the translated audio file with the download method.
Request
// Download the translation
translated_audio = lara.audio.download(audio.id)// Download the translation
const translation = await lara.audio.download(audio.id);// Download the translation
InputStream downloaded = lara.audio.download(audio.getId())// Download the translation
$translation = $lara->audio->download($audio->getId());// Sdk available soon
// Download the translation
val downloaded: InputStream = lara.audio.download(audio.id)// Download the translation
var translation = await lara.Audio.Download(audio.Id);// Download the translation
let translation = try await lara.audio.download(id: document.id)Here follows the basic fields for the download method:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| id | String | Yes | The id of the document obtained with the upload method. |
Supported Languages
Billing
More details are available in the pricing page
Updated about 1 month ago
