📌 Part of Blueprint: AI Agent & Local GPU Automation → L4: Automated AIGC & Media Pipelines

Generating Full-Length Songs with YuE2 BF16: Overcoming Duration Limits and Audio Truncation

· 114 min read · Tutorials ai-musicyue2comfyuiaudio-engineeringsubtitlespython

Every generative music engine I have benchmarked suffers from the same fatal flaw: the sudden, unceremonious cutoff.

Whether you use cloud APIs or local weights, models trained on fixed acoustic token windows struggle the moment you give them a complete, narrative song structure. A 9-part progression—[Intro] -> [Verse 1] -> [Chorus] -> [Interlude] -> [Verse 2] -> [Chorus] -> [Bridge] -> [Chorus] -> [Outro]—inevitably collides with the hard ceiling of the generation buffer. The vocalist is mid-word in the climax, and the audio abruptly flatlines into digital silence.

After iterating across hundreds of takes on a dedicated 12GB VRAM on-premise inference node (RTX 3060), I architected an end-to-end production pipeline that stably generates full-length songs spanning 3 to 4.7 minutes (up to 283.1s) with complete 9-stage progression, natural acoustic fade-outs, and zero mid-phrase amputations.

Below is the breakdown of why standard generation fails, the 295-second headroom formula that fixes it, and the full collection of 60 completed full-length songs (with individual 1024×1024 cover art and synchronized scrolling lyrics).


The Problem: The 240-Second Wall

In earlier batches, songs generated via standard ComfyUI text-to-music nodes frequently exhibited one of two failure modes:

  1. The Chopped Outro: Setting max_duration = 240.0s while feeding a full lyric sheet resulted in the track hitting the final timestamp while the acoustic model was still executing the chorus. All 12 initial test runs ended at exactly 240.000s—an unusable hard cliff.
  2. The Panic Accelerando: If you prompt the model to fit too many lines into a tight window, the auto-regressive acoustic token predictor compresses the vocal pacing, turning an emotional Celtic ballad into an unnatural rap cadence.

The fundamental mistake was treating max_duration as the desired song length. In generative auto-regressive audio, max duration is not your target length; it is your acoustic safety wall.

The Three Architecture Fixes

Engineering MetricV1 Naive Pipeline (max_duration=240s)V2 Production Pipeline (295s Headroom + Gate)Architecture Gain
Natural Fade-Out Yield0 / 12 (0.0%)60 / 60 (100.0% Gate Passed)Eliminates manual acoustic auditing costs
Finished Duration DistributionDeadlocked at 240.000s129.9s ~ 283.1s (up to 4m43s)Breathes naturally with genre BPM and dynamics
Continuous Batch VRAM StabilityCUDA OOM crash at track 4~560 tracks unattended with zero failuresProactive VRAM defragmentation lifecycle

1. The 295.0s Headroom Formula

To produce songs that naturally conclude around a 4-minute runtime, you must structure the lyric density for 210s to 260s, while provisioning the generator with a 295.0s ceiling:

$$ ext{Headroom Buffer} = ext{Max Duration (295s)} - ext{Expected Lyric Duration (220s)} pprox 75 ext{s}$$

This ~75-second buffer provides the acoustic model with the token budget required to:

2. Automated Hard-Cut Quarantine Gate

In an unattended batch pipeline, human listening checks do not scale. Any take whose generated duration measures within 1.0s of the hard ceiling (>= 294.0s) or exhibits missing end-of-sequence silence is treated as an unresolved truncation failure and automatically quarantined for re-queueing with a new seed. Only takes that resolve naturally before the ceiling (120.0s <= duration < 294.0s) pass into the mastering and LRC alignment stage. Across our 60-song production run, all 60 finalized masters resolved cleanly between 129.9s and 283.1s with zero abrupt cutoffs.

pipeline/quarantine_gate.py (38 lines) — Automated ffprobe duration gate & ComfyUI VRAM flush
import json
import subprocess
import urllib.request
from pathlib import Path

CEILING_SECONDS = 295.0
QUARANTINE_THRESHOLD = 294.0
MIN_VALID_DURATION = 120.0
COMFY_API_URL = "http://127.0.0.1:8188"

def probe_audio_duration(audio_path: Path) -> float:
    cmd = [
        "ffprobe", "-v", "error",
        "-show_entries", "format=duration",
        "-of", "json", str(audio_path)
    ]
    result = subprocess.run(cmd, capture_output=True, text=True, check=True)
    payload = json.loads(result.stdout)
    return float(payload["format"]["duration"])

def release_comfy_vram() -> None:
    req = urllib.request.Request(
        f"{COMFY_API_URL}/free",
        data=json.dumps({"unload_models": True, "free_memory": True}).encode("utf-8"),
        headers={"Content-Type": "application/json"},
        method="POST",
    )
    urllib.request.urlopen(req, timeout=10)

def validate_and_gate_take(audio_path: Path, quarantine_dir: Path) -> bool:
    duration = probe_audio_duration(audio_path)
    release_comfy_vram()
    if duration >= QUARANTINE_THRESHOLD or duration < MIN_VALID_DURATION:
        target = quarantine_dir / f"REJECTED_{duration:.1f}s_{audio_path.name}"
        audio_path.rename(target)
        return False
    return True

3. VRAM Lifecycle Management on a 12GB Production Node

Running YuE2-3B in BF16 on a cost-optimized 12GB VRAM self-hosted production node requires strict memory lifecycle hygiene to prevent fragmentation across multi-hour runs:

# Launch ComfyUI production worker with deterministic VRAM allocation
cd /opt/ai-pipelines/comfyui-worker
./python_embeded/python.exe -s ComfyUI/main.py \
  --windows-standalone-build \
  --port 8188 \
  --disable-pinned-memory \
  --cache-classic

By enforcing immediate model unloading via the /free endpoint after each batch execution and eliminating pinned memory overhead, continuous generation of 4.5-minute sequences remains rock-solid without triggering CUDA out-of-memory faults.


The 60 Full-Length Song Archive

All 60 tracks below were generated locally with YuE2 BF16, tagged with clean ID3v2.3 metadata, paired with custom 1024×1024 Gemini-rendered full-bleed cover art (converted to WebP), and hosted on CDN with HTTP 206 range-seeking support.

Tip: Use the interactive selector above to jump directly to any track.

The Thimble Under the Moss cover art
01. The Thimble Under the Moss MP3 3m 11s (191.1s) · Celtic Folk · Crisp Youthful Treble Vocal (Cécile Corbel style) | Upbeat Tempo (~105 BPM)

Mist of Skellig Michael cover art
02. Mist of Skellig Michael MP3 4m 26s (266.2s) · Celtic Folk · Ethereal Youthful Solo (Enya style with pure treble vocal) | Slow & Atmospheric (~72 BPM)

The Rose of Connemara cover art
03. The Rose of Connemara MP3 4m 43s (283.1s) · Celtic Folk · Pure Youthful Solo (Early Cara Dillon style) | Mid-Slow Narrative (~82 BPM)

Lanterns on the Moor cover art
04. Lanterns on the Moor MP3 3m 31s (211.2s) · Celtic Folk · Playful Sprite-like Female Vocal (Upbeat Cécile Corbel style) | Fast 3/4 Waltz (~128 BPM)

The Weaver of Raglan Lane cover art
05. The Weaver of Raglan Lane MP3 4m 39s (279.3s) · Celtic Folk · Warm Resonant Celtic Folk Baritone (Luke Kelly style) | Mid-Slow (~80 BPM)

硝子の花束 cover art
06. 硝子の花束 MP3 3m 49s (230.0s) · Japanese Healing · Pure Airy Anime Soprano with Delicate Vulnerability (Inori style) | Mid-Slow Piano & Strings (~78 BPM)

銀の時計塔と宵の歌 cover art
07. 銀の時計塔と宵の歌 MP3 4m 34s (274.8s) · Japanese Healing · Luminous Soprano Vocal with Kajiura-style Chanting | Mid-Tempo 3/4 Waltz (~110 BPM)

森の郵便屋さん cover art
08. 森の郵便屋さん MP3 3m 44s (225.0s) · Japanese Healing · Ultra-Gentle Whispered Youthful Vocal | Slow Acoustic Guitar & Harp (~68 BPM)

白鳥の祈り cover art
09. 白鳥の祈り MP3 4m 06s (246.3s) · Japanese Healing · Ethereal High Soprano with Expansive Reverb | Slow Cinematic Orchestral (~70 BPM)

星屑のオルゴール cover art
10. 星屑のオルゴール MP3 3m 31s (211.8s) · Japanese Healing · Sweet Youthful Anime Soprano | Mid-Slow Light Ballad (~88 BPM)

ひまわり行進曲 cover art
11. ひまわり行進曲 MP3 3m 18s (198.0s) · Japanese Energetic · High-Energy Youthful Solo with Chorus Accents | Fast Upbeat Pop (~118 BPM)

プリンは世界を救うのだ! cover art
12. プリンは世界を救うのだ! MP3 3m 23s (203.4s) · Japanese Energetic · Bright Anime-Style Soprano Vocal (Fast, Dense Cadence) | High-Tempo Electro-Pop (~145 BPM)

こねこ探偵団のテーマ cover art
13. こねこ探偵団のテーマ MP3 2m 16s (136.1s) · Japanese Energetic · Playful Childlike Vocal (Ages 6–8 Character Voice) | Upbeat Swing Nursery Rhyme (~115 BPM)

夏祭りのラムネ星 cover art
14. 夏祭りのラムネ星 MP3 3m 14s (195.0s) · Japanese Energetic · Bright Youthful Duet (Tenor & Soprano Harmonies) | Fast Summer Anime Pop (~122 BPM)

ほうきに乗って宅配便 cover art
15. ほうきに乗って宅配便 MP3 3m 16s (196.1s) · Japanese Energetic · Crisp Sunny Youthful Vocal | Mid-Tempo Vintage J-Pop (~116 BPM)

白露·竹间灯 cover art
16. 白露·竹间灯 MP3 3m 42s (222.6s) · Chinese Guofeng · Sweet Melodic Youthful Vocal | Mid-Tempo Electro-Guofeng (~108 BPM)

小鲤跃龙门 cover art
17. 小鲤跃龙门 MP3 2m 09s (129.9s) · Chinese Guofeng · Lively Playful Treble Vocal (Fast Lyric Cadence) | Mid-Fast Folk Pop (~120 BPM)

云海归鲲 cover art
18. 云海归鲲 MP3 3m 56s (236.9s) · Chinese Guofeng · Ethereal Classical Falsetto / Bel Canto Male Vocal | Slow Ambient Ballad (~68 BPM)

纸伞巷 cover art
19. 纸伞巷 MP3 3m 34s (214.6s) · Chinese Guofeng · Gentle Melodic Soprano with Jiangnan Ditty Charm | Mid-Slow Guofeng (~80 BPM)

山间小道士 cover art
20. 山间小道士 MP3 3m 07s (187.6s) · Chinese Guofeng · Pure Unadorned Youthful Vocal | Mid-Tempo Guofeng Acoustic (~105 BPM)

橘子汽水的夏天 cover art
21. 橘子汽水的夏天 MP3 2m 48s (169.0s) · Gentle Acoustic · Clear Youthful Solo Vocal | Mid-Slow Acoustic Guitar Ballad (~82 BPM)

外婆的小院 cover art
22. 外婆的小院 MP3 3m 32s (212.4s) · Gentle Acoustic · Tender Gentle Childlike Vocal | Slow Nostalgic Ballad (~72 BPM)

开往北方的绿皮车 cover art
23. 开往北方的绿皮车 MP3 3m 36s (216.3s) · Gentle Acoustic · Deep Warm Folk Baritone | Slow Acoustic Narrative (~75 BPM)

写给流浪猫的信 cover art
24. 写给流浪猫的信 MP3 2m 09s (129.9s) · Gentle Acoustic · Playful Tender Youthful Vocal | Upbeat Ukulele & Acoustic Guitar (~98 BPM)

平凡的傍晚 cover art
25. 平凡的傍晚 MP3 3m 41s (221.0s) · Gentle Acoustic · Gentle Healing Young Male Vocal | Slow Piano & Acoustic Guitar (~74 BPM)

Light of the Eventide cover art
26. Light of the Eventide MP3 4m 09s (249.0s) · Angelic Choir · Sublime Treble Solo with Pure Youth Choir | Solemn Hymn (~66 BPM)

Bells of the Winter Star cover art
27. Bells of the Winter Star MP3 2m 47s (167.6s) · Angelic Choir · Crisp Multi-Part Youth Choir Polyphony & Canon | Dynamic 3/4 Meter (~125 BPM)

Paper Planes in the Wind cover art
28. Paper Planes in the Wind MP3 3m 25s (205.5s) · Angelic Choir · Luminous Youth Solo with Collegiate Choir Harmonies | Warm Mid-Tempo (~96 BPM)

Lullaby of the Little Star cover art
29. Lullaby of the Little Star MP3 3m 47s (227.8s) · Angelic Choir · Pure Unadorned Youthful Solo | Gentle Lullaby (~70 BPM)

Hymn of the Morning Meadow cover art
30. Hymn of the Morning Meadow MP3 4m 19s (259.9s) · Angelic Choir · Sacred Treble Solo with Expansive Choral Harmony (Pachelbel Canon Progression) | Slow Uplifting (~72 BPM)

地板下的借物小人 cover art
31. 地板下的借物小人 MP3 3m 07s (187.7s) · Celtic Folk (ZH) · Crisp Youthful Treble Vocal | Upbeat Celtic Harp & Tin Whistle (~105 BPM)

迷雾孤岛的竖琴 cover art
32. 迷雾孤岛的竖琴 MP3 3m 24s (204.4s) · Celtic Folk (ZH) · Ethereal Youthful Solo | Slow & Atmospheric Celtic Ballad (~70 BPM)

石楠花开的高地 cover art
33. 石楠花开的高地 MP3 3m 36s (216.9s) · Celtic Folk (ZH) · Pure Youthful Solo | Mid-Slow Acoustic Guitar & Celtic Fiddle (~82 BPM)

橡树下的萤火舞会 cover art
34. 橡树下的萤火舞会 MP3 3m 43s (223.1s) · Celtic Folk (ZH) · Playful Sprite-like Female Vocal (Fast Cadence) | Fast 3/4 Waltz (~128 BPM)

老航海家的绿宝石 cover art
35. 老航海家的绿宝石 MP3 3m 49s (229.8s) · Celtic Folk (ZH) · Warm Resonant Celtic Folk Baritone | Mid-Slow Acoustic (~80 BPM)

玻璃温室的告别 cover art
36. 玻璃温室的告别 MP3 3m 37s (217.0s) · Japanese Healing (ZH) · Pure Airy Anime Soprano with Delicate Vulnerability | Mid-Slow Piano & Strings (~78 BPM)

银色钟塔与暮光咏叹 cover art
37. 银色钟塔与暮光咏叹 MP3 4m 01s (241.4s) · Japanese Healing (ZH) · Luminous Soprano Vocal with Conlang Chants | Classical Gothic Waltz (~110 BPM)

森林邮差的蒲公英 cover art
38. 森林邮差的蒲公英 MP3 3m 26s (206.7s) · Japanese Healing (ZH) · Ultra-Gentle Whispered Youthful Vocal | Slow Acoustic Guitar & Celesta (~68 BPM)

白鸟与雪原的祈愿 cover art
39. 白鸟与雪原的祈愿 MP3 3m 39s (220.0s) · Japanese Healing (ZH) · Ethereal High Soprano with Expansive Reverb | Slow Cinematic Orchestral (~70 BPM)

发条星尘八音盒 cover art
40. 发条星尘八音盒 MP3 3m 18s (198.2s) · Japanese Healing (ZH) · Sweet Youthful Anime Soprano | Mid-Slow Music Box & Guitar (~88 BPM)

向日葵小队出发 cover art
41. 向日葵小队出发 MP3 2m 39s (159.4s) · Japanese Energetic (ZH) · High-Energy Youth Solo with Chorus Accents | Fast Upbeat Pop (~118 BPM)

焦糖布丁保卫战! cover art
42. 焦糖布丁保卫战! MP3 3m 38s (218.9s) · Japanese Energetic (ZH) · Bright Anime-Style Soprano Vocal (Fast, Dense Cadence) | High-Tempo Electro-Pop (~145 BPM)

猫咪侦探事务所 cover art
43. 猫咪侦探事务所 MP3 2m 31s (151.4s) · Japanese Energetic (ZH) · Playful Childlike Vocal (Ages 6–8 Character Voice) | Upbeat Xylophone & Brass (~115 BPM)

夏夜烟火与波子汽水 cover art
44. 夏夜烟火与波子汽水 MP3 3m 07s (187.8s) · Japanese Energetic (ZH) · Bright Youthful Duet (Tenor & Soprano Harmonies) | Fast Summer Anime Pop (~122 BPM)

骑上扫帚送快递 cover art
45. 骑上扫帚送快递 MP3 3m 08s (188.5s) · Japanese Energetic (ZH) · Crisp Sunny Youthful Vocal | Mid-Tempo Guitar & Tambourine (~116 BPM)

小满·青梅煮雨 cover art
46. 小满·青梅煮雨 MP3 3m 34s (214.9s) · Chinese Guofeng New · Sweet Melodic Youthful Vocal | Mid-Tempo Electro-Guofeng (~106 BPM)

糖画摊前的小狐仙 cover art
47. 糖画摊前的小狐仙 MP3 3m 12s (192.2s) · Chinese Guofeng New · Lively Playful Treble Vocal (Fast Lyric Cadence) | Mid-Fast Guofeng (~124 BPM)

鲛人泪·沧海月 cover art
48. 鲛人泪·沧海月 MP3 3m 59s (239.8s) · Chinese Guofeng New · Ethereal Classical Falsetto / Bel Canto Male Vocal | Slow Ambient Guofeng (~68 BPM)

兰亭旧墨 cover art
49. 兰亭旧墨 MP3 3m 49s (229.3s) · Chinese Guofeng New · Gentle Melodic Soprano | Mid-Slow Guzheng & Erhu (~80 BPM)

采药小童下山记 cover art
50. 采药小童下山记 MP3 3m 24s (204.4s) · Chinese Guofeng New · Pure Unadorned Youthful Vocal | Mid-Tempo Bamboo Flute & Guitar (~104 BPM)

晒太阳的旧毛衣 cover art
51. 晒太阳的旧毛衣 MP3 3m 04s (184.9s) · Gentle Acoustic New · Clear Youthful Solo Vocal | Mid-Slow Acoustic Guitar Ballad (~80 BPM)

奶奶的桂花糕 cover art
52. 奶奶的桂花糕 MP3 3m 42s (222.4s) · Gentle Acoustic New · Tender Gentle Childlike Vocal | Slow Harmonica & Acoustic Guitar (~72 BPM)

北方的末班渡轮 cover art
53. 北方的末班渡轮 MP3 3m 49s (229.6s) · Gentle Acoustic New · Deep Warm Folk Baritone | Slow Acoustic Narrative (~74 BPM)

云朵收集指南 cover art
54. 云朵收集指南 MP3 2m 56s (176.4s) · Gentle Acoustic New · Playful Tender Youthful Vocal | Mid-Tempo Gentle Acoustic (~98 BPM)

街角二十四小时书店 cover art
55. 街角二十四小时书店 MP3 4m 13s (253.4s) · Gentle Acoustic New · Gentle Healing Young Male Vocal | Slow Piano & Acoustic Guitar (~74 BPM)

暮光归途 cover art
56. 暮光归途 MP3 4m 02s (242.6s) · Angelic Choir (ZH) · Sublime Treble Solo with Pure Youth Choir | Solemn Pipe Organ & Strings (~66 BPM)

冬夜银铃 cover art
57. 冬夜银铃 MP3 2m 59s (179.0s) · Angelic Choir (ZH) · Crisp Multi-Part Youth Choir Polyphony & Canon | Dynamic 3/4 Meter (~125 BPM)

迎风飞翔的纸飞机 cover art
58. 迎风飞翔的纸飞机 MP3 3m 53s (233.2s) · Angelic Choir (ZH) · Luminous Youth Solo with Collegiate Choir Harmonies | Warm Mid-Tempo (~96 BPM)

小星星的晚安曲 cover art
59. 小星星的晚安曲 MP3 3m 51s (232.0s) · Angelic Choir (ZH) · Pure Unadorned Youthful Solo | Slow Harp & Violin Lullaby (~70 BPM)

晨曦草地的赞美诗 cover art
60. 晨曦草地的赞美诗 MP3 4m 26s (266.0s) · Angelic Choir (ZH) · Sacred Treble Solo with Expansive Choral Harmony (Canon Progression) | Slow Uplifting (~72 BPM)


Need an Automated AI Media Pipeline for Your Business?

Cloud generative APIs charge per-second or per-generation fees that quickly erode margins at scale—and still fail when you need deterministic duration control, batch quality gates, or strict brand consistency.

I architect and deploy self-hosted, zero-marginal-cost AI media and automation pipelines on dedicated on-premise or private cloud infrastructure for SMEs and digital product teams:

Let’s discuss your infrastructure or automation bottleneck:

💼 Work With Me

Looking for high-impact engineering work or custom systems?

From front-end web apps down to edge proxies and container automation. Open to serious freelance client projects and senior engineering roles.

Lee Teong Hoe

Lee Teong Hoe · Mr Hoelee

Full-stack developer & DevOps engineer based in Malaysia. I run my own production infrastructure and build web systems for small businesses — this blog is the living record.

Hiring? Profile & stack · Malaysian SME? Website design & development ↗ · All posts