-
-
Notifications
You must be signed in to change notification settings - Fork 5
Best Mix
Best Mix reorders a queue so consecutive tracks sit well together, using tempo and musical key rather than the order you happened to add them in.
Where Smart Crossfade decides how to join two tracks, Best Mix decides which tracks end up adjacent.
Trigger Best Mix from the queue. Orchard analyzes the queue, ranks candidate orderings, and rewrites the queue in place. The currently playing track stays where it is; sorting applies to what comes after.
Best Mix operates on up to 50 tracks at a time. Longer queues are handled in that window rather than attempting a global reorder of hundreds of items.
Best Mix scores each possible adjacency from two sources:
- Local analysis, the same tempo, key, and energy data Smart Crossfade produces. See Smart Crossfade.
- Catalog metadata, tempo and key looked up through Orchard's BPM worker, which is backed by GetSongBPM.
Learned audio profiles from the Audio Engine also feed in, and a cloud analysis batch fetch fills gaps where a track has been analyzed elsewhere.
Tempo comparison is octave-normalized. The ratio between two tempi is halved or doubled until it lands between roughly 0.67 and 1.5, so a 70 BPM track and a 140 BPM track are treated as the close relatives they are rather than as opposites.
Key compatibility follows circle-of-fifths logic, with explicit costs.
Within the same mode (major to major, or minor to minor), cost rises with distance around the circle of fifths:
| Circle distance | Cost |
|---|---|
| 0 (same key) | 0 |
| 1 (perfect fifth) | 0.12 |
| 2 | 0.38 |
| 3 or more | 0.55 and up |
Across modes:
| Relationship | Cost |
|---|---|
| Relative major or minor | 0.05 |
| Parallel (same root, different mode) | 0.22 |
| Anything else | 0.35 and up, by pitch distance |
Relative keys score better than parallel keys because they share a key signature outright, which is what makes them sound related.
When either track has no usable key, the harmonic term drops out rather than guessing.
Best Mix needs data. A queue of tracks with no local analysis and no catalog tempo has nothing to sort on, and the result will be close to the original order. Letting a queue sit long enough for background analysis to complete produces noticeably better results than triggering it the instant a queue is built.
| Path | Role |
|---|---|
src/app/playback/queueTransitionSort.js |
Scoring and reorder |
src/app/playback/smartQueueActions.js |
Queue-level actions |
src/audio/crossfade/bpmMetadata.js |
Catalog tempo and key lookup |
src/audio/crossfade/bpmMetadataStore.js |
Local cache of catalog metadata |
src/services/cloudAnalysisSync.js |
Batch analysis fetch |
workers/bpm/ |
GetSongBPM proxy worker |
Orchard is licensed AGPL-3.0-or-later from 4.0.0 onward. Copyright © 2025–2026 SFG545. Orchard is not affiliated with or endorsed by YouTube or Google.
Using Orchard
Features
- Playback and Queues
- Explicit and Age-Restricted Tracks
- Best Mix
- Smart Crossfade
- Audio Engine
- Song Cache
- Library and Discovery
- Replay
- Listening Parties
- Orchard Connect
- Integrations
- Appearance
- Artist Packs
Mobile
Development
- Architecture
- Building from Source
- Native Audio Analyzer
- Cloudflare Workers
- Releases and Updates
- Contributing
Policy