Quickstart
Requirements
Section titled “Requirements”Use the tool versions in the repository mise.toml, or Elixir 1.20 or later
with a compatible OTP version.
git clone https://github.com/flowcopilot/audioflow.gitcd audioflowmise installmix deps.getUse AudioFlow in your application
Section titled “Use AudioFlow in your application”Add the dependency to the mix.exs of your own project:
def deps do [{:audio_flow, github: "flowcopilot/audioflow"}]endOptional parts compile only when their flag is set to 1 in the environment of
mix deps.get and of every later mix command:
AUDIOFLOW_ML=1: local models (Bumblebee, EXLA).AUDIOFLOW_MEDIA=1: Membrane input and PortAudio output.AUDIOFLOW_WEBRTC=1: WebRTC transport.AUDIOFLOW_SFU=1: the BEAM SFU pieces.
AUDIOFLOW_MEDIA=1 mix deps.getAUDIOFLOW_MEDIA=1 mix compileWithout flags you get the core and the HTTP adapters, which is enough for
AudioFlow.WebSocket and the telephony transports. Your application also
needs a web server such as Bandit to serve them.
Run the core
Section titled “Run the core”The core runs without model downloads. The demo adapters produce fixed text and silent PCM.
mix testmix run examples/demo.exsmix audio_flow.bench --runs 20 --concurrency 4Start a session
Section titled “Start a session”{:ok, session} = AudioFlow.start_session(AudioFlow.Adapters.Demo.options())audio = %AudioFlow.Audio{data: <<0, 0>>, sample_rate: 16_000}{:ok, turn} = AudioFlow.submit(session, audio)
receive do {AudioFlow, ^session, ^turn, event} -> IO.inspect(event)end
AudioFlow.cancel(session)AudioFlow.stop_session(session)The owner process receives transcript, text, audio, and terminal events for the turn. See Sessions for the rules.
Send a typed message
Section titled “Send a typed message”{:ok, turn} = AudioFlow.submit(session, %AudioFlow.Text{data: "Hello"})Text turns skip speech recognition. The reply uses the same speech synthesis and history path as a voice turn.
Use real models
Section titled “Use real models”Enable the model code, then run an example with real inference:
AUDIOFLOW_ML=1 mix deps.getAUDIOFLOW_ML=1 mix run examples/kokoro.exs "Hello from AudioFlow." output.wavKokoro needs espeak-ng for text input (brew install espeak-ng on macOS).
See Local models.
Examples
Section titled “Examples”| File | Shows |
|---|---|
examples/demo.exs |
A session with demo adapters |
examples/routing.exs |
Model routing without downloads |
examples/http.exs |
One HTTP chat request |
examples/kokoro.exs |
Kokoro speech to a WAV file |
examples/vad.exs |
Silero voice detection on a PCM file |
examples/local.exs |
Whisper, Qwen3, and Kokoro for benchmarks |
examples/media.exs |
PCM file input to speaker output |
examples/conversation.exs |
Sequential turns with history |
examples/multimodal.exs |
Embeddings and image captions |
examples/video.exs |
Descriptions of sampled video frames |
examples/models.exs |
Shared model services for the other examples |
examples/transcribe.exs |
Captions for a WAV file through any STT adapter |
examples/websocket.exs |
The browser WebSocket demo |
examples/cloud_agent.exs |
A voice agent on Deepgram, ReqLLM, and Cartesia (needs API keys) |
examples/telephony-loopback.exs |
Twilio and Telnyx media streams against a local server, offline |
examples/network/voice_agent.exs |
Two local WebRTC peers exchange synthetic voice (AUDIOFLOW_WEBRTC=1) |
examples/rtvi-client |
A Pipecat JavaScript client over the RTVI WebSocket |
examples/durable-call |
A call that survives the death of its agent node |
examples/avatar |
A LiveAvatar viewer for provider audio and video |
examples/chat |
A LiveView voice and text chat |