whisper.cpp en tiempo real con tiny

This commit is contained in:
2025-06-19 15:50:54 -03:00
parent 9908d84b8c
commit 77f87c3655
5 changed files with 227 additions and 93 deletions

View File

@ -6,8 +6,15 @@ defmodule Recognition_VADWeb.DataChannel do
{:ok, socket}
end
# Parcial
def handle_info({:realtime, msg}, socket) do
push(socket, "realtime", msg)
{:noreply, socket}
end
# Completo
def handle_info({:broadcast_audio, msg}, socket) do
push(socket, "transcription", Jason.decode!(msg))
push(socket, "transcription", msg)
{:noreply, socket}
end
@ -15,7 +22,7 @@ defmodule Recognition_VADWeb.DataChannel do
def handle_in("audio_chunk", %{"data" => base64_chunk, "sample_rate" => sample_rate}, socket) do
case Base.decode64(base64_chunk) do
{:ok, binary_audio} ->
GenServer.cast(Recognition_VAD.AudioProcessor, {:chunk, binary_audio, sample_rate})
Recognition_VAD.WhisperStreamer.push_chunk(binary_audio, sample_rate)
{:noreply, socket}
:error ->