Repository source: docs/concepts/audio_attachment.md
Audio attachment
Purpose: Let members put their own short recordings on the site, a verse, a beat or a voice memo, and let anyone play them, phones included, without hosting them somewhere else first.
Scenario: On mitrapclub with FORUM_AUDIO_CONTENT_ENABLED on, an approved member opens the composer's ··· menu, taps "Attach audio" and picks a voice memo from their iPhone. The page checks it on the device (MP3 or M4A by its bytes, up to seven minutes and 18 MiB on MIT Rap Club and three minutes and 8 MiB on other profiles) and shows the filename and "0:42 · 612 KiB" in one row. The member can select Remove to clear the attachment or use Replace audio in the compose menu. On MIT Rap Club, a WAV or a recording over the duration or file-size limit gets "Export as MP3 or M4A, at most 7 minutes and 18 MiB." and nothing is signed. They post. The browser adds an Audio-v1: line naming the file's hash, type, size and length to the signed post, and uploads the file beside it. The thread shows the site's play bar (play/pause, a seek line, the time) and a Download link; only one recording or embed plays at a time. On /tracks/ the row plays the recording, and on Friday the queue plays this fortnight's uploads first, then everything else, newest first.
Sources: reference (source unavailable), inspector (source unavailable) and store (source unavailable), write path (source unavailable) (assertAudioAuthor, createPreparedPost), upload API (source unavailable), serving (source unavailable), renderer (source unavailable) (renderAudio), composer (source unavailable) and check script (source unavailable), signing (source unavailable), play bar (source unavailable), Music queue (source unavailable) (playable), plan.
Files live outside Git and the web folder, named by their hash (FORUM_AUDIO_ROOT, default <repository>-audio), with their own cap of 512 MiB and 512 files. The server reads the type and length from the bytes again and refuses anything that doesn't match the signed line, so the browser check is for a quick answer, not for safety. Only approved members may attach audio, the same rule as images; anonymous posts, queued inline replies and the Outbox refuse it. /audio/<hash>.<mp3|m4a> answers byte ranges because iPhone Safari won't play or seek without them, and ?download=1 sends it as a download. Deleting a post deletes its file unless another post names the same hash.
Not yet: converting other formats in the browser (the next cycle), converting on the server (a to-do), audio in image backups, and quill.py --audio.