Repository source: docs/plans/audio_files/audio_files_step1_solution_assessment.md
Audio files: Step 1 solution assessment
Cycle: v3/audio_files. New cycle, staged. It follows the layered interface (PR #558) and touches nothing in it.
Original Query
"We probably need to support audio files soon."
"Is there anything that we're working on that would stop us from doing like a step one right now?" (Nothing was running; Ilya said "Yes, please.")
"The thing that is like at the top of my mind is file format support, I guess, and like a usable web player."
Understood Intent
Rap Club members should be able to attach their own recordings to a post, such as a verse, a beat or a voice memo, and anyone should be able to play them on the site, phones included, without uploading them somewhere else first. Ilya's two main concerns are which file formats work and whether the player is pleasant to use.
Problem
Today a track must live on YouTube, SoundCloud or a similar service, and the site can only link to it or embed it. A raw recording from a phone or a studio session has no way onto the site.
Concepts touched
Image serving: used as the pattern (hash-named files outside Git, a signed post names them, a size cap and a store cap). Unchanged.
Media embed: changed. The play bar would also play attached audio.
Music section: changed. A track could be an upload as well as a link.
Audio attachment: proposed, a new concept.
Option A - accept only what browsers already play
Members attach one file per post, stored like images: kept outside Git under its hash, with the signed post naming it. The site accepts only formats that every current browser plays without help, MP3 and M4A (AAC). That covers iPhone voice memos, most phone recorders and DAW exports. Anything else is refused with a plain message such as "Export as MP3 or M4A". The player is the existing media-embed play bar, wired to a native audio element.
Pros: no new server software; the stored file is exactly what was signed; the smallest slice; it plays on iPhone.
Cons: WAV, FLAC, AIFF and OGG files are refused, so some members must convert first; full-length WAV masters will hit the size cap anyway.
Option B - accept anything, convert on the server
The site accepts common formats (WAV, FLAC, AIFF, OGG, Opus, MP3, M4A) and the server makes one playable copy, as it makes image copies today. The original stays as signed.
Pros: members upload whatever their software exports; one consistent copy to stream.
Cons: it needs a converter on the server (ffmpeg or similar), against v3's minimal-dependency habit and hard on shared hosting; conversion is slow and needs a queue; storage doubles.
Option C - convert in the browser before upload
The page converts the file to a playable format before sending, the way it shrinks photos now.
Pros: no server software; smaller uploads.
Cons: audio encoding in the browser is heavy and uneven, worst on iPhone Safari; it would need a large encoder script; it fails without JavaScript.
Player (applies to every option)
Two choices:
Native controls: the browser's own player. It is reliable and accessible, and it works without scripts, but it looks different in every browser and clashes with themes.
The site's play bar: the existing media-embed bar with play/pause, a seek line and the time, styled by the theme, falling back to native controls without scripts. Only one track plays at a time, as with embeds today.
Recommendation: the site's play bar with the native fallback. It matches how Music already looks, and the fallback keeps it usable everywhere.
Recommendation
Option A with the site's play bar. It is a working vertical slice: attach an MP3 or M4A to a post, see it in the thread and on /tracks/, and play it on a phone. Option B can follow if members keep hitting the format wall. Option A's storage and signing would carry over unchanged.
Open questions for Ilya:
~~Size cap per file.~~ Answered by Ilya (Dec 4, by voice): three minutes at most (he said seven, then five, then three). Three minutes at the highest common MP3 quality (320 kbps) is about 7 MB, so the plan is a 3-minute limit with an 8 MB file cap behind it. The browser checks the length before upload and the server checks the size, so where scripts run, a long, low-quality file is still refused for its length.
~~Who may upload.~~ Answered by Ilya: the same people as for images, using the same permission check.
~~Download or play only.~~ Answered by Ilya: downloading is allowed. The player gets a plain Download link.
~~Uploads in Friday's queue.~~ Answered by Ilya: yes, uploads first, but only for recent tracks. The queue plays uploads from the past 14 days first, so the previous meeting is covered too (Ilya first said a week and a half), then everything else (links, and older uploads) in the order it was shared.
Revised direction (Ilya, by voice)
Ilya asked whether the browser could test itself and convert other formats on the spot, the way it shrinks photos. The recommendation becomes Option A with part of Option C:
MP3 and M4A go up as they are. This is the common case, since iPhone recordings are already M4A.
For any other format (WAV, FLAC, AIFF, OGG), the page first checks whether this browser can decode and re-encode audio, and runs a short timed trial. If the browser passes, it converts the file to M4A or MP3 before upload. If not, the page asks the member to export as MP3 or M4A, as in Option A.
iPhone Safari is the weak spot: its encoding support is limited, and a full converter in the page uses a lot of memory. Step 2 should state which browsers get conversion and which get the export message, based on that check.
Order of attempts: as is (MP3/M4A) → browser conversion → "please export as MP3 or M4A".
Server conversion (Option B) is a to-do, not part of this cycle. Ilya first added it, then asked how often it would be needed. It would rarely be needed, because phones record M4A and most music is already MP3. The case it covers is a producer exporting WAV or FLAC from a device whose browser cannot convert. Add it if members run into that.
Suggested slices, each usable on its own: (1) MP3/M4A upload, the play bar with Download, and the Friday queue order; (2) browser conversion with its check.
To-do
Server conversion of other formats when ffmpeg is installed, with the original kept as signed and Tools showing whether the converter is present. Deferred by Ilya on Dec 4: build it if members hit the format wall.
— Claude · 2026-12-04 UTC
Approval
Approved Step 1 on 2026-12-04 by Ilya, by voice while driving ("Approve step one"). Direction: Option A with browser conversion (part of C); server conversion (B) deferred as a to-do. First slice: MP3/M4A upload, the play bar with Download, and the Friday queue order.