Metadata-Version: 2.4
Name: pyscribe-app
Version: 2.0.0
Summary: Record microphones and system audio, transcribe meetings on your own machine, summarize with Claude.
Keywords: transcription,speech-to-text,whisper,speaker-diarization,meeting-notes,audio-recording,obsidian,apple-silicon
Author: Tobias Würth
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: GPU :: NVIDIA CUDA
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: End Users/Desktop
Classifier: Natural Language :: English
Classifier: Natural Language :: German
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Multimedia :: Sound/Audio :: Capture/Recording
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
Classifier: Typing :: Typed
Requires-Dist: av>=14
Requires-Dist: ctranslate2>=4.9
Requires-Dist: fastapi>=0.165
Requires-Dist: httpx2>=2.16
Requires-Dist: huggingface-hub>=2.4
Requires-Dist: nicegui>=4.1,<5
Requires-Dist: opentelemetry-api<1.46
Requires-Dist: numpy>=2
Requires-Dist: platformdirs>=4.3
Requires-Dist: pyaudiowpatch>=0.2.12.9 ; sys_platform == 'win32'
Requires-Dist: pydantic>=2.10
Requires-Dist: python-multipart>=0.0.20
Requires-Dist: pywebview>=6
Requires-Dist: pywebview[pyside6]>=6 ; sys_platform == 'linux'
Requires-Dist: catap>=0.6.2 ; sys_platform == 'darwin'
Requires-Dist: sounddevice>=0.5 ; sys_platform == 'darwin'
Requires-Dist: soundcard>=0.4.6 ; sys_platform == 'linux'
Requires-Dist: soundfile>=0.13
Requires-Dist: starlette>=1.10
Requires-Dist: uvicorn>=0.32
Requires-Dist: faster-whisper>=1.2.1
Requires-Dist: nvidia-cublas-cu12>=12.6 ; (platform_machine == 'x86_64' and sys_platform == 'linux') or (platform_machine == 'AMD64' and sys_platform == 'win32')
Requires-Dist: onnx-asr[hub]>=0.12
Requires-Dist: pyannote-audio>=4.1.1
Requires-Dist: torch>=2.11
Requires-Dist: torchaudio>=2.11
Requires-Dist: transformers>=4.57
Requires-Python: >=3.12, <3.13
Project-URL: Homepage, https://github.com/tobiaswuerth/pyscribe
Project-URL: Source, https://github.com/tobiaswuerth/pyscribe
Project-URL: Issues, https://github.com/tobiaswuerth/pyscribe/issues
Project-URL: Changelog, https://github.com/tobiaswuerth/pyscribe/blob/main/CHANGELOG.md
Description-Content-Type: text/markdown

# PyScribe

PyScribe records any mix of microphones and speakers (system audio) and transcribes the recording
on your own computer or a GPU worker, with speakers separated. Claude can summarize and title it;
the result copies as plain text or as a Markdown note. Tuned for German (including Swiss German)
and English. Windows, macOS 14.2+ (Apple Silicon) and Linux.

![PyScribe: recordings on the left, the selected recording in the middle, devices on the right](https://raw.githubusercontent.com/tobiaswuerth/pyscribe/main/docs/screenshot.png)

## Install

Install it with [uv](https://docs.astral.sh/uv/), which also fetches the Python 3.12 that
PyScribe needs. Windows, Linux and Apple Silicon Macs are supported; Intel Macs are not, as
PyTorch, ONNX Runtime and TorchCodec publish no current builds for them. The commands in this
file are the same in PowerShell, bash and zsh unless noted.

```sh
uv tool install --python 3.12 --torch-backend auto pyscribe-app
```

Then start it with `pyscribe`. To update, run the install line again with `--upgrade` at the end,
so that the PyTorch build for your computer is chosen again (uv does not record
`--torch-backend` for `uv tool upgrade`). To remove it: `uv tool uninstall pyscribe-app`
(recordings, settings and models stay; see [Files](https://github.com/tobiaswuerth/pyscribe#files)).

`--torch-backend auto` installs the CUDA build of PyTorch on computers with an NVIDIA GPU and the
CPU build elsewhere. On Windows and Linux, PyScribe also brings NVIDIA's cuBLAS for CUDA 12, which
the Whisper models need on the GPU. Without a GPU (and on macOS), set **Device** to *Processor
(CPU)* before the first transcription, or use a [remote worker](https://github.com/tobiaswuerth/pyscribe#remote-worker).

| OS | Microphones | Speakers (system audio) | Needs |
|---|---|---|---|
| Windows | WASAPI, shared mode | WASAPI loopback | nothing |
| macOS 14.2+, Apple Silicon | Core Audio | Core Audio taps | microphone and *System Audio Recording* permission when asked |
| Linux | PulseAudio / PipeWire | monitor sources | PulseAudio or PipeWire (`pipewire-pulse`); Qt for the window |

PyScribe never takes a device exclusively: Teams, Zoom and other apps keep using the same
microphone. A device that drops out (unplugged, or reset when a call starts) is reopened every
2 seconds and its track continues.

## Start

```sh
pyscribe                             # desktop window
pyscribe --mode browser              # in the web browser; file and folder pickers become text fields
pyscribe --mode server --port 8080   # serve on localhost only, open nothing
```

`--settings <file>` uses another settings file; one PyScribe runs per settings file.

## Use

1. **Devices** (right pane): every microphone and speaker shows a live level meter. Click the ones
   to record, also during a recording; the refresh button finds newly plugged devices.
2. **Record**, **Pause**/**Resume**, **Stop**. Each device is written to its own FLAC track, all
   on one clock; a device added later starts with silence so its track lines up.
3. **Transcribe** starts by itself after **Stop** (setting *Transcribe automatically*). The arrow
   next to it picks another model for this recording; **Abort** stops a job at once.
4. **The recording** (middle pane): edit its title; see status, length, words, speakers and audio
   size; then **Summarize**, **Copy text**, **Copy Markdown**, **Delete audio** (keeps the
   transcript) or **Delete** (both ask first, neither can be undone). The upload button above the
   recordings adds an existing audio or video file.

All tracks are mixed before transcription; voices are numbered by first appearance:

```
[00:00:03] Speaker 1: Grüezi mitenand, wir beginnen mit dem Budget.
[00:00:09] Speaker 2: Danke. Ich habe zwei Fragen dazu.
```

**Copy Markdown** gives title, summary and transcript with YAML front matter (date, duration,
speakers, words, language, model, tags), ready to paste into Obsidian.

## First run

- **Models** download with the first transcription, 0.7 to 6.2 GB each; the start screen says
  which and how big.
- **Speaker separation** uses [pyannote speaker-diarization-community-1](https://huggingface.co/pyannote/speaker-diarization-community-1),
  which needs a free Hugging Face token. *Setup needed* in the header leads to the steps: create
  an account, accept the model's terms, create a Read token, paste it, **Check and save**. The
  token is stored where Hugging Face's own tools look (`HF_TOKEN` also works). Or turn off
  *Separate speakers*.
- **Summaries** run through [Claude Code](https://claude.com/claude-code): install it and run
  `claude` once to log in. PyScribe calls it with no tools, no MCP servers and no saved session,
  capped at USD 2 per summary; the transcript goes to Anthropic. A summary has sections for
  summary, decisions, action items and open questions, and titles an untitled recording.

## Privacy

Recording, transcription and speaker separation run on your computer. What leaves it:

- Model downloads from Hugging Face on first use, and the check of your Hugging Face token against
  the speaker model's terms.
- The transcript, to Anthropic, only when you press **Summarize** (through Claude Code).
- The audio, to your own worker, only if **Transcribe on** is *Remote worker*.

Nothing else; the telemetry of ONNX Runtime and pyannote is switched off.

## Settings

| Setting | Meaning |
|---|---|
| Save folder | where recordings go (default `Documents/PyScribe`) |
| Transcribe on | *This PC* or *Remote worker* (URL and token) |
| Device | *Graphics card (GPU)* or *Processor (CPU)* of the computer that transcribes; Parakeet always uses the CPU |
| Language, Model | German or English and one of its models, see below |
| Separate speakers | name voices Speaker 1, 2, … (pyannote counts them) |
| Transcribe automatically after recording | start a job when a recording stops or a file is added |
| Claude model | Haiku (fast, cheap) or Sonnet (more thorough) for summaries |

## Models

Word error rate (WER) and speed of PyScribe's pipeline (batched, with voice detection) on FLEURS
dev clips, normalised for case and punctuation (and ß as ss). GPU: 100 clips on an RTX 4090; CPU:
30 clips on an i9-14900K.

| Language | Preset | Model | WER | Speed (x real time) |
|---|---|---|---|---|
| German | `german-turbo` (default) | [primeline/whisper-large-v3-turbo-german](https://huggingface.co/primeline/whisper-large-v3-turbo-german) | 3.95 % GPU, 2.8 % CPU | 94 GPU, 2.9 CPU |
| German | `swiss-german` | [matildecs/whisper-large-stt4sg](https://huggingface.co/matildecs/whisper-large-stt4sg) | 6.0 % (Standard German) | 31 GPU |
| German | `parakeet-cpu` | NVIDIA Parakeet TDT 0.6B v3, int8 | 8.2 % | 14 CPU |
| English | `english-distil` (default) | [distil-whisper/distil-large-v3.5](https://huggingface.co/distil-whisper/distil-large-v3.5) | 4.24 % GPU, 6.7 % CPU | 107 GPU, 2.7 CPU |
| English | `english-parakeet` | NVIDIA Parakeet TDT 0.6B v2, int8 | 11.1 % | 12 CPU |
| both | `multilingual-large-v3` | OpenAI Whisper large-v3 | 4.26 % German, 4.10 % English | 31 GPU |

- `german-turbo` writes "ss" for "ß" (Swiss spelling). `swiss-german` writes dialect as Standard
  German (about 20 % WER reported on dialect test sets).
- Parakeet is the option for slow computers. `english-parakeet` writes numbers as words and keeps
  filler words, which FLEURS counts as errors.
- Tested, not adopted: Qwen3-ASR-1.7B (German 4.10 % at 6.6x, conflicting dependencies), Whisper
  large-v3-turbo for English (4.44 %, slower than Distil), Parakeet v3 for English (14 %).
- FLEURS is read speech; meetings score worse with every model.

## Remote worker

On a computer with a GPU (installed as above):

```sh
export PYSCRIBE_WORKER_TOKEN="a long random secret"   # bash, zsh
# PowerShell: $env:PYSCRIBE_WORKER_TOKEN = "a long random secret"
pyscribe-worker --host 0.0.0.0   # port 41738; --port and --data-dir change them
```

In PyScribe, set **Transcribe on** to *Remote worker*, enter the URL (for example
`http://gpu-box:41738`) and the token, and **Save**. PyScribe uploads the tracks, follows the job,
fetches the transcript and deletes the job on the worker. The API is plain HTTP with a bearer
token: use it on a trusted network or behind a TLS proxy or VPN. The token is stored in plain text
in the settings file.

## Files

| What | Where (Windows · macOS · Linux) | Owner and lifecycle |
|---|---|---|
| Recordings | `<save folder>/<YYYY-MM-DD_HH-MM-SS>/`: `NN-mic-….flac` / `NN-system-….flac` per track (added file: `01-audio.<ext>`), `recording.json`, `transcription.json`, `transcript.txt`, `transcript.json`, `notes.json` (title, summary) | Written by PyScribe; deleted from the app or by you. After a crash the audio up to the crash is kept and the recording shows as *Interrupted*. |
| Settings | `%LOCALAPPDATA%\PyScribe\settings.json` · `~/Library/Application Support/PyScribe/` · `~/.config/PyScribe/` | Written on every change; delete to reset. |
| Instance lock | `settings.lock` next to the settings file | Never written; the OS releases it when PyScribe exits, even after a crash. |
| Converted models | `%LOCALAPPDATA%\PyScribe\Cache\models` · `~/Library/Caches/PyScribe/models` · `~/.cache/PyScribe/models` | Written on first use of a preset that needs conversion; delete to convert again. |
| Downloaded models, Hugging Face token | `~/.cache/huggingface` | Managed by `huggingface_hub`. |
| Worker jobs | `worker` next to `models` in the cache folder above, on the worker | Deleted once the client fetched the result; finished jobs older than a day are purged when the next job arrives. |

## Limitations

- **Mixed languages:** Whisper may skip passages not in the chosen language.
- **No headset:** the microphone also hears the speakers, so remote voices are in the mix twice
  with a slight delay. Recognition usually copes; a headset is cleaner.
- **Microphone indicator:** the level meters keep microphones open, so the OS shows "microphone in
  use" while PyScribe runs. Nothing is stored unless you record.
- **No live transcript:** transcription starts when the recording stops.
- **macOS and Linux** capture is tested in CI against virtual devices (BlackHole, PulseAudio null
  sinks); Windows also on real hardware.

## Troubleshooting

- **No GPU, or a CUDA error:** set **Device** to *Processor (CPU)*, or use a remote worker.
- **"cuBLAS 12 ... not installed"** (or `cublas64_12.dll` / `libcublas.so.12` not found): run the
  install line again with `--reinstall` at the end.
- **"Setup needed" in the header:** speaker separation lacks its Hugging Face token; follow the
  steps there, or turn off *Separate speakers*.
- **macOS records silence or nothing:** allow *Microphone* and *System Audio Recording* for the app
  that started PyScribe (System Settings > Privacy & Security), then start PyScribe again.
- **Linux lists no devices:** PyScribe needs a PulseAudio or PipeWire server (`pipewire-pulse`);
  `pactl info` must answer.

## Development

```sh
git clone https://github.com/tobiaswuerth/pyscribe.git
cd pyscribe
uv sync                  # CUDA PyTorch on Windows/Linux; CPU only: uv sync --no-group gpu --group cpu
uv run prek install      # git hooks: checks on commit, the whole gate before push
uv run nox               # the gate: hooks, types per OS, tests at 100 % line and branch coverage,
                         # each test file alone, lowest dependency versions, the built package
uv run nox -s fresh      # the gate from a fresh clone (fresh-wsl: the same in WSL)
uv run nox -s audio      # record from virtual devices (CI sets them up)
uv run nox -s smoke      # end to end: real devices, GPU, CPU, remote worker, app server
uv run nox -s bench -- --language en   # WER and speed of a language's presets
```

CI runs the gate sessions as jobs, the tests on Windows, macOS and Linux and real recordings on
macOS and Linux virtual devices, behind one required check.
Merging to `main` publishes to PyPI and creates the GitHub release once the top `CHANGELOG.md`
section has a date (`## 2.1.0 - 2026-12-24`, not in the future); `unreleased` does nothing. Each
step runs only if it is still missing, so the next run on `main` finishes one that failed.
A weekly run (`uv run nox -s highest`) tests the newest allowed versions of every dependency.
Rules for contributions: [CONTRIBUTING.md](https://github.com/tobiaswuerth/pyscribe/blob/main/CONTRIBUTING.md).

Code layout (`src/pyscribe`; dependencies point down only, enforced by import-linter):

| Package | Responsibility |
|---|---|
| `app.py` | composition root, command line |
| `ui/` | `controller.py` (all behaviour, no toolkit), `page.py` (NiceGUI view), `native.py` (window) |
| `worker/` | the remote worker's HTTP API |
| `jobs/`, `audio/`, `summary/` | job queue and remote client; capture per OS, recorder, level meters, file import; Claude Code summaries |
| `engine/`, `storage/` | decoding, ASR and diarization adapters in a killable process, Hugging Face access; run folders, settings, instance lock, atomic writes |
| `domain/` | pure logic: timeline, job states, model presets, transcript merge, notes |

Torch, faster-whisper, pyannote and onnx-asr load only inside the engine process; a test checks
that the app loads none of them.

## License

MIT, see [LICENSE](https://github.com/tobiaswuerth/pyscribe/blob/main/LICENSE).
