Change the speed of a segment
curl --request PUT \
--url https://api.studio.us.phrase.com/v1/projects/{projectId}/recordings/{recordingId}/segment-audio-speed \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"language": "es-es",
"segmentId": "6f1d2c3e-8b4a-4c5d-9e7f-123456789abc",
"ttsDuration": 4.5,
"originalTtsDuration": 5
}
'import requests
url = "https://api.studio.us.phrase.com/v1/projects/{projectId}/recordings/{recordingId}/segment-audio-speed"
payload = {
"language": "es-es",
"segmentId": "6f1d2c3e-8b4a-4c5d-9e7f-123456789abc",
"ttsDuration": 4.5,
"originalTtsDuration": 5
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
language: 'es-es',
segmentId: '6f1d2c3e-8b4a-4c5d-9e7f-123456789abc',
ttsDuration: 4.5,
originalTtsDuration: 5
})
};
fetch('https://api.studio.us.phrase.com/v1/projects/{projectId}/recordings/{recordingId}/segment-audio-speed', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.studio.us.phrase.com/v1/projects/{projectId}/recordings/{recordingId}/segment-audio-speed",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'language' => 'es-es',
'segmentId' => '6f1d2c3e-8b4a-4c5d-9e7f-123456789abc',
'ttsDuration' => 4.5,
'originalTtsDuration' => 5
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.studio.us.phrase.com/v1/projects/{projectId}/recordings/{recordingId}/segment-audio-speed"
payload := strings.NewReader("{\n \"language\": \"es-es\",\n \"segmentId\": \"6f1d2c3e-8b4a-4c5d-9e7f-123456789abc\",\n \"ttsDuration\": 4.5,\n \"originalTtsDuration\": 5\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.studio.us.phrase.com/v1/projects/{projectId}/recordings/{recordingId}/segment-audio-speed")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"language\": \"es-es\",\n \"segmentId\": \"6f1d2c3e-8b4a-4c5d-9e7f-123456789abc\",\n \"ttsDuration\": 4.5,\n \"originalTtsDuration\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.studio.us.phrase.com/v1/projects/{projectId}/recordings/{recordingId}/segment-audio-speed")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"language\": \"es-es\",\n \"segmentId\": \"6f1d2c3e-8b4a-4c5d-9e7f-123456789abc\",\n \"ttsDuration\": 4.5,\n \"originalTtsDuration\": 5\n}"
response = http.request(request)
puts response.read_body{
"segmentId": "6f1d2c3e-8b4a-4c5d-9e7f-123456789abc",
"url": "https://storage.googleapis.com/bucket/seg.mp3?X-Goog-Signature=..."
}Dubbing audio
Change the speed of a segment
Set a new duration for the dubbed audio of one segment, which speeds it up or slows it down. To go back, send reset: true with originalTtsDuration as ttsDuration. Needs write access to the dubbing step of the language. The language must already have generated dubbing audio; otherwise the call is refused with 400 (Not available for this project). Returns the segment with a link to its new audio.
PUT
/
v1
/
projects
/
{projectId}
/
recordings
/
{recordingId}
/
segment-audio-speed
Change the speed of a segment
curl --request PUT \
--url https://api.studio.us.phrase.com/v1/projects/{projectId}/recordings/{recordingId}/segment-audio-speed \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"language": "es-es",
"segmentId": "6f1d2c3e-8b4a-4c5d-9e7f-123456789abc",
"ttsDuration": 4.5,
"originalTtsDuration": 5
}
'import requests
url = "https://api.studio.us.phrase.com/v1/projects/{projectId}/recordings/{recordingId}/segment-audio-speed"
payload = {
"language": "es-es",
"segmentId": "6f1d2c3e-8b4a-4c5d-9e7f-123456789abc",
"ttsDuration": 4.5,
"originalTtsDuration": 5
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
language: 'es-es',
segmentId: '6f1d2c3e-8b4a-4c5d-9e7f-123456789abc',
ttsDuration: 4.5,
originalTtsDuration: 5
})
};
fetch('https://api.studio.us.phrase.com/v1/projects/{projectId}/recordings/{recordingId}/segment-audio-speed', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.studio.us.phrase.com/v1/projects/{projectId}/recordings/{recordingId}/segment-audio-speed",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'language' => 'es-es',
'segmentId' => '6f1d2c3e-8b4a-4c5d-9e7f-123456789abc',
'ttsDuration' => 4.5,
'originalTtsDuration' => 5
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.studio.us.phrase.com/v1/projects/{projectId}/recordings/{recordingId}/segment-audio-speed"
payload := strings.NewReader("{\n \"language\": \"es-es\",\n \"segmentId\": \"6f1d2c3e-8b4a-4c5d-9e7f-123456789abc\",\n \"ttsDuration\": 4.5,\n \"originalTtsDuration\": 5\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.studio.us.phrase.com/v1/projects/{projectId}/recordings/{recordingId}/segment-audio-speed")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"language\": \"es-es\",\n \"segmentId\": \"6f1d2c3e-8b4a-4c5d-9e7f-123456789abc\",\n \"ttsDuration\": 4.5,\n \"originalTtsDuration\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.studio.us.phrase.com/v1/projects/{projectId}/recordings/{recordingId}/segment-audio-speed")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"language\": \"es-es\",\n \"segmentId\": \"6f1d2c3e-8b4a-4c5d-9e7f-123456789abc\",\n \"ttsDuration\": 4.5,\n \"originalTtsDuration\": 5\n}"
response = http.request(request)
puts response.read_body{
"segmentId": "6f1d2c3e-8b4a-4c5d-9e7f-123456789abc",
"url": "https://storage.googleapis.com/bucket/seg.mp3?X-Goog-Signature=..."
}Authorizations
apiKeyAuthbearerAuth
Body
application/json
A new duration for the dubbed audio of one segment.
Was this page helpful?