liveBook · Manning

MLX Whisper

As explained in Build Applications with Local AI Models on a Mac

MLX Whisper is a speech-recognition implementation based on Whisper and optimized for Apple Silicon through MLX.

MLX Whisper turns speech into text locally on an Apple silicon Mac. It is a version of the Whisper speech-recognition model built for Apple’s MLX framework. In a voice chatbot, its transcript becomes the text sent to the language model. section 1.0 section 9.2

MLX uses the shared memory of Apple’s M-series chips to make transcription faster and more memory-efficient than CPU-based PyTorch Whisper on the tested hardware. Speed still varies with system load and the Mac’s configuration. section 9.2

Table 9.1 Approximate transcription speed comparison for a 60-second English audio clip on a Mac Mini M2 (8 GB unified memory). Times are the number of wall-clock seconds needed to produce the transcript.

Model

Standard PyTorch (CPU)

MLX Whisper

Speedup

whisper-tiny

8 s

2 s

~4×

whisper-small

28 s

6 s

~5×

whisper-medium

75 s

14 s

~5×

whisper-large-v3

210 s

38 s

~6×

Compare approximate transcription times for several model sizes on one Mac Mini M2. Treat the figures as examples, not promised speeds. section 9.2

To make a first transcript:

  • Activate a Python virtual environment, then install mlx-whisper, sounddevice, numpy, and scipy. The latter packages support microphone capture and audio-file handling. section 9.3
  • Record audio and save it as a WAV file. Whisper’s audio needs to be mono and 16 kHz; processing uses float32, while WAV files can use int16. section 9.11
  • Pass the audio file’s path to mlx_whisper.transcribe(), along with a model name in path_or_hf_repo. Read result["text"] for the transcript. section 9.11 section 9.6
import mlx_whisper
from pathlib import Path

AUDIO_FILE    = Path(__file__).with_name("recording.wav")
WHISPER_MODEL = "mlx-community/whisper-small-mlx"

def transcribe(audio_path: str, model: str = WHISPER_MODEL) -> str:
    """Transcribe an audio file and return the text."""
    if not Path(audio_path).is_file():
        raise FileNotFoundError(
            f"Audio file not found: {audio_path}. Run python record.py first."
        )
    print(f"Transcribing with {model.split('/')[-1]}...")
    result = mlx_whisper.transcribe(str(audio_path), path_or_hf_repo=model)
    return result["text"].strip()


if __name__ == "__main__":
    text = transcribe(AUDIO_FILE)
    print(f"\nTranscript:\n{text}")

This complete Python example checks that recording.wav exists, transcribes it with whisper-small-mlx, and prints the returned text. section 9.6

Start with the small model on a memory-constrained Mac; try medium if more unified memory is available. The first use of a Hugging Face model downloads its weights, which are cached for later runs. MLX requires Apple silicon; an Intel Mac needs a different Whisper package and workflow. section 9.11 section 9.3 section 9.6

How Build Applications with Local AI Models on a Mac covers it

How deep it goes
Works through installation and a runnable transcription script, including model selection and common setup errors, without explaining model internals.
Examples
Uses a recorded WAV file and a Python script that prints the transcript; compares model speeds on a Mac Mini M2.
What it assumes
Assumes an Apple silicon Mac and benefits from basic Python familiarity, while introducing command-line and AI concepts from the ground up.
What you can do after
Apply it via mlx_whisper.transcribe() to turn a recorded audio file into text for a reusable voice-input script.
How it connects
Links speech recognition with digital audio, Python microphone recording, Hugging Face model downloads, and language model input.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build Applications with Local AI Models on a Mac. The section links point to the parts of the book it draws on.