# Win Dictation - AI Voice to Text for Windows

A push-to-talk speech-to-text utility for Windows using OpenAI's Whisper model. Record, transcribe, and paste with a single hotkey.

![Win Dictation Screenshot](screenshot.png)

## Quick Download

**[Download Latest Release (WinDictation.zip)](release/WinDictation.zip)**

Extract the ZIP file and run `win-dictation.exe`. The release includes all required DLLs and a Whisper model.

---

## Features

### Performance
- **Physical-core threading**: Uses one thread per physical core for efficient batch transcription
- **CPU-only**: Optimised for the target Intel i5-7th-gen 2-core/4-thread machine
- **Smart model selection**: Auto-selects tiny.en for CPU-only, base.en when GPU is present
- **Self-calibrating progress**: Learns transcription speed per model and machine, delivering a smooth countdown

### User Interface
- **Single-surface rendering**: No inter-window seams or hairlines — the entire UI is one painted surface
- **Dark theme**: Calm, elevated card design with hover/press feedback
- **Per-monitor DPI awareness**: Looks sharp at any display scale
- **System tray**: Minimise to tray, global hotkey to record

### Audio Processing
- **Push-to-talk**: Press Ctrl+Shift+Space, speak, press again to transcribe
- **500ms auto-end**: Stops recording after 500ms of silence
- **Multiple microphones**: Select from all available input devices
- **16kHz sample rate**: Optimised for Whisper

## Usage

### Controls
- **Record**: Click the Record pill or press `Ctrl+Shift+Space`
- **Pin**: Keep window always-on-top
- **Copy / Paste / Clear**: Text actions
- **Model / Mic**: Select from popup menus
- **Hide**: `Ctrl+Shift+H` hides the window

### Indicators
- **Level**: Live audio energy during recording
- **Progress bar**: Smooth, counting-down estimate during transcription
- **Status**: Thread count at idle, elapsed time during recording

## Building from Source

### Prerequisites

- **Windows 10/11**
- **CMake** 3.5+
- **Visual Studio 2022/2026** with C++ workload
- **SDL2** (included in deps/)

### Build Steps

```powershell
cmake -S . -B build -G "Visual Studio 18 2026" \
  -DSDL2_DIR="deps/SDL2-2.28.5/cmake"
cmake --build build --config Release
```

The executable will be at `build\bin\Release\win-dictation.exe`.

## Technical Details

### Architecture

```
Hotkey → SDL Capture → Stop → Batch whisper_full → Text → Auto-paste
```

1. **SDL audio capture**: 16kHz mono recording into memory
2. **Stop-and-transcribe**: Press stop or hit max length (600s), then one `whisper_full` call
3. **Progress estimation**: Linear model fitted per machine/model, fused with whisper's chunk progress
4. **Text output**: Appended to transcript, copied to clipboard, optionally auto-pasted

### Model

Place `.bin` files in `models/` next to the executable. The app auto-detects available models:

| Model | Size | Params | Best for |
|-------|------|--------|----------|
| tiny.en | 75 MB | 39M | CPU-only systems |
| base.en | 140 MB | 74M | GPU-accelerated systems |

## Project Structure

```
win-dictation/
├── src/              # Application source
│   ├── main.cpp      # UI and message handling
│   ├── transcriber.* # Recording and transcription
│   ├── timing.h      # Progress estimation engine
│   ├── settings.h    # INI persistence
│   ├── text_util.h   # Transcript helpers
│   └── logging.h     # Log utilities
├── whisper/          # Whisper.cpp library
├── ggml/             # GGML tensor library
├── models/           # Whisper model files
├── release/          # Pre-built package
└── CMakeLists.txt    # Build configuration
```

## License

MIT — follows [whisper.cpp](https://github.com/ggerganov/whisper.cpp).

## Resources

- [Whisper.cpp](https://github.com/ggerganov/whisper.cpp)
- [Model Download](https://huggingface.co/ggerganov/whisper.cpp)
