On the beat.
In the key.

How rbxport reads electronic music, from the first kick through the last tempo change.

Analyze the whole track.

rbxport’s analysis engine, rbl-analysis, turns decoded audio into BPM, beat timestamps, bar numbers, key, and a three-band waveform. The same audio and settings produce the same result. It is tuned around electronic music in 4/4: four beats per bar, numbered 1–4.

Kick attacks place the markers; changes in the arrangement help decide which marker is beat 1. Whole-track analysis also detects tempo changes after a steady intro.

How the analysis pipeline works.

Decoded audio passes through BPM detection, kick alignment, tempo and phase checks, downbeat selection, file-start handling, key detection, and waveform generation.

Four-stage pipeline
The full analysis pipeline Audio flows through BPM detection and kick alignment, then checks for tempo changes and gaps. Arrangement changes determine beat one and any half-beat correction. File-start handling runs before edmkey scoring and the minor-key preference. Yes branches rejoin the main flow; tempo changes loop back for another check. Waveform generation is shown separately. Decoded audio Find whole-track BPM within the selected range Place a rough grid Find nearby kick attacks¹ Fit through the reliable hits Tempo changes anywhere? Yes Follow the transition Ramp beat by beat, or cut to the new tempo Check again No Hits return on a new phase after a gap? Yes Cut at the return Walk a ramp if hits drift toward the new grid No Find changes in the arrangement Drops, breakdowns, phrase starts Changes fall between the grid’s beats? Yes Move the grid half a beat onto the kick No Choose beat 1; number beats 1–4 Keep counting across tempo cuts Mark internal phrase starts² File-start boundary checks pass? Yes Place the first beat at zero If the opening beat is cut, keep later beats in place; otherwise refit first segment No Detect key with edmkey Build pitch-class profiles Score all 24 major / minor keys Apply the minor-key bias Use rekordbox key spellings Analysis result BPM, grid, beat 1, phrase starts, key Alongside musical analysis Waveform generation builds the three-band display and track overview STAGE 1 · FIND THE BPM STAGE 2 · ALIGN THE GRID STAGE 3 · FIND BEAT 1 STAGE 4 · DETECT THE KEY
Key-only requests skip grid rewriting. Waveforms are generated separately and do not feed key detection.
¹ Kick-attack placement requires High precision. ² Internal phrase-start markers do not include intro, verse, or chorus labels.

Choose what to analyze.

Choose Analyze Track from a track or player menu. The Analysis Setting dialog applies to the selected batch; changing your selection afterward does not change the queued tracks.

Analysis controls
Setting What changes
BPM / Grid Updates BPM and beat markers and regenerates waveforms.
High precision Uses attack placement; enabled by default. Without it, placement uses the onset envelope.
BPM Range 70–180 by default; also 98–195, 118–236, and 58–115.
KEY Updates key metadata. Key-only analysis leaves BPM, grids, and waveform files untouched.

Unchecked results are preserved. Analysis locks prevent changes and a refused track does not stop the rest of the batch. If key detection returns no result, the existing key stays.

Presets and automatic imports

The documented Normal and RBXport presets currently select the same underlying analysis options; they are not two independent engines. Automatic imports use full analysis, high precision, and a 70–180 range. Manual choices belong to that batch rather than overwriting global preferences.

Estimate BPM from onset patterns.

The first pass measures onsets: moments when sound energy rises. Sustained notes and fading tails contribute less than a fresh percussive hit. Two measurements work together: how often that pattern repeats, and how strongly it supports each rhythmic rate.

174 BPM compared with half-time 87 BPM Same rhythm. Two ways to count it. 174 BPM 87 BPM Prefer the faster rate when the rhythm supports it.
Illustrative beat spacing: double and half tempo can both explain a repeating pattern.

For octave-related candidates such as 174 and 87 BPM, the faster interpretation wins when the onset pattern supports it. A broad prior centered near 132 BPM resolves close ties.

The tempo calculation

A 1,024-sample spectrum advances by 256 samples. Positive spectral differences form a normalized onset envelope. Candidates are scored using autocorrelation × √Fourier magnitude × a broad tempo prior. The standalone documentation describes a 70–200 search; the app constrains it to your selected BPM range.

Align markers to kick attacks.

BPM gives the spacing between beats. A rough grid estimates their positions, then high-precision analysis looks near each marker for the beginning of a kick. It follows the nearby strong rise rather than the loudest part of the kick’s body.

Electronic kick waveform with the attack at the beginning of its rise Place the beat at the onset of the kick. Attack / onset Low-frequency body Decay Silence Time →
The marker sits where the signal starts rising, before the first peak. The schematic waveform uses Production Music Live’s electronic kick waveform as a visual reference; timing and amplitude are illustrative.

A weighted timing line is fitted through reliable attacks, then fitted again with outliers removed. Missing kicks do not pull the line away from the steady sections. The grid extends to the start and end of the file.

Precision and whole-number tempos

The attack detector uses the 900–9,000 Hz band, RMS in 1 ms steps, and a ±15 ms search around each prediction. It compares two phases half a beat apart. A steady fitted tempo within 0.1 BPM of a whole number is snapped to that number and re-aligned through the same attacks. Ramps keep their measured per-beat intervals.

Detect and follow tempo changes.

The engine estimates tempo in 16-second windows. A tempo change is accepted when at least three windows agree within 1% and the candidate differs from the current tempo by more than 2%.

Gradual change: keep every measured beat. Gradual change: keep every measured beat. Beat 1 / downbeat Beats 2–4 1 2 3 4 1 2 3 4 1 2 3 4 128 128 128 136 146 160 174 174 174 174 174 BPM of each interval Ramp begins 174 BPM candidate Rejoin the steady fit after 4 matching intervals (tempo + phase).
Reference track: Showtek & Justin Prime — Cannonball (Will Sparks Extended Remix) ↗.
Illustrative intervals: 128 → 136 → 146 → 160 → 174 BPM. Each measured interval gets its own BPM; there is no single jump during the ramp. The final grid resumes after four consecutive intervals match its period within 1% and its phase within 2 ms. Blue, taller markers indicate beat 1; coral markers indicate beats 2–4. Schematics, not track measurements.
Abrupt change: switch on the supported new beat. Abrupt change: switch on the supported new beat. Beat 1 / downbeat Beats 2–4 1 2 3 4 1 2 3 4 1 2 3 4 136 136 136 136 136 174 174 174 174 174 174 BPM of each interval BPM switches here 136 BPM 174 BPM The cut can fall on beat 2. The 1–4 count does not reset.
Reference track: John Summit & Sub Focus feat. Julia Church — Go Back (Original Mix) ↗.
Illustrative mid-bar cut: the old grid holds until the first supported new-grid beat. Reliable kick runs are preferred; if none qualifies, transient support helps choose the cut. The yellow dashed line marks the BPM decision, not necessarily a downbeat. Blue, taller markers indicate beat 1; coral markers indicate beats 2–4. Schematics, not track measurements.

Gradual changes: follow the hits toward the next stable section and keep every measured interval, including curved ramps. Abrupt changes: if the walk cannot settle, make a cut where the new grid has reliable support. Beat numbers continue 1–4 across the join.

When kicks and usable clicks disappear, quiet full-band transients can carry the transition. The engine boosts their rises internally by 4× with a 20 ms release. This changes the analysis signal, not your audio. Original hit timestamps are retained; silence and release tails cannot invent beats.

When a new tempo qualifies

Familiar rhythm ratios have a 1% exclusion zone. A walked transition allows up to 5% period drift per beat and rejoins the steady grid after four consecutive intervals agree within 1% in period and 2 ms in phase. Full-band transient support is used only inside transitions.

Preserve phase through breakdowns.

A gap with and without a phase change What happens after a breakdown? Same timing Breakdown New phase Breakdown Hold the grid Cut to the new alignment

After two bars without supporting hits, the engine checks how the music returns. If the hits land on the original grid, that grid holds through the breakdown. If they return at the same BPM but shifted in time, each side gets its own alignment and a cut joins them.

The gap walker follows a slowdown or speed-up when the returning hits establish a new tempo or phase. If the music returns to the original grid, the grid stays unchanged. The gap walker uses its original envelope and thresholds without the transition-emphasis fallback.

Choose beat 1 from arrangement changes.

A loud off-beat hat, clap, or reverse bass can fool a simple hit detector. rbxport compares the music before and after possible bar positions, looking for drops, breakdowns, and new bass lines. Those repeated changes help identify the downbeat.

Musical changes support beat one Structure decides which beat is 1. 1 2 3 4 1 2 3 4 Before: sparse arrangement After: new bass line / drop Repeated musical change → downbeat evidence
The algorithm also examines the midpoint between every pair of beats to catch off-beat grids.

It examines eight positions per bar: four beats and their midpoints. Evidence is combined over one-, two-, four-, and eight-bar views. If the winning position lies between the current markers, the grid shifts half a beat.

When the opening tempo segment has at least 32 beats, its own music decides the opening bar position. Later sections do not change that choice. If arrangement scoring finds no clear change, the first beat remains the fallback.

Handle a kick at the file start.

A fitted marker just before zero can leave the first visible marker almost a beat late. If audio starts immediately, a grid beat is close to the boundary, and the downbeat decision agrees, rbxport can anchor beat 1.1 at exactly zero.

Correct and incorrect grid alignment at the file boundary Same opening kick. Two grid positions. Correct Beat 1.1 at 0 ms Incorrect Beat 1.1 at +12 ms 0 ms 25 ms 50 ms 75 ms 100 ms 12 ms late: the kick has already started. Dashed line: file start. Both rows show the identical waveform.
Illustrative close-up of the first 100 ms. The blue grid marker sits at the file boundary, where the kick starts rising. The coral marker is 12 ms late, within the 10–15 ms offset shown here. Waveform shape is schematic; horizontal spacing uses the labeled time scale. Only the opening beat is shown.

If strictly less than 20 ms of the opening beat has been cut away, only that opening marker is added at zero; later markers and BPM values keep their fitted positions. Silence at the start, a clearly later downbeat, or a cut of 20 ms or more does not qualify.

When the boundary adjustment applies

The first segment and boundary are checked within 15 ms. Audio must already be present at the beginning, with the first millisecond carrying at least 10% of the local first-15-ms peak. An uncut boundary beat can re-anchor the first segment; a clipped opening uses a shortened first interval. Later tempo segments are preserved. The downbeat decision is made separately from this boundary timing check.

Build a twelve-class pitch profile.

Key detection uses Ángel Faraldo’s edmkey approach with electronic-music key profiles. It gathers spectral peaks, balances their influence, and folds their evidence into twelve pitch classes. Octaves contribute to the same note class.

A harmonic pitch-class profile feeds 24 key comparisons Audio → pitch evidence → key scores A A♯ B C C♯ D D♯ E F F♯ G G♯ → 12 tonics × major / minor 12 pitch classes, with octaves folded together
Illustrative pitch evidence, not a real song or confidence score. Every tonic is compared in major and minor.

The pitch profile is compared with major and minor templates at all twelve tonics: 24 candidates. Harmonic weighting, a per-frame gate, and detuning correction help the profile reflect tonal content rather than raw loudness.

Read the paper: Key Estimation in Electronic Dance Music by Ángel Faraldo, Emilia Gómez, Sergi Jordà, and Perfecto Herrera (2016).

From spectrum to key name

The documented front end uses 4,096-sample Hann-windowed frames with no overlap, up to 60 spectral peaks between 25 and 3,500 Hz, whitening, and a harmonic pitch-class profile. Four harmonic contributions have weights 1, 0.6, 0.36, and 0.22. Bins below 0.2 of each frame’s strongest bin are gated out. The averaged profile is compared using Pearson correlation against the edma templates. Results use rekordbox-compatible names such as Fm, Db, and F#m.

Add 0.1 to minor-key scores.

Minor-key preference on close decisions The default rule gives minor scores a small bias. Major candidate Minor candidate +0.1 A 0.1 bias can change a close result.
Candidate scores are correlations, not probabilities.

The documented default applies PreferMinor before selecting the highest of the 24 candidate scores. The 0.1 bias can change a close major/minor result.

How this relates to the current analysis rules

The current default does not automatically change this track from A minor to D minor.

The source also contains experimental BassRoot and BassVote rules, but they are not enabled in the documented default. Their test windows include the first and last 45 seconds, bar starts, and selected parts of beats or phrases. The reviewed docs and default rules do not establish a shipped first-and-last-24-bars fallback.

In the recorded edma run, the minor bias changed 51 tracks, fixed 44 reference disagreements, and introduced six.

Generate detail and overview waveforms.

Three bands in a waveform Detail and overview are measured separately. Low · below 200 Hz Mid · 200 Hz–2 kHz High · above 2 kHz

The detail waveform has 150 columns per second, with low, mid, high, and overall peaks. The separate 1,200-bucket overview calculates bass RMS and mid/high energy, then normalizes each band.

The output approximates rekordbox waveform geometry. Calibration used nine reference tracks rather than a held-out accuracy set. Most measured shapes improved, while one track’s absolute-height error increased. Existing tracks require waveform regeneration to receive the updated output.

Phrase starts versus phrase detection

The downbeat stage can produce internal section-boundary candidates from strong four-bar changes on downbeats. The app does not implement user-facing phrase labels, vocal analysis, or automatic cues.

Measured results.

We wanted to at least match rekordbox’s key detection, then add adjustments for electronic music. We tested a reference playlist of tracks purchased from Beatport, synthetic tracks generated with known tempos, and unreleased DJ edits with no existing reference data.

Real-track reference baseline

The reference playlist contains 155 tracks in 4/4, spanning 123–178 BPM. These recorded results predate the transient-emphasis fallback and have not been remeasured for that change.

Historical 155-track comparison
Measure Pass condition Passed
BPM Within 0.05 BPM 155 / 155
Downbeat Within 25 ms, modulo a bar 143 / 155
Full grid 98% of reference beats within 25 ms, same number 142 / 155
Key Same key name as the reference 141 / 155

The 99% figure in the engineering docs is a target, not an achieved result across every metric. Key agreement is agreement with the reference label, not proof of the only musically valid answer.

Known disagreements

Eleven older rekordbox 6 grids sit about 25 ms after the kick. Other differences include an early downbeat choice and hand grids that hold a tempo where rbxport follows a slowdown. The reported rekordbox-7-only subset counts differ between documents and are omitted here.

Saved synthetic grids

Seven two-minute fixtures cover a steady tempo, upward and downward cuts, a mid-bar change, linear ramps, and a curved ramp. The documented saved-grid run matched all 2,103 ticks within 2 ms, with no extra markers, correct numbering, and an exact-zero first marker. Worst error across those cases was 1.938 ms.

Separate regressions cover quiet transitions, release tails, silence, and preserving kick timestamps. The later fallback run records 41 passing unit and integration tests and a clean lint check. Saved library grids change only after reanalysis.

Nine real DJ edits

The older multi-tempo baseline passed BPM and key on 9/9 edits, downbeat on 8/9, and the strict full-grid metric on 4/9. Seven of ten tempo changes were within 3 ms. The difficult cuts were hand-placed at an early impact, well before the new kick pattern arrived. The newer fallback has not been scored against a fresh playlist.

How the validation tools work

The golden harness caches decoded audio and reference grids, then scores candidate analysis without writing to the library. Specialized runs isolate downbeat decisions, key profiles, and bass rules. The multi-tempo rig instead imports copies, writes analysis files, and checks whether the grids survive loading in rekordbox. Its format observations apply to that rig and version.

The synthetic fixtures use sample-exact timestamps generated independently of the analyzer. The checker reads persisted grids back from the app and requires a correctly numbered marker within 2 ms of every tick, with no extras. Rebuilding alone does not update saved grids; tracks must be analyzed again.

Limits and verification.

  • The engine assumes 4/4 and is tuned to electronic music; the reference set is not evidence for every genre or meter.
  • Ambiguous percussion, long beatless transitions, and creative edits can produce different valid interpretations.
  • Whole-number snapping applies only to nearby steady tempos, not every measured interval.
  • Key detection outputs one label even when the tonal evidence is ambiguous.
  • Internal phrase boundaries are not user-facing phrase labels, vocal detection, or stems.

After analysis, check the first downbeat, a later steady section, and any transition. Report incorrect results with the section and expected behavior using the app’s Report bug action.

Open Source

This analysis pipeline is open source (GPL v3). You can explore the code and implementation details on GitHub ↗.

Figures are explanatory schematics, not captured track measurements. Reported test results come from the project’s recorded benchmarks; no new benchmark was run for this page.

Back to rbxport features