Replaces Bitwig's tempo detection for audio files. Bitwig picks a tempo of 60 x beats / file length for files under 40 seconds, so a 137 BPM loop with a 40 ms tail reads 136.22; longer files get a coarse scan biased towards 124 BPM. This mod decides the tempo itself and hands it to Bitwig wherever Bitwig sets it:
- Audio event warp: import with stretching, and Detect Event Tempo. Tags Bitwig reads itself (
.asd, REX/Apple Loop, ACID, loop metadata) are kept. - File tempo: automatic analysis of a file whose tempo is unknown, and Detect Tempo on the file.
There is no menu item of its own: Bitwig's Detect Tempo commands already go through this mod.
How it works
For each audio file whose tempo Bitwig wants to analyse, in this order:
- ACID chunk. A WAV file's ACID tempo, when it's a loop and the value is sane, is used as is.
- File name. A clear BPM in the name (
137bpm,137 BPM,bpm137) is used as is. A bare number (loop_137_Am.wav) is used only when the onsets agree with it. Then the same for the names of the file's folders, nearest first, up to three levels up (a kit'sSong 150 BPM/Stems/Bass.wavgets 150); a folder named with a range such as120-130 BPMdoesn't count. - Onsets. A tempo estimate from the onsets detected by fatyzzz Transients, cross-checked with a second estimate from the audio's repetition, so 4-, 8- or 16-bar loops vote for the right beat.
- Loop length. For files up to 120 s, the file's length (with and without codec padding, trailing zeros or leading silence) is turned into candidate tempos for 4, 8, 16, 32... beats. A candidate close to the onset estimate whose grid the onsets fit best wins.
- Exact loop. If the file is exactly a whole number of bars at a whole BPM and the onsets fit that grid well enough, that tempo is used, also for pads and risers with few onsets. Very slow or very fast results are doubled or halved when the onsets allow it.
- Snap. Rounded to a whole BPM when within 0.3 BPM, to .5 only when that is clearly closer.
- Stems. Files of the same length in the same folder analysed in one session get the same tempo, unless a file clearly fits its own tempo better. When several files of the same length are dropped together, Bitwig analyses a mix of them once; this mod decides that mix's tempo from the tag or name most of the files carry, else from the mix's audio.
Long files. Files over 40 s are analysed from three loud 12 s excerpts instead of the whole file, so a 4-minute MP3 is decided in about 150 ms.
Late result. When the analysis isn't ready within the import's 300 ms, the event keeps Bitwig's tempo for the moment and gets this mod's tempo when it's done, added to the import's undo step while that is still the latest one, else in one small Detect Event Tempo step. When the file's tempo map is still running, the tempo waits for it and is written only once. An event whose tempo or stretch you changed meanwhile, or that you deleted, is left alone.
Tempo changes. Files of 30 s or more also get a tempo map in the background: steady sections, jumps and ramps between them, or variable for live playing that wanders. It is always logged, for example tempo map: song.wav: 140.00 (0:00–1:42) → ramp → 172.00 (1:58–3:30). With Tempo changes: Off (default) a file with several sections gets one tempo on its new events: the first section's, so the track's start lines up with the project grid. The first section must last at least 20 s and 16 beats. A tempo from an ACID tag or the file name stays when it is within 3 % of the first section.
With Tempo changes: Warp markers a file with several sections gets warp markers on its new events, so every beat lands on the beat grid.
Either way the change is written once, in the import's undo step, also when the map is ready only after the import; only when you did something else meanwhile, or undid the import, does it get its own step (Detect Event Tempo or Detect Tempo Map). fatyzzz Trim's Align to kick grid follows the new tempo.
Map cache. A map takes about 2.5 s for a song, so maps are kept on disk and are ready right away the next time the file comes in, also after a restart: ~/Library/Caches/fatyzzz-tempo/maps (Windows %LOCALAPPDATA%\fatyzzz-tempo\maps, Linux $XDG_CACHE_HOME/fatyzzz-tempo/maps or ~/.cache/fatyzzz-tempo/maps). The oldest go past 2000 maps. Delete the folder to clear it.
If nothing is confident (pads, too few onsets, a decoding error), Bitwig's own result is used. When this mod gives a tempo, Bitwig's own file-name check that runs afterwards keeps it.
Every decision is one log line, for example:
[fatyzzz-tempo] tempo guess: ours for loop.wav | ours 140.000, Bitwig 139.870, source length, confidence 0.29, onset estimate 139.964
Settings
Settings > Mods > fatyzzz Tempo:
| Setting | Default | What it does |
|---|---|---|
| Use fatyzzz tempo detection for audio files | on | Off gives Bitwig's detection back. |
| Tempo range from / to (BPM) | 70 / 180 | Estimates are folded into this range by halving or doubling. |
| Snap to whole BPM | on | Round to a whole BPM within 0.3 BPM. |
| Use tempo in file name | on | Step 2 above. |
| Tempo changes | Off | Off: events of files with tempo sections get the first section's tempo. Warp markers: they get warp markers (see Tempo changes). The map is logged either way. |
Limits
- The import's tempo is one constant tempo: where Bitwig's guess had a beat grid with tempo changes, this mod's tempo replaces it when confident. Files with tempo sections get the first section's tempo, or warp markers with Tempo changes: Warp markers.
- No tempo map for files under 30 s, no tempo changes inside a section, no time-signature changes, and the project tempo is not changed.
Requires
fatyzzz-transients, preferences-composition-framework. The framework ships with Patchbay; fatyzzz-transients is installed automatically by Patchbay Launcher. Audio is decoded with its decoder and onsets come from its detector.
Self-test: fatyzzz-tempo/test/run.sh (offline, no Bitwig, needs JDK 25).
Build from source: tools/build.sh fatyzzz-tempo (see the top-level README).