Thanks @mint tundra
I am getting about 2-2.5 seconds for getting audio from elevenlabs for a text like this:
"Hi there! I'm excited to explore your character and social strengths together. May I ask, do you think of yourself as honest?"
here is what i am doing:
if (!voiceMode) {
return;
}
let start = Date.now();
if (text) {
try {
const audioStream = await Elevenclient.generate({
voice: 'Rachel',
model_id: 'eleven_turbo_v2_5',
text,
});
const chunks = [];
for await (const chunk of audioStream) {
chunks.push(chunk);
}
const content = Buffer.concat(chunks);
ws.send(content);
} catch (error) {
console.error('Error generating or sending audio stream:', error);
} finally {
console.log('Time taken to generate and send TTS in milliseconds:', Date.now() - start);
}
}
}```
is it normal?
Also I checked elevenlabs docs and they say that to minimise latency, we should be streaming api (https://elevenlabs.io/docs/api-reference/streaming). Can you point to certain examples as to how do we stream from a nodejs proxy to a front end? (I checked the javascript code given on this page. but not sure how do we send this stream to a front end)