Texto a voz de Fish Audio S2 Pro
curl --request POST \
--url https://api.highwayapi.ai/v3/fish-audio-s2-pro-text-to-speech \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"text": "<string>",
"top_p": 123,
"format": "<string>",
"latency": "<string>",
"prosody": {
"speed": 123,
"volume": 123,
"normalize_loudness": true
},
"normalize": true,
"references": [
{
"text": "<string>",
"audio": "<string>"
}
],
"mp3_bitrate": 123,
"sample_rate": 123,
"temperature": 123,
"chunk_length": 123,
"opus_bitrate": 123,
"reference_id": "<string>",
"max_new_tokens": 123,
"min_chunk_length": 123,
"repetition_penalty": 123,
"early_stop_threshold": 123,
"condition_on_previous_chunks": true
}
'import requests
url = "https://api.highwayapi.ai/v3/fish-audio-s2-pro-text-to-speech"
payload = {
"text": "<string>",
"top_p": 123,
"format": "<string>",
"latency": "<string>",
"prosody": {
"speed": 123,
"volume": 123,
"normalize_loudness": True
},
"normalize": True,
"references": [
{
"text": "<string>",
"audio": "<string>"
}
],
"mp3_bitrate": 123,
"sample_rate": 123,
"temperature": 123,
"chunk_length": 123,
"opus_bitrate": 123,
"reference_id": "<string>",
"max_new_tokens": 123,
"min_chunk_length": 123,
"repetition_penalty": 123,
"early_stop_threshold": 123,
"condition_on_previous_chunks": True
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
text: '<string>',
top_p: 123,
format: '<string>',
latency: '<string>',
prosody: {speed: 123, volume: 123, normalize_loudness: true},
normalize: true,
references: [{text: '<string>', audio: '<string>'}],
mp3_bitrate: 123,
sample_rate: 123,
temperature: 123,
chunk_length: 123,
opus_bitrate: 123,
reference_id: '<string>',
max_new_tokens: 123,
min_chunk_length: 123,
repetition_penalty: 123,
early_stop_threshold: 123,
condition_on_previous_chunks: true
})
};
fetch('https://api.highwayapi.ai/v3/fish-audio-s2-pro-text-to-speech', 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.highwayapi.ai/v3/fish-audio-s2-pro-text-to-speech",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'text' => '<string>',
'top_p' => 123,
'format' => '<string>',
'latency' => '<string>',
'prosody' => [
'speed' => 123,
'volume' => 123,
'normalize_loudness' => true
],
'normalize' => true,
'references' => [
[
'text' => '<string>',
'audio' => '<string>'
]
],
'mp3_bitrate' => 123,
'sample_rate' => 123,
'temperature' => 123,
'chunk_length' => 123,
'opus_bitrate' => 123,
'reference_id' => '<string>',
'max_new_tokens' => 123,
'min_chunk_length' => 123,
'repetition_penalty' => 123,
'early_stop_threshold' => 123,
'condition_on_previous_chunks' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$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.highwayapi.ai/v3/fish-audio-s2-pro-text-to-speech"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"top_p\": 123,\n \"format\": \"<string>\",\n \"latency\": \"<string>\",\n \"prosody\": {\n \"speed\": 123,\n \"volume\": 123,\n \"normalize_loudness\": true\n },\n \"normalize\": true,\n \"references\": [\n {\n \"text\": \"<string>\",\n \"audio\": \"<string>\"\n }\n ],\n \"mp3_bitrate\": 123,\n \"sample_rate\": 123,\n \"temperature\": 123,\n \"chunk_length\": 123,\n \"opus_bitrate\": 123,\n \"reference_id\": \"<string>\",\n \"max_new_tokens\": 123,\n \"min_chunk_length\": 123,\n \"repetition_penalty\": 123,\n \"early_stop_threshold\": 123,\n \"condition_on_previous_chunks\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.highwayapi.ai/v3/fish-audio-s2-pro-text-to-speech")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"text\": \"<string>\",\n \"top_p\": 123,\n \"format\": \"<string>\",\n \"latency\": \"<string>\",\n \"prosody\": {\n \"speed\": 123,\n \"volume\": 123,\n \"normalize_loudness\": true\n },\n \"normalize\": true,\n \"references\": [\n {\n \"text\": \"<string>\",\n \"audio\": \"<string>\"\n }\n ],\n \"mp3_bitrate\": 123,\n \"sample_rate\": 123,\n \"temperature\": 123,\n \"chunk_length\": 123,\n \"opus_bitrate\": 123,\n \"reference_id\": \"<string>\",\n \"max_new_tokens\": 123,\n \"min_chunk_length\": 123,\n \"repetition_penalty\": 123,\n \"early_stop_threshold\": 123,\n \"condition_on_previous_chunks\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.highwayapi.ai/v3/fish-audio-s2-pro-text-to-speech")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"text\": \"<string>\",\n \"top_p\": 123,\n \"format\": \"<string>\",\n \"latency\": \"<string>\",\n \"prosody\": {\n \"speed\": 123,\n \"volume\": 123,\n \"normalize_loudness\": true\n },\n \"normalize\": true,\n \"references\": [\n {\n \"text\": \"<string>\",\n \"audio\": \"<string>\"\n }\n ],\n \"mp3_bitrate\": 123,\n \"sample_rate\": 123,\n \"temperature\": 123,\n \"chunk_length\": 123,\n \"opus_bitrate\": 123,\n \"reference_id\": \"<string>\",\n \"max_new_tokens\": 123,\n \"min_chunk_length\": 123,\n \"repetition_penalty\": 123,\n \"early_stop_threshold\": 123,\n \"condition_on_previous_chunks\": true\n}"
response = http.request(request)
puts response.read_bodyAudio
Texto a voz de Fish Audio S2 Pro
POST
/
v3
/
fish-audio-s2-pro-text-to-speech
Texto a voz de Fish Audio S2 Pro
curl --request POST \
--url https://api.highwayapi.ai/v3/fish-audio-s2-pro-text-to-speech \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"text": "<string>",
"top_p": 123,
"format": "<string>",
"latency": "<string>",
"prosody": {
"speed": 123,
"volume": 123,
"normalize_loudness": true
},
"normalize": true,
"references": [
{
"text": "<string>",
"audio": "<string>"
}
],
"mp3_bitrate": 123,
"sample_rate": 123,
"temperature": 123,
"chunk_length": 123,
"opus_bitrate": 123,
"reference_id": "<string>",
"max_new_tokens": 123,
"min_chunk_length": 123,
"repetition_penalty": 123,
"early_stop_threshold": 123,
"condition_on_previous_chunks": true
}
'import requests
url = "https://api.highwayapi.ai/v3/fish-audio-s2-pro-text-to-speech"
payload = {
"text": "<string>",
"top_p": 123,
"format": "<string>",
"latency": "<string>",
"prosody": {
"speed": 123,
"volume": 123,
"normalize_loudness": True
},
"normalize": True,
"references": [
{
"text": "<string>",
"audio": "<string>"
}
],
"mp3_bitrate": 123,
"sample_rate": 123,
"temperature": 123,
"chunk_length": 123,
"opus_bitrate": 123,
"reference_id": "<string>",
"max_new_tokens": 123,
"min_chunk_length": 123,
"repetition_penalty": 123,
"early_stop_threshold": 123,
"condition_on_previous_chunks": True
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
text: '<string>',
top_p: 123,
format: '<string>',
latency: '<string>',
prosody: {speed: 123, volume: 123, normalize_loudness: true},
normalize: true,
references: [{text: '<string>', audio: '<string>'}],
mp3_bitrate: 123,
sample_rate: 123,
temperature: 123,
chunk_length: 123,
opus_bitrate: 123,
reference_id: '<string>',
max_new_tokens: 123,
min_chunk_length: 123,
repetition_penalty: 123,
early_stop_threshold: 123,
condition_on_previous_chunks: true
})
};
fetch('https://api.highwayapi.ai/v3/fish-audio-s2-pro-text-to-speech', 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.highwayapi.ai/v3/fish-audio-s2-pro-text-to-speech",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'text' => '<string>',
'top_p' => 123,
'format' => '<string>',
'latency' => '<string>',
'prosody' => [
'speed' => 123,
'volume' => 123,
'normalize_loudness' => true
],
'normalize' => true,
'references' => [
[
'text' => '<string>',
'audio' => '<string>'
]
],
'mp3_bitrate' => 123,
'sample_rate' => 123,
'temperature' => 123,
'chunk_length' => 123,
'opus_bitrate' => 123,
'reference_id' => '<string>',
'max_new_tokens' => 123,
'min_chunk_length' => 123,
'repetition_penalty' => 123,
'early_stop_threshold' => 123,
'condition_on_previous_chunks' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$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.highwayapi.ai/v3/fish-audio-s2-pro-text-to-speech"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"top_p\": 123,\n \"format\": \"<string>\",\n \"latency\": \"<string>\",\n \"prosody\": {\n \"speed\": 123,\n \"volume\": 123,\n \"normalize_loudness\": true\n },\n \"normalize\": true,\n \"references\": [\n {\n \"text\": \"<string>\",\n \"audio\": \"<string>\"\n }\n ],\n \"mp3_bitrate\": 123,\n \"sample_rate\": 123,\n \"temperature\": 123,\n \"chunk_length\": 123,\n \"opus_bitrate\": 123,\n \"reference_id\": \"<string>\",\n \"max_new_tokens\": 123,\n \"min_chunk_length\": 123,\n \"repetition_penalty\": 123,\n \"early_stop_threshold\": 123,\n \"condition_on_previous_chunks\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.highwayapi.ai/v3/fish-audio-s2-pro-text-to-speech")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"text\": \"<string>\",\n \"top_p\": 123,\n \"format\": \"<string>\",\n \"latency\": \"<string>\",\n \"prosody\": {\n \"speed\": 123,\n \"volume\": 123,\n \"normalize_loudness\": true\n },\n \"normalize\": true,\n \"references\": [\n {\n \"text\": \"<string>\",\n \"audio\": \"<string>\"\n }\n ],\n \"mp3_bitrate\": 123,\n \"sample_rate\": 123,\n \"temperature\": 123,\n \"chunk_length\": 123,\n \"opus_bitrate\": 123,\n \"reference_id\": \"<string>\",\n \"max_new_tokens\": 123,\n \"min_chunk_length\": 123,\n \"repetition_penalty\": 123,\n \"early_stop_threshold\": 123,\n \"condition_on_previous_chunks\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.highwayapi.ai/v3/fish-audio-s2-pro-text-to-speech")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"text\": \"<string>\",\n \"top_p\": 123,\n \"format\": \"<string>\",\n \"latency\": \"<string>\",\n \"prosody\": {\n \"speed\": 123,\n \"volume\": 123,\n \"normalize_loudness\": true\n },\n \"normalize\": true,\n \"references\": [\n {\n \"text\": \"<string>\",\n \"audio\": \"<string>\"\n }\n ],\n \"mp3_bitrate\": 123,\n \"sample_rate\": 123,\n \"temperature\": 123,\n \"chunk_length\": 123,\n \"opus_bitrate\": 123,\n \"reference_id\": \"<string>\",\n \"max_new_tokens\": 123,\n \"min_chunk_length\": 123,\n \"repetition_penalty\": 123,\n \"early_stop_threshold\": 123,\n \"condition_on_previous_chunks\": true\n}"
response = http.request(request)
puts response.read_bodyEl modelo de texto a voz Fish Audio S2 Pro convierte texto en voz natural y admite timbres de referencia, control de muestreo, segmentación, formatos de audio y control de prosodia.
Encabezados de solicitud
string
requerido
Valores enumerados:
application/jsonstring
requerido
Formato de autenticación Bearer: Bearer {{API Key}}.
Cuerpo de la solicitud
string
requerido
Texto que debe convertirse en voz. El texto multihablante de S2-Pro puede usar las etiquetas <|speaker:0|>Hola<|speaker:1|>Hola.
number
Control de diversidad de muestreo por núcleo.Rango de valores: [0, 1]
string
predeterminado:"mp3"
Formato de audio de salida.Valores opcionales:
wav, pcm, mp3, opusstring
predeterminado:"normal"
Nivel de latencia.Valores opcionales:
low, normal, balancedobject
boolean
predeterminado:true
Normaliza texto en chino e inglés.
object[]
integer
predeterminado:128
Tasa de bits de MP3, en kbps.Valores opcionales:
64, 128, 192integer
Frecuencia de muestreo de salida en Hz. Si está vacío, se usa el valor predeterminado del formato; opus es 48000 Hz y los demás suelen ser 44100 Hz.
number
Control de expresividad.Rango de valores: [0, 1]
integer
predeterminado:300
Tamaño de segmentación del texto.Rango de valores: [100, 300]
integer
Tasa de bits de Opus, en bps; -1000 indica automático.Valores opcionales:
-1000, 24000, 32000, 48000, 64000string
ID del modelo de timbre; en escenarios multihablante se puede pasar un arreglo que coincida con los índices de speaker.
integer
predeterminado:1024
Número máximo de tokens de audio por cada segmento.
integer
predeterminado:50
Número mínimo de caracteres antes de segmentar.Rango de valores: [0, 100]
number
Coeficiente de penalización para reducir la repetición de patrones de audio.
number
predeterminado:1
Umbral de detención anticipada.Rango de valores: [0, 1]
boolean
predeterminado:true
Usa segmentos de audio anteriores como contexto.
Información de respuesta
Audio generado. Formato:binary⌘I