Hello guys.
We noticed that output format mulat/8000 takes ~3 times longer in comparasing with pcm_f32le/44100 for example
Here is a timings when we measure how long the request itself takes:
tts pcm_f32le: 412.313ms
tts pcm_mulaw: 1.742s
Everything, absolutely the same, the only difference in the output format.
Is that an issue or this is by design because of this format?
Here is quick code example:
const mainOptions = {
method: 'POST',
headers: {
'Cartesia-Version': '2024-06-10',
'X-API-Key': SECRET_KEY',
'Content-Type': 'application/json'
},
};
const body = {
transcript: 'Welcome to our company, how can I help you today?',
model_id: 'sonic-english',
// https://docs.cartesia.ai/api-reference/endpoints/list-voices#list-voices
voice: {
mode: 'id',
id: 'b7d50908-b17c-442d-ad8d-810c63997ed9',
},
}
const options = {
...mainOptions,
body: JSON.stringify({
...body,
output_format: {
container: 'raw',
encoding: 'pcm_f32le',
sample_rate: 44100,
},
})
};
console.time('tts pcm_f32le');
const resPcmf32le = await fetch('https://api.cartesia.ai/tts/bytes', options)
console.timeEnd('tts pcm_f32le');
const optionsMulaw = {
...mainOptions,
body: JSON.stringify({
...body,
output_format: {
container: 'raw',
encoding: 'pcm_mulaw',
sample_rate: 8000,
},
})
};
console.time('tts pcm_mulaw');
const resMulaw = await fetch('https://api.cartesia.ai/tts/bytes', optionsMulaw)
console.timeEnd('tts pcm_mulaw');
Thanks.