I want to make the AI voice speak louder and faster. Is it possible? I know I can mess with the audio that I get from the api but that adds more latency to do it in realtime.
1 Like
You can update the speed, but not the volume. The volume can be modified using something as follows …
const source = this.audioContext.createBufferSource();
const gainNode = this.audioContext.createGain();
const arrayBuffer = await audioBlob.arrayBuffer();
const audioBuffer = await this.audioContext.decodeAudioData(arrayBuffer);
source.buffer = audioBuffer;
gainNode.gain.value = 2.0; // Increase volume by 2x
source.connect(gainNode);
gainNode.connect(this.audioContext.destination);
source.addEventListener('ended', () => {
this.isSpeaking = false;
this.isWaitingForTTS = false;
});
The code is not complete, but I suspect you will understand the primary parts of it. Interestingly, that code was (mostly) generated by O1 …
ahh I was wondering if there was a way to do so through the LLM. I’m trying to avoid adding more latency to a realtime system
The code you’ve put only solves the volumen issue, but how can i set the speech speed? I’m looking for some commands to send to OpenAI based on some slider, but can’t find anything…