How do I find hit points (not beats) in music that has no steady pulse, using onset detection?
Problem: ambient, rubato or textural music has events (a chime, a swell start) but no beats; an editor needs event times. Conditions: audio with audible attacks. Method: librosa.onset.onset_detect picks peaks in an onset-strength envelope; defaults in the source are pre_max = 30 ms, wait = 30 ms and delta = 0.07, and the docstring says the peak-pick parameters were chosen by large-scale hyper-parameter search. Set units='time' for seconds. backtrack=True moves each onset to the nearest preceding energy minimum, described as useful for slice points in segmentation, so the cut lands just before the attack rather than on its peak (sparse output only). Example (inference): use backtracked onsets as audio edit points and the un-backtracked peak as the visual hit frame. Failure modes: soft swells produce no strong peak and are missed; dense music gives too many onsets, so raise delta or filter by strength. 30 ms is shorter than one 24 fps frame (41.7 ms), so wait does not prevent two onse...
Structured fields
{
"citations": [
{
"url": "https://raw.githubusercontent.com/librosa/librosa/main/librosa/onset.py",
"note": "onset_detect docstring; onset_detect source; onset_detect source; onset_detect docstring"
}
]
}Evidence claims
- [sourced_fact] Problem: ambient, rubato or textural music has events (a chime, a swell start) but no beats; an editor needs event times. Conditions: audio with audible attacks. Method: librosa.onset.onset_detect picks peaks in an onset-strength envelope; defaults in the source are pre_max = 30 ms, wait = 30 ms and delta = 0.07, and the docstring says the peak-pick parameters were chosen by large-scale hyper-parameter search. Set units='time' for seconds. backtrack=True moves each onset to the nearest preceding energy minimum, described as useful for slice points in segmentation, so the cut lands just before the attack rather than on its peak (sparse output only). Example (inference): use backtracked onsets as audio edit points and the un-backtracked peak as the visual hit frame. Failure modes: soft swells produce no strong peak and are missed; dense music gives too many onsets, so raise delta or filter by strength. 30 ms is shorter than one 24 fps frame (41.7 ms), so wait does not prevent two onsets inside one frame. Limitations: docstrings only; no accuracy figures; not tuned for video. Version/date: librosa main branch fetched 2026-10-23. · locator: onset_detect docstring; onset_detect source; onset_detect source; onset_detect docstring source
Rights
| component | license | hosting | redistribution | modification | training | Evidence and notes |
|---|---|---|---|---|---|---|
| documentation | unknown | permitted | permitted | unknown | unknown | Applies to this original summary only, not to the cited sources. |