Developer Log Made by Rehan Bharwani Nov 29, 2026

YT Music
Manager·

System / Pipeline
yt-music-manager / Terminal
> yt-music-manager run --preset funky_lobby --minutes 60
[INFO] Step 1/5: Vision + OCR cat filter passed (1920x1080)
[INFO] Step 2/5: Composed & synthesized 51 tracks (16.8s)
[INFO] Step 3/5: Streaming 8s crossfade + progress bar MP4
[INFO] Step 4/5: Built 9:16 YouTube Short funnel (25.0s)
[SUCCESS] Uploaded main mix + Short + synced mood playlist
63m Mix Ready in ~76s

Engineering a 1-Hour Local Music Pipeline on 8 GB RAM

I wanted a completely automated, zero-API-cost pipeline that composes an hour of smooth background jazz or lobby funk, masters seamless crossfades, pairs the mix with a clean visual, generates a vertical Short funnel, and publishes everything to YouTube—without waiting hours per render or melting an 8 GB Apple Silicon machine.

Hitting the Autoregressive Bandwidth Wall

The initial prototype used facebook/musicgen-small on PyTorch MPS (float16). Generating 15 seconds of audio at batch=1 took 32.8 seconds (0.46x real-time), projecting over 2 hours to render a single 1-hour mix. Because MusicGen decodes sequentially at 50 frames per second across 4 codebooks, every 20 ms slice forces the GPU to stream ~600 MB of weights from unified memory.

Batching 4 prompts simultaneously lifted throughput 2.65x to 1.21x real-time (~49 minutes per hour), but sub-minute generation required changing the architecture entirely.

The Pivot: Symbolic Markov Composer + Parallel SoundFont Synthesis

Instead of predicting raw audio samples 50 times a second, I built a harmonic Markov chain over jazz functions (Imaj9, ii9, V13, tritone substitutions, and borrowed minor iv9) arranged into structured 32-bar AABA song forms with voice-led Rhodes voicings, bass octave pickups, sparse leads, and brushed drums. Rendering 45+ unique MIDI compositions in parallel via FluidSynth (GeneralUser_GS.sf2) and FFmpeg tape EQ dropped 64 minutes of stereo audio synthesis from 131 minutes down to 16.8 seconds.

O(1)-RAM Crossfades, Vision Filtering & Jitter-Free Overlays

Along the way, profiling exposed three subtle production bugs: repeated NumPy concatenate calls during 45-track crossfading triggered 14 GB of swap copies (fixed by streaming PCM16 frames directly to disk in O(1) memory); FFmpeg zoompan caused integer-rounding jitter on static frames (replaced with a single-pass bottom progress-bar overlay); and stock/API image fetchers returned meme text or occluded subjects (solved with Tesseract TSV OCR plus Apple Vision VNRecognizeAnimalsRequest bounding-box framing).

Tech Stack: Python 3.12, FluidSynth, FFmpeg, PyTorch / Transformers (MPS), Apple Vision, Tesseract OCR, YouTube Data API v3. View Repository ↗