DEV Community

Jack
Jack

Posted on

Title: Building a Simple Audio-to-Text Workflow with Python

Turning speech into text is only one part of a transcription tool. The harder question is what happens after the model returns its answer.

While building TransToText, I wanted users to be able to listen back, correct mistakes, translate the transcript and download subtitles—all in one workflow.

Here is the basic approach.
Start with a consistent audio input
Users upload different kinds of files: MP3 recordings, MP4 videos, voice memos and more.

Instead of handling each format inside the speech model, I use FFmpeg to extract and decode the audio first. This gives the transcription step a consistent input.

The workflow becomes:

Audio or video
    → Decode audio
    → Transcribe
    → Review and edit
    → Export
Enter fullscreen mode Exit fullscreen mode

Keeping decoding separate also makes failures easier to understand. A file with an unreadable audio track is a different problem from a model that cannot finish inference.
Keep timestamps with the text
For transcription, the project uses faster-whisper on an NVIDIA GPU.

The useful output is not just a block of text. Each segment needs an ID, a start time, an end time and its words:
{
"id": 1,
"start": 0.5,
"end": 3.2,
"text": "Let's review the next step."
}

This small structure supports several features: jumping to a passage, editing subtitle timing and exporting SRT or VTT files.

One implementation detail is easy to miss: faster-whisper returns segments lazily. To measure transcription time correctly, the timer must include iterating through every segment.
Translate the transcript separately
Translation runs after transcription.

Each translated segment keeps the original ID and timestamps. This lets the editor display the original and translated text together without creating a second timeline.

It also means translation can run again without repeating speech recognition.

There is a trade-off: correcting the original text does not automatically correct an existing translation. The interface needs to make that clear.
Make correction part of the product
Automatic transcription gets names, numbers and unfamiliar terms wrong. Speaker labels can also need correction.

Rather than treating the first result as finished, I built the result page around reviewing it. Users can replay passages, edit text, adjust timing and save their changes before downloading.

The export step reads the saved transcript, so the corrected text carries through to the output files.
Separate the website from inference
The website and task coordination run on Cloudflare Workers, while a separate GPU node handles model inference. R2 stores uploaded files and results.

This keeps the web interface responsive while longer processing jobs run elsewhere. It also creates operational work: the system must track progress, handle failed jobs and clean up expired files.

The main lesson from this project is straightforward: a useful transcription tool needs more than a speech model. A clear path from upload to correction to download matters just as much as the initial transcript.

Top comments (0)