Local desktop app that converts scientific PDF articles into cleaned text and WAV audio. This implementation ports the ReadMyPaper-py workflow to Go, with a native Fyne interface and modular organization for extraction, cleaning, persistence, optional LLM review, and speech synthesis.
- PDF selection through a desktop interface;
- PDF signature, size, and page-count validation;
- local text and coordinate extraction from PDFs in Go;
- heuristic reading-order repair for multi-column articles;
- spatial filtering of content associated with figures, tables, and captions;
- scientific-article cleaning, including front matter, references, acknowledgements, appendices, and numeric citations;
- optional preservation of titles and headings;
- automatic English or Brazilian Portuguese detection;
- scientific-notation verbalization for natural listening;
- optional block review through a local OpenAI-compatible endpoint;
- local TTS with Piper (fast) or Kokoro (quality), with Kokoro fallback to Piper;
- concurrent job queue, progress tracking, persistent history, and restore after restart;
- local playback and export of the WAV, cleaned text, and original PDF;
- optional TTL retention and safe deletion of a job's artifacts.
cmd/readmypaper/ Fyne app entry point
internal/app/ desktop interface and WAV playback
internal/pdfextract/ positioned PDF extraction in Go
internal/cleaner/ reading order, filters, and verbalization
internal/llm/ OpenAI-compatible client with per-batch fail-open behavior
internal/tts/ voice catalog, voice download, and Piper/Kokoro backends
internal/jobs/ concurrent store, execution, and persistence
internal/pipeline/ processing orchestration
internal/config/ directories, limits, and environment variables
internal/domain/ shared types
internal/util/ files, URLs, IDs, and WAV validation
The app core, interface, PDF processing, cleaning, and orchestration are implemented in Go. Piper and Kokoro are invoked through small Python bridges embedded in the binary because the reference runtimes for those models are distributed as Python packages. No web server is required.
A more detailed technical description is available in ARCHITECTURE.md.
- Go 1.24.1 or newer;
- Python 3.10-3.12 for the TTS backends when running from source; the self-contained macOS package already embeds Python 3.12 and the TTS packages;
- internet access the first time each voice/model is used; after that, artifacts are kept in the local cache.
Install the Fyne build dependencies and, for Kokoro, espeak-ng:
sudo apt update sudo apt install -y gcc libgl1-mesa-dev xorg-dev libxkbcommon-dev espeak-ng
For playback through the Play button, make sure at least one of these commands is available: ffplay, paplay, or aplay.
xcode-select --install brew install espeak-ng
Playback uses afplay, which is already provided by macOS.
Use Go with a C compiler compatible with Fyne, such as the MSYS2 MinGW-w64 toolchain. For Kokoro, also install eSpeak NG. Playback uses PowerShell and System.Media.SoundPlayer.
When using the macOS package generated by make package-macos, skip this section: the Python runtime and the packages from requirements-tts.txt are inside the .app.
Create a virtual environment in the project directory:
python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements-tts.txtpy -3.12 -m venv .venv .\.venv\Scripts\Activate.ps1 python -m pip install --upgrade pip python -m pip install -r requirements-tts.txt
The app looks for python3, python, or py -3. To pin the virtual-environment interpreter:
export READMYPAPER_PYTHON_BIN="$PWD/.venv/bin/python"
In PowerShell:
$env:READMYPAPER_PYTHON_BIN = "$PWD\.venv\Scripts\python.exe"
go run ./cmd/readmypaper
Print the version without opening the interface:
go run ./cmd/readmypaper --version
mkdir -p bin go build -trimpath -o bin/readmypaper ./cmd/readmypaper
On Windows, use bin/readmypaper.exe as the destination. To package with the metadata from FyneApp.toml:
go install fyne.io/tools/cmd/fyne@latest fyne package
Generate dist/ReadMyPaper.app with the Go binary, standalone Python, and installed Piper/Kokoro backends:
make package-macos
Explicit architectures:
scripts/package-macos.sh --arch arm64 scripts/package-macos.sh --arch x86_64 scripts/package-macos.sh --arch universal
The script downloads the relocatable Python build from astral-sh/python-build-standalone, installs requirements-tts.txt directly into Contents/Resources/python, and assembles the bundle with Info.plist, Icon.png, and CFBundleIdentifier=io.github.thalesmms.readmypaper. For --arch universal, it creates a universal Go binary and includes separate Python runtimes in python-arm64 and python-x86_64; the build host must be able to run both Pythons to install the wheels. The arm64 build validated on 2026-06-24 produced an .app of about 854 MB, mostly because of the current Kokoro dependencies.
Signing and notarization are optional:
CODESIGN_IDENTITY="Developer ID Application: Your Name (TEAMID)" \ NOTARY_PROFILE="readmypaper-notary" \ make package-macos
Without a Developer ID, the local app is generated without a distribution signature; when sharing the bundle, the user may need to authorize it in Security & Privacy. Voices and models are still downloaded on first use and saved in ~/Library/Caches/ReadMyPaper, keeping the bundle smaller.
- Open New job and select a PDF.
- Choose the language, voice, engine, and speed.
- Adjust the cleanup rules.
- Optionally enable a local LLM endpoint compatible with
/chat/completions. - Click Process PDF.
- Track the job in the Jobs tab and save or play the results.
Piper downloads only the selected voice on first use. Kokoro manages its own model cache. When Kokoro fails, the pipeline automatically tries Piper and reports the engine that was actually used.
The URL can be provided as 127.0.0.1:11434/v1 or as a complete HTTP(S) URL. The client appends /chat/completions, rejects embedded credentials, query strings, and fragments, limits response size, and does not follow redirects.
The API key can be typed in the API key field in the LLM section. This value is used only for the running job and is not written to metadata.json. READMYPAPER_LLM_API_KEY still provides the initial field value.
The model receives text blocks and layout metadata in bounded batches. The output may only keep, drop, or reorder blocks; textual rewriting is deliberately ignored. On network errors or invalid responses, the batch is kept unchanged.
| Platform | Data | Cache |
|---|---|---|
| Linux | ~/.local/share/ReadMyPaper |
~/.cache/ReadMyPaper |
| macOS | ~/Library/Application Support/ReadMyPaper |
~/Library/Caches/ReadMyPaper |
| Windows | %LOCALAPPDATA%\ReadMyPaper |
%LOCALAPPDATA%\ReadMyPaper\Cache |
Copied PDFs are stored in uploads/<job-id>. Text, audio, and metadata.json are stored in outputs/<job-id>. When TTL is enabled, startup also removes old orphaned directories left by interrupted jobs or invalid metadata.
| Variable | Default | Purpose |
|---|---|---|
READMYPAPER_DATA_DIR |
platform data directory | PDFs and results |
READMYPAPER_CACHE_DIR |
platform cache directory | voices, models, and bridges |
READMYPAPER_MAX_WORKERS |
2 |
jobs processed simultaneously |
READMYPAPER_MAX_UPLOAD_BYTES |
52428800 |
maximum PDF size |
READMYPAPER_MAX_PDF_PAGES |
200 |
maximum page count |
READMYPAPER_SPEECH_RATE_MIN |
0.5 |
minimum speed in the UI/internal API |
READMYPAPER_SPEECH_RATE_MAX |
2.0 |
maximum speed in the UI/internal API |
READMYPAPER_MAX_PENDING_JOBS |
10 |
pending or running jobs |
READMYPAPER_JOB_RETENTION_HOURS |
0 |
TTL applied at startup; 0 disables it |
READMYPAPER_LLM_URL |
empty | default OpenAI-compatible URL |
READMYPAPER_LLM_MODEL |
empty | model sent to the endpoint |
READMYPAPER_LLM_ENABLED |
false |
starts with the LLM option checked |
READMYPAPER_LLM_API_KEY |
apikey |
bearer token for the local endpoint |
READMYPAPER_PYTHON_BIN |
Python embedded in the .app, then PATH |
interpreter for the TTS bridges |
Invalid numeric values use the default, except for structurally impossible limits, which prevent startup with an explicit message.
go test ./...
go vet ./...In environments without OpenGL/X11, such as headless CI:
go test -tags ci ./...
go build -tags ci -o bin/readmypaper-ci ./cmd/readmypaperThe tests cover multi-column ordering, spatial filtering, scientific cleaning, verbalization, PDF extraction, LLM, voice catalog, persistence, concurrent store behavior, pipeline behavior, and Fyne interface construction.
- there is no telemetry;
- PDFs and results remain in the app's local directories;
- the network is used to download models/voices and only when the optional LLM is enabled;
- deletions are restricted to data directories and validated identifiers;
- restored metadata paths are accepted only inside the uploads root;
- PDF content is not passed through shell arguments: the bridges receive a temporary JSON file and are executed without a shell.
See SECURITY.md for the trust model.
- Image-only PDFs are not processed with OCR; the app reports that the document requires OCR.
- Native extraction uses glyph, font, and geometry heuristics. PDFs with nonstandard encoding, highly ornamental layouts, or borderless tables may require tuning.
- The playback button depends on a WAV player already available on the system.
- First use can be slow because TTS models must be downloaded and initialized.
GPL-3.0-or-later, continuing the reference Python project. See LICENSE.