Public
Edited
Dec 27
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
gain.gain.value = volume / 20.0;
}
Insert cell
audio_graph = {
messageProcessor.connect(gain);
gain.connect(audioContext.destination);

invalidation.then(() => {
gain.disconnect();
});
}
Insert cell
unprocessed = Generators.observe((notify) => {
const buffer = [];
notify(buffer);
client.on("conversation.updated", (event) => {
if (event?.delta?.audio) {
buffer.push(event.delta);
if (buffer.length <= 2) notify(buffer);
}
});
})
Insert cell
autoPlayAudio = {
({
prompt:
"can you play the audo in the incoming payload using web audio. Its packed in an 'Int16Array(51600) ' at incoming.at(-1).formatted.audio",
time: 1728369509847
});
while (unprocessed.length > 0) {
const audioData = unprocessed.shift()?.audio;
if (audioData instanceof Int16Array) {
const float32 = new Float32Array(audioData.length);
for (let i = 0; i < audioData.length; i++) {
float32[i] = audioData[i] / 32768;
}
messageProcessor.port.postMessage(float32);
}
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more