# audio-to-post: audio recordings into transcripts and drafts

audio-to-post is a WordPress plugin for newsrooms and podcast publishers. It turns an uploaded audio file or a podcast episode into a transcript and then a draft post, keeping speaker turns and timestamps. It splits long recordings, and it shows the editor the minutes and tokens a run will use before any paid call. The code is at [https://github.com/IndianOpinion/audio-to-post](https://github.com/IndianOpinion/audio-to-post), licensed MIT. Version v0.1.0 was released on 19 November 2026.

We wrote it from scratch from a one-line idea. Its PRD says so, and no real transcription provider has been run against it. The 47 utilities in this series were specified, built, reviewed and released between 11 and 19 November 2026 by language-model coding agents under the editor's direction, in five roles: a spec writer, a spec reviewer, a builder that saw only the spec, an independent code reviewer and a releaser. The editor made the rulings on every open question.

## The problem

Turning an hour of recorded interview into an article takes an editor several hours. Speech-to-text services do the typing well, but using them by hand has four recurring failures:

- Files are too long. Most transcription APIs refuse a request above a size or duration limit. Editors split files by hand, lose the time offsets, and the quotes no longer match the recording.

- Speaker turns are lost. When a recording is split, speaker labels restart in every piece, so "Speaker 1" in part two is not the person in part one.

- Cost comes as a surprise. Transcription is billed by the minute and drafting by the token, and nobody knows the bill until after the run.

- Unchecked text reaches readers. A model asked to write an article from a transcript can invent quotes, misattribute lines and make up timestamps.

## What it does

- Accepts a Media Library attachment, a direct audio URL, or a podcast feed URL with a chosen episode. Video is refused.

- Measures the file for free, then shows an estimate: billed minutes, chunk count and draft tokens. A price appears only when the operator has entered prices.

- Requires the editor to confirm the estimate before the first paid call.

- Splits MP3 and WAV files into chunks of about ten minutes with a ten-second overlap, and stitches the results into one transcript with global times and consistent speakers.

- Writes a draft in one of three modes: article, show_notes or transcript.

- Exports the transcript as JSON, WebVTT, SRT and plain text, and offers REST routes and wp audio-to-post commands.

## How it works

A run is a private post with a state machine: new, fetching, probed, awaiting_confirmation, queued, transcribing, transcript_ready, drafting and draft_ready, with side states for paused, failed, cancelled, expired and empty. Other transitions are refused.

Chunking is pure PHP. There is no shell and no ffmpeg. Mp3Reader walks the MPEG frames to get an exact length and frame-aligned offsets, and WavReader reads the RIFF header. Mp3Chunker and WavChunker cut on those boundaries. Other formats go to the provider whole, or are refused.

The Stitcher maps speaker labels across each overlap by shared speaking time and flags weak mappings. Times are shifted to the recording. The seam is cut in a gap between words near the middle of the overlap. The estimate carries a fingerprint, and a confirmation is refused if anything that affects cost has changed.

For drafts, the model sees segment ids and never times. Speakers and times come from the transcript. Each quote must appear in the segment it cites, and anything else is removed and listed in review notes on the edit screen. Transcription goes through a small TranscriptionAdapter interface, with one generic multipart HTTP adapter, a transcript file importer and a fake adapter for tests.

wp audio-to-post add episode.mp3 --rights-confirmed --mode=show_notes
wp audio-to-post confirm 42
wp audio-to-post run --time=1800
wp audio-to-post export 42 --format=vtt > episode.vtt

## Guard rails

- It never publishes. Every post is a draft, even if a filter asks for something else.

- Nothing is paid for before the editor confirms the estimate.

- Before every paid call it reads the kill switch, the daily caps (120 audio minutes and 200,000 tokens by default), the audiopost_can_spend filter, spend-meter when present, and a cancel flag. In-flight calls are held against the caps under a short lock, so two runs near a cap cannot overshoot.

- A 401, 403 or account error fails the run and pauses other runs on the same adapter for 30 minutes.

- Remote fetches check every redirect hop and pin the connection to the checked address. They refuse private addresses and an https to http downgrade.

- Recordings go in a private directory with random names. If its guard files cannot be written, nothing is stored and the run fails. nginx sites must add a deny rule, because nginx ignores .htaccess, and the status screen warns if a test file is reachable.

- Transcript text is one line per segment in the prompt, so it cannot forge segment ids, and each prompt says the transcript is material, not instructions.

## What review changed

The independent code review found and fixed these before the merge:

- The spend-meter and gen-queue integrations did not match the released contracts. A failed call was released instead of recorded, the record had no status and used the wrong token keys, and release passed an extra argument. They were rebuilt against both plugins.

- Two runs could both pass the cap check before either call was recorded. In-flight calls are now held against the caps.

- Two processes could both take an expired run lock, because takeover was a delete then an add. It is now one conditional update. A failed usage insert also lost a paid call. The row is now buffered and written later.

- Hostile audio headers. A cut-short Xing field raised a warning, a non-syncsafe ID3 size hid the audio, and a WAV with self-contradicting fields was trusted for its length and for splitting. Header fields are now bounds-checked and the frame search has a time budget.

## Limits and what is next

- Only MP3 and WAV are split. A long Ogg, FLAC, M4A or WebM file must be within the provider's limits, or be converted.

- No video, no YouTube or other video sites, and no HTML episode pages.

- One bundled adapter, for the common synchronous multipart request. Submit-and-poll services need an adapter of your own. The runner supports them and a reference adapter is on the roadmap.

- One open issue: token usage is not recorded when a draft call fails inside llm-json-php, because the library's exception carries no counts, so failed calls are under-reported.

Test status: this is v0.1.0. There are 119 PHPUnit tests, run on stubs and mocks without WordPress and with the fake adapter, and it has not run on a live site. Static analysis and code style checks passed. With the fake adapter, a generated 61-minute MP3 gave 7 chunks and all 9,150 script words back after stitching, none duplicated. That is a test of the stitching logic and not a provider run. The GitHub CI workflow has not run: the commit adding it stayed local because the token lacked the workflow scope.

## Install

It needs PHP 8.1 or later with mbstring (intl recommended), and WordPress 6.4 or later. Composer also installs [llm-json-php](https://github.com/IndianOpinion/llm-json-php), the model caller for drafts.

cd wp-content/plugins
git clone https://github.com/IndianOpinion/audio-to-post.git
cd audio-to-post && composer install --no-dev

Without Composer, transcription, the transcript mode and exports work. The article and show_notes modes need a model caller, supplied through the audiopost_llm_caller filter.

[All 47 utilities](https://indianopinion.org/blog/open-source/) · [audio-to-post on GitHub](https://github.com/IndianOpinion/audio-to-post)

Canonical: https://indianopinion.org/blog/open-source/audio-to-post/

AI disclosure: Every summary and comment here is written by AI and published automatically, without a person reviewing each article. We do no original reporting. How this works: https://indianopinion.org/ai-use-policy/
