# whisper.cpp

> Whisper speech recognition as plain C/C++, with no dependencies

- Category: Multimodal Generation / Audio, Music & Voice
- Language: C++
- Licence: MIT
- Repository: https://github.com/ggml-org/whisper.cpp
- Canonical page: https://ai-tldr.dev/tools/whisper-cpp/

## In short

whisper.cpp is a port of OpenAI's Whisper automatic speech recognition model written in plain C and C++ with no external dependencies. The whole high-level model lives in two files, `include/whisper.h` and `src/whisper.cpp`; everything underneath is the ggml tensor library, the same foundation as llama.cpp. It sits in the Audio, Music & Voice category of the Multimodal Generation tools and is open-source, written in C++ and licensed MIT.

## Overview

whisper.cpp is a port of OpenAI's Whisper automatic speech recognition model written in plain C and C++ with no external dependencies. The whole high-level model lives in two files, `include/whisper.h` and `src/whisper.cpp`; everything underneath is the ggml tensor library, the same foundation as llama.cpp. That compactness is the point — it makes the model something you can drop into an application rather than a Python service you have to operate next to one.

The build targets a wide spread of hardware rather than one accelerator. Apple Silicon is a first-class target through ARM NEON, the Accelerate framework, Metal and Core ML, where running the encoder on the Neural Engine is reported to be more than three times faster than CPU-only. Beyond that there are AVX intrinsics for x86, VSX for POWER, and backends for NVIDIA CUDA, AMD ROCm, AMD Ryzen AI NPUs, Vulkan, OpenVINO, Ascend NPUs and Moore Threads GPUs. Inference runs in mixed F16/F32 with no memory allocations at runtime, and integer quantization shrinks the models further.

Because it is just a library and a CLI, it ships everywhere the model needs to go: macOS, iOS, Android, Linux, FreeBSD, Windows, WebAssembly, Raspberry Pi and a Docker image, with bindings including Java and npm. Models are used in the project's own `ggml` format, downloaded by a script in the repo, and voice activity detection is built in. The project is MIT licensed and maintained under the ggml organisation.

## What it does

- Plain C/C++ implementation with zero dependencies and no runtime memory allocation
- Backends for Metal/Core ML, CUDA, ROCm, Vulkan, OpenVINO, Ascend and AMD Ryzen AI NPUs, plus AVX and VSX CPU paths
- Integer quantization (e.g. Q5_0) to cut model size and memory
- Built-in voice activity detection (VAD)
- Runs on macOS, iOS, Android, Linux, Windows, Raspberry Pi, WebAssembly and Docker
- A C-style API in `whisper.h` plus bindings, so it embeds directly in applications

## Getting started

Clone the repo, fetch a model in ggml format, build the CLI with CMake and transcribe a 16-bit WAV file.

1. Clone and download a model

   Models are converted to the project's ggml format; the download script fetches them by name.

```bash
git clone https://github.com/ggml-org/whisper.cpp.git
cd whisper.cpp
sh ./models/download-ggml-model.sh base.en
```

2. Build and transcribe

   Builds the `whisper-cli` example, then runs it against one of the bundled samples.

```bash
cmake -B build
cmake --build build -j --config Release

./build/bin/whisper-cli -f samples/jfk.wav
```

3. Convert your own audio first

   The CLI reads 16-bit WAV, so convert other formats to 16 kHz mono PCM before transcribing.

```bash
ffmpeg -i input.mp3 -ar 16000 -ac 1 -c:a pcm_s16le output.wav
```

4. Quantize the model to save memory

   The `quantize` tool rewrites a ggml model at a lower bit width; pass the quantized file to the CLI with `-m`.

```bash
./build/bin/quantize models/ggml-base.en.bin models/ggml-base.en-q5_0.bin q5_0
./build/bin/whisper-cli -m models/ggml-base.en-q5_0.bin ./samples/gb0.wav
```

## When to use it

- Transcribe audio entirely on-device, so recordings never leave the machine
- Embed speech recognition in a desktop, mobile or embedded app through a C API instead of shipping a Python runtime
- Run Whisper on hardware without a CUDA GPU — Apple Silicon, a Raspberry Pi, an NPU or plain CPU
- Build an offline voice command layer or a browser-side transcriber via the WebAssembly build
