diff --git a/firmware-arduino/src/Audio.cpp b/firmware-arduino/src/Audio.cpp index 22bf523..9d22744 100644 --- a/firmware-arduino/src/Audio.cpp +++ b/firmware-arduino/src/Audio.cpp @@ -210,7 +210,7 @@ void micTask(void *parameter) { // Configure and start I2S input stream. auto i2sConfig = i2sInput.defaultConfig(RX_MODE); i2sConfig.bits_per_sample = BITS_PER_SAMPLE; - i2sConfig.sample_rate = SAMPLE_RATE; + i2sConfig.sample_rate = 16000; i2sConfig.channels = CHANNELS; i2sConfig.i2s_format = I2S_LEFT_JUSTIFIED_FORMAT; i2sConfig.channel_format = I2S_CHANNEL_FMT_ONLY_LEFT; diff --git a/frontend-nextjs/app/components/CreateCharacter/BuildDashboard.tsx b/frontend-nextjs/app/components/CreateCharacter/BuildDashboard.tsx index cb7b30f..55a3481 100644 --- a/frontend-nextjs/app/components/CreateCharacter/BuildDashboard.tsx +++ b/frontend-nextjs/app/components/CreateCharacter/BuildDashboard.tsx @@ -272,7 +272,7 @@ const SettingsDashboard: React.FC = ({

-
+
{[...openaiVoices, ...geminiVoices].map((voice: VoiceType) => (
{ - console.log("ElevenLabs message type:", event.type); + console.log("ElevenLabs message type:", event); switch (event.type) { case "conversation_initiation_metadata": @@ -201,11 +200,20 @@ export const connectToElevenLabs = async ( ); // Send audio committed message like OpenAI does - console.log("Sending AUDIO.COMMITTED to ESP32"); - ws.send(JSON.stringify({ - type: "server", - msg: "AUDIO.COMMITTED" - })); + // console.log("Sending AUDIO.COMMITTED to ESP32"); + // ws.send(JSON.stringify({ + // type: "server", + // msg: "AUDIO.COMMITTED" + // })); + + if (!hasResponseStarted) { + console.log("Sending RESPONSE.CREATED to ESP32 (agent audio starting)"); + ws.send(JSON.stringify({ + type: "server", + msg: "RESPONSE.CREATED" + })); + hasResponseStarted = true; + } } @@ -226,19 +234,11 @@ export const connectToElevenLabs = async ( hasResponseStarted = false; // Reset for next response try { const device = await getDeviceInfo(supabase, user.user_id); - - if (device) { - ws.send(JSON.stringify({ - type: "server", - msg: "RESPONSE.COMPLETE", - volume_control: device.volume ?? 100, - })); - } else { - ws.send(JSON.stringify({ - type: "server", - msg: "RESPONSE.COMPLETE", - })); - } + ws.send(JSON.stringify({ + type: "server", + msg: "RESPONSE.COMPLETE", + volume_control: device?.volume ?? 100, + })); } catch (error) { console.error("Error fetching updated device info:", error); ws.send(JSON.stringify({