LiveSort
Back to App返回应用
Documentation文档

The Art of Arrangement 编排的艺术

A unified explanation of how LiveSort shapes pacing, emotion and smooth transitions. 统一展示 LiveSort 如何组织节奏、情绪与平滑过渡。

Design Philosophy设计哲学

LiveSort 的诞生源于一个简单的想法:如何让杂乱无章的日常歌单,带来如同亲临演唱会现场般的沉浸体验?

一场优秀的演唱会,其歌单绝不是随机播放的。它讲究“一收一发”,用抓耳但渐进的歌曲开场,在中间穿插节奏与抒情,避免观众因持续的高潮而情绪疲劳,也不会因为一直抒情而感到沉闷,最终以温暖的歌曲完美收尾。LiveSort 试图通过音频特征分析与算法编排,在本地重现这种情绪的起伏。

LiveSort was born from a simple idea: how can we transform a chaotic everyday playlist into an immersive experience that feels like a live concert?

A great concert setlist is never random. It relies on tension and release—starting with a catchy but progressive opening, alternating between rhythmic and lyrical tracks in the middle to prevent emotional fatigue, and concluding with a warm, resolving finale. LiveSort uses audio feature extraction and algorithmic arrangement to recreate this emotional journey locally.

The Interest Curve优秀兴趣曲线

万物皆有递归性。一首单曲的情绪设计(Hook开头 → 主歌铺垫 → 副歌小高潮 → 间奏过渡 → 最终高潮 → 收尾)同样适用于整场演唱会的宏观编排。

我们引入了著名的“优秀兴趣曲线 (The Interest Curve)”。在游戏设计和叙事学中,这条曲线被认为是最能抓住受众注意力的节奏模式。应用在歌单中,它的关键节点包括:

  • Hook (引子):开场立刻抓住注意力。
  • Valley (谷底):情绪回落,为后续积蓄能量。
  • Rising Peaks (波峰与波谷):交替上升的节奏,每次高潮都比上一次更强烈。
  • Climax (高潮):全场情绪的最高点。
  • Outro (收尾):迅速而温暖地结束,留下余韵。

Everything is recursive. The emotional design of a single track (Hook → Verse build-up → Chorus → Bridge → Final Climax → Outro) applies equally to the macro-arrangement of a full concert.

We introduced the famous "Interest Curve". Widely used in game design and narratology, this curve represents the optimal rhythm to maintain audience engagement. Translated to a playlist, its key nodes are:

  • Hook: Grabs attention immediately at the start.
  • Valley: A drop in intensity to build potential energy.
  • Rising Peaks: Alternating highs and lows, with each peak stronger than the last.
  • Climax: The absolute emotional peak of the setlist.
  • Outro: A swift, warm resolution that leaves a lasting impression.

Audio Features Extraction音频特征提取

为了将歌曲匹配到兴趣曲线上,LiveSort 采用浏览器端分析链路:通过 Web Audio API 在本地解码并提取音频特征。我们不仅提取整首歌曲的平均特征,还专门提取首尾15秒的特征,以确保歌曲之间的平滑过渡。

当前版本不依赖 Python 后端。网易云 .ncm 文件会在浏览器内本地解密并转换为可分析音频后,进入同一特征提取流程,无需手动转码。

  • BPM (节拍率):决定歌曲的物理速度。
  • Energy (RMS能量):衡量歌曲的响度和饱满度。
  • Brightness (频谱质心):反映声音的明亮程度(低沉还是高亢)。

To map songs to the interest curve, LiveSort now uses a browser-side pipeline: audio is decoded locally through the Web Audio API, then features are extracted in the same runtime. We analyze both whole-track averages and the first/last 15 seconds for smoother transitions.

The current version does not require a Python backend. NetEase .ncm files are decrypted and converted locally in the browser, then sent through the same feature-extraction flow.

  • BPM (Tempo): Determines the physical speed of the song.
  • Energy (RMS): Measures the loudness and fullness of the track.
  • Brightness (Spectral Centroid): Reflects how bright or dark the sound is.

Sorting Algorithm排序算法

LiveSort 的核心是一个贪心优化算法。对于播放列表中的每一个位置,算法会计算剩余所有候选歌曲的“代价函数 (Cost Function)”,并选择代价最小的歌曲填入该位置。

代价函数综合考虑了三个权重因素:

  1. 情绪贴合度 (最高权重):候选歌曲的情绪得分与“兴趣曲线”当前位置理想得分的绝对差值。
  2. BPM 衔接度:上一首歌结尾的 BPM 与候选歌曲开头的 BPM 的比例。完美衔接(1:1)或倍速衔接(1:2,例如 60 BPM 接 120 BPM)会获得极低的惩罚代价。
  3. 能量平滑度:上一首歌结尾的能量与候选歌曲开头的能量差异,避免听感上的突兀。

The core of LiveSort is a greedy optimization algorithm. For each position in the playlist, the algorithm calculates a "Cost Function" for all remaining candidate songs and selects the one with the lowest cost.

The cost function weighs three main factors:

  1. Emotion Fit (Highest Weight): The absolute difference between the candidate's emotion score and the ideal score on the Interest Curve at that position.
  2. BPM Transition: The ratio between the previous song's ending BPM and the candidate's starting BPM. Perfect matches (1:1) or double/half-time matches (e.g., 60 BPM to 120 BPM) receive very low penalty costs.
  3. Energy Smoothness: The difference in energy between the end of the previous song and the start of the next, preventing jarring auditory jumps.

Seamless无感过渡

无感过渡的目标很简单:让两首歌的交接更自然,不突兀。系统会在前一首快结束时,提前把下一首轻柔接入,整个过渡大约 10 秒左右。

  1. 自动找时机:系统会判断前一首尾段状态,选择更合适的切入点,不会生硬“硬切”。
  2. 音量自动平衡:自动控制两首歌的重叠音量,避免突然变大声或听起来太吵。
  3. 效果平滑过渡:EQ 和混响是渐进变化,不会一瞬间把音色改得很夸张。
  4. 保留下一首开头细节:尽量让下一首的前奏清晰可听,不被前一首尾声盖住。

你可以把它理解为一个“更聪明的淡入淡出”:该提前就提前,该轻一点就轻一点,目标就是让整段听感连贯、舒服。

Seamless has one simple goal: make song handoffs feel smooth. LiveSort brings in the next track a little before the current one ends, with a transition of around 10 seconds.

  1. Smart timing: it chooses a better moment to blend, instead of forcing a hard cut.
  2. Automatic volume balance: overlap loudness is controlled to avoid sudden spikes.
  3. Smooth effect changes: EQ and reverb shift gradually, not abruptly.
  4. Clear next intro: it tries to keep the next song’s opening details audible.

Think of it as a smarter fade in/out: start earlier when needed, stay gentle when needed, and keep the listening experience natural.