New Tool Radar

Local AI

How to Transcribe Live Microphone Audio with WhisperLive

Run Collabora's WhisperLive server with the faster-whisper backend and connect its microphone client, so speech from your microphone appears as text while you are still speaking.

Schematic diagram with three steps: install WhisperLive and PortAudio, start the server on port 9090 with the faster-whisper backend, then run the microphone client so spoken words appear as text.

Plain Whisper transcribes a finished audio file. WhisperLive is different: it is a real-time transcription application that uses the OpenAI Whisper model to convert speech input into text output, and it can transcribe both live audio input from a microphone and pre-recorded audio files. The project calls itself a nearly-live implementation of Whisper, so expect text to appear a moment after you speak, not at the exact instant. This guide runs it on your own machine with the faster-whisper backend.

Install WhisperLive and its microphone dependency

Microphone input needs PortAudio, the system dependency for PyAudio. The README gives a setup script for it: on Debian or Ubuntu it installs portaudio19-dev, on Fedora portaudio-devel, and on macOS it uses Homebrew (portaudio).

bash scripts/setup.sh

Then make a virtual environment and install the package from pip. The README uses Python 3.12:

python3.12 -m venv whisper_env
source whisper_env/bin/activate
pip install whisper-live

The server and client scripts live in the WhisperLive repository, so clone it first to get run_server.py and run_client.py:

git clone https://github.com/collabora/WhisperLive

Start the server with the faster-whisper backend

The server supports three backends, faster_whisper, tensorrt, and openvino. For a first run, use faster-whisper on port 9090:

python3 run_server.py --port 9090 \
                      --backend faster_whisper \
                      --max_clients 4 \
                      --max_connection_time 600

Those two limits are the defaults: --max_clients restricts how many clients the server allows, and defaults to 4, while --max_connection_time limits a client’s connection time in seconds, and defaults to 600. By default, when the server runs without a model specified, it instantiates a new Whisper model for every client connection, so expect to wait for the model to load when the first client connects. If you serve one custom faster-whisper model with the -fw option, the server instead instantiates that custom model once and reuses it for all client connections.

Connect the microphone client and speak

The client connects to the server on localhost port 9090. The README’s example client picks the small model, English, and saves the microphone input as a .wav file while it transcribes:

from whisper_live.client import TranscriptionClient
client = TranscriptionClient(
  "localhost",
  9090,
  lang="en",
  translate=False,
  model="small",
  use_vad=False,
  save_output_recording=True,
  output_recording_filename="./output_recording.wav",
)

Calling the client with no argument transcribes from the microphone; passing a file name transcribes that file instead:

client()
client("tests/jfk.wav")

Speak the practice sentence, “The lighthouse keeper named Mara checked the lamp at noon,” into the microphone and watch the words appear as text. The translate option stays False when you want transcription in the source language; set it to True only to translate from the source language to English.

Check What you should see If you do not see it
Server The server starts on port 9090 with the faster_whisper backend and waits for clients Check the port is free and the backend is spelled faster_whisper
Client connects The client connects to localhost on port 9090, then waits while the model loads The server is not running, or the client points at a different port
Speak Your sentence appears as text while you are still speaking PortAudio is missing — run bash scripts/setup.sh first — or the wrong microphone is selected
Recording A file called output_recording.wav appears next to the client script save_output_recording is False; it only saves microphone input, and defaults to False

Expected result. We checked the WhisperLive README and its PyPI page for the PortAudio setup, the pip install, the server command with port 9090 and the faster-whisper backend, the 4-client and 600-second defaults, and the microphone client with model small and the recording option. We did not run WhisperLive.

Limits

WhisperLive is nearly live, not instant: audio is buffered and transcribed in chunks, so text trails your speech by a short delay. A connection is capped at 600 seconds by default, so a long session needs the --max_connection_time value raised, and only 4 clients can connect by default. The first connection is slow because a model is loaded for it, and a bigger model makes that wait longer. The transcript has no speaker labels unless you turn on the optional diarization, which needs pyannote.audio installed. The practice sentence above is fictional. We did not run WhisperLive, so no transcript here is a recorded result.

Sources

See all