Skip to content

Mixing & Sequencing

Score transitions and build DJ sets using six-axis scoring (key, BPM, energy, genre, brightness, rhythm), plus discover compatible track pools using the symmetric seven-axis pool kernel. See Harmonic Mixing for the transition scoring model and Pool Building for the pool discovery workflow.


Score a single transition between two tracks across all six axes plus a weighted composite.

ParameterTypeRequiredDescription
from_track_idstringyesSource track ID
to_track_idstringyesDestination track ID
energy_phasestring"warmup", "build", "peak", "release"
prioritystring | objectTransition weight spec (see below)
master_tempobooleanMaster Tempo mode (default: true)
harmonic_stylestring"conservative", "balanced", "adventurous"

When master_tempo is false, the scorer accounts for pitch shift from BPM adjustment when evaluating key compatibility — a track sped up by 3% shifts its effective key by ~0.5 semitones.


Rank pool tracks as transition candidates from a reference track, sorted by composite score.

ParameterTypeRequiredDescription
from_track_idstringyesSource track to transition from
pool_track_idsstring[]Pool of candidate track IDs to rank
playlist_idstringUse a playlist as the candidate pool
target_bpmnumberTarget BPM — scores how well each candidate fits
energy_phasestring"warmup", "build", "peak", "release"
prioritystring | objectTransition weight spec (see below)
master_tempobooleanMaster Tempo mode (default: true)
harmonic_stylestring"conservative", "balanced", "adventurous"
limitintegerMax results (default: 10, max: 50)

Provide either pool_track_ids or playlist_id to define the candidate pool.


Generate candidate DJ set sequences from a track pool using beam search with energy-curve shaping.

ParameterTypeRequiredDescription
track_idsstring[]yesPool of candidate track IDs (pre-filtered)
target_tracksintegeryesDesired number of tracks per candidate set
prioritystring | objectTransition weight spec (see below)
energy_curvestring or arrayPreset name or custom phase array (default: "warmup_build_peak_release")
start_track_idstringForce a specific opening track
beam_widthintegerSearch width: 1 = greedy/fast, higher = broader (default: 3, max: 8). Supersedes the deprecated candidates parameter.
harmonic_stylestring"conservative", "balanced", "adventurous"
master_tempobooleanMaster Tempo mode (default: true)
bpm_drift_pctnumberMax BPM drift from start track as % (default: 6.0)
bpm_rangenumber[][start_bpm, end_bpm] — plans a BPM trajectory across the set

Energy curve presets: "warmup_build_peak_release" (default), "flat", "peak_only". Pass a custom array of phase strings for full control (e.g., ["warmup", "build", "build", "peak", "peak", "release"]).

BPM trajectory: When bpm_range is set (e.g., [126, 134]), the builder plans a BPM arc across the set and outputs per-track play_at_bpm, pitch_adjustment_pct, and effective_key values.

Returns candidate sequences with per-transition scores, overall set score, and estimated total duration.

Evaluation thresholds (test harness only, not enforced at runtime)

Section titled “Evaluation thresholds (test harness only, not enforced at runtime)”

These thresholds are used by the internal test suite (eval_scoring.rs) to catch scoring regressions. They are not enforced by build_set at runtime.

MetricThresholdDescription
Mean composite≥ 0.65Average transition score
Min composite≥ 0.30Worst individual transition
Composite variance≤ 0.08Consistency across transitions
Harmonic coherence≥ 50%Fraction of transitions with key ≥ 0.8
Energy fidelity≥ 40%Fraction of transitions with perfect energy
Max pitch adjustment≤ 8%Maximum BPM deviation across set

The priority parameter on score_transition, query_transition_candidates, and build_set accepts a flexible TransitionWeightSpec with three forms:

Named preset — a built-in or saved preset by name:

"balanced"

Built-in presets: "balanced", "harmonic", "energy", "genre".

Preset with per-axis overrides — start from a preset and tweak individual axes (auto-renormalized):

{"preset": "harmonic", "overrides": {"energy": 0.25}}

Fully custom weights — specify all axes directly (auto-renormalized to sum to 1.0):

{"key": 0.3, "bpm": 0.2, "energy": 0.2, "genre": 0.15, "brightness": 0.1, "rhythm": 0.05}

Transition axes: key, bpm, energy, genre, brightness, rhythm (6 axes). All fields are optional in override and custom forms; missing fields inherit from the base preset (or default to 0 in fully custom mode).


The pool tools use a symmetric scoring kernel — score(A,B) == score(B,A) always. No energy phases, genre streaks, or BPM drift. Seven axes: BPM, energy, key, genre, timbral, brightness, rhythm. Two presets: balanced (default) and timbral.

Score pool compatibility between tracks. Three modes determined by which parameters are provided:

Pairwise mode — score two tracks:

ParameterTypeRequiredDescription
track_astringyesFirst track ID
track_bstringyesSecond track ID

One-vs-pool mode — score a candidate against a pool:

ParameterTypeRequiredDescription
track_idstringyesCandidate track ID
pool_track_idsstring[]yesPool member track IDs

Cohesion mode — analyze a pool’s internal compatibility:

ParameterTypeRequiredDescription
pool_track_idsstring[]yesPool track IDs (at least 2)

Common parameters (all modes):

ParameterTypeDefaultDescription
master_tempobooleanfalseMaster Tempo mode
reference_bpmnumbermedianReference BPM for key evaluation
presetstring | object"balanced"Pool weight spec (see below)

Find tracks compatible with an existing pool via iterative greedy expansion. Each addition is guaranteed compatible with the full pool at the time it’s added.

ParameterTypeRequiredDescription
seed_track_idsstring[]yesSeed tracks defining the initial pool
additionsintegerTracks to add (default: 3)
master_tempobooleanMaster Tempo mode (default: false)
reference_bpmnumberReference BPM (default: median of seeds)
cross_genrebooleanDisable genre family pre-filter (default: false)
presetstring | objectPool weight spec (see below)
playlist_idstringRestrict candidates to a playlist
max_tracksintegerCap on candidate universe size

Also accepts all search filter parameters for scoping the candidate universe.

Returns additions with min_score (worst compatibility to any member), mean_score, and rationale (strongest/weakest axes, most compatible member). Stops early if no candidate meets the 0.4 quality threshold.


Analyze a pool’s cohesion, coverage, and structure.

ParameterTypeRequiredDescription
pool_track_idsstring[]Track IDs in the pool
playlist_idstringPlaylist ID to use as the pool
master_tempobooleanMaster Tempo mode (default: false)
reference_bpmnumberReference BPM (default: median)
presetstring | objectPool weight spec (see below)

Provide either pool_track_ids or playlist_id.

Returns: cohesion (mean/min pairwise), medoid track, weak members, energy band, BPM center/spread, key neighborhood, dominant genre, analysis coverage. When master_tempo=false, also reports optimal_reference_bpm and key stability comparison.


Discover natural track pools in a library subset using Bron-Kerbosch clique enumeration on a thresholded compatibility graph. Returns overlapping pools with core/edge members and bridge tracks.

ParameterTypeRequiredDescription
track_idsstring[]Specific track IDs to analyze (highest priority selector)
playlist_idstringAnalyze tracks in this playlist
max_tracksintegerMax tracks to analyze (default: 200)
thresholdnumberCompatibility threshold for graph edges, 0.0—1.0 (default: 0.7). Higher = tighter pools, fewer results
min_pool_sizeintegerMinimum pool size (default: 3, min: 2)
max_pool_sizeintegerMaximum pool size (default: 12)
max_poolsintegerMax pools to return (default: 10)
master_tempobooleanMaster Tempo mode (default: false)
reference_bpmnumberReference BPM for key evaluation (default: median)
presetstring | objectPool weight spec (see below)

Also accepts all search filter parameters for scoping the input tracks.


The preset parameter on score_pool_compatibility, expand_pool, describe_pool, and discover_pools accepts a flexible PoolWeightSpec with three forms:

Named preset — a built-in or saved preset by name:

"balanced"

Built-in presets: "balanced", "timbral".

Preset with per-axis overrides — start from a preset and tweak individual axes (auto-renormalized):

{"preset": "timbral", "overrides": {"timbral": 0.4}}

Fully custom weights — specify all axes directly (auto-renormalized to sum to 1.0):

{"bpm": 0.2, "energy": 0.2, "timbral": 0.15, "key": 0.15, "genre": 0.15, "brightness": 0.1, "rhythm": 0.05}

Pool axes: bpm, energy, timbral, key, genre, brightness, rhythm (7 axes). All fields are optional in override and custom forms; missing fields inherit from the base preset (or default to 0 in fully custom mode).


Save, list, and delete custom weight presets that persist across sessions. Built-in presets (balanced, harmonic, energy, genre for transition; balanced, timbral for pool) cannot be overwritten or deleted.

Save a custom weight preset for reuse. Weights are auto-renormalized to sum to 1.0.

ParameterTypeRequiredDescription
namestringyesName for the preset (e.g., "deep_techno_pool")
scorer_typestringyes"pool" or "transition"
weightsobjectyesWeight values. For pool: {bpm, energy, timbral, key, genre, brightness, rhythm}. For transition: {key, bpm, energy, genre, brightness, rhythm}

List available weight presets (both built-in and custom saved), showing weights for each.

ParameterTypeRequiredDescription
scorer_typestringFilter by "pool" or "transition". Omit for all

Delete a custom saved weight preset. Cannot delete built-in presets.

ParameterTypeRequiredDescription
namestringyesName of the preset to delete
scorer_typestringyes"pool" or "transition"