Hi @arkrow (and others) — I've used PyMusicLooper at the start for a small project and wanted to share what I built, in case any of it is useful upstream.
The gap I was trying to fill: PyMusicLooper finds great loop points, but for music with a long intro or outro the top candidates seem to often land mid-body rather than at section boundaries. I also wanted a crossfade renderer rather than a hard splice or metadata tags.
What I ended up with (disclaimer: largely with help of Claude Code but I verified the steps):
- Structural body detection via Foote novelty (MFCC + checkerboard kernel) — finds the first and last strong section boundaries, then constrains loop-point search to that region. Avoids picking two mid-body moments that happen to be spectrally similar.
- HPSS before chroma — separates harmonic content before computing chroma similarity, so drum transients don't pollute the pitch-class vectors.
- Downbeat phase detection — groups detected beats into bars, picks the phase whose downbeats align with structural peaks, then snaps fade endpoints to actual bar boundaries rather than N × estimated_bar_s.
- Phase alignment — cross-correlates a window around loop_start with a search region around loop_end and shifts loop_end by the lag that maximises waveform correlation.
- Adaptive loudness — computes RMS of the outgoing tail and incoming pre-head, outputs the ratio as gain_db so the loop-around doesn't pop or drop.
- Crossfade renderer — pre-head design (crossfade ends at loop_start, so any transient there hits at full volume), asymmetric fade lengths, equal-power curves.
It works really well for the song I wanted to loop play. I can share the code or try to see if I can make a PR with some of the analysis pieces if they'd fit.
Hi @arkrow (and others) — I've used PyMusicLooper at the start for a small project and wanted to share what I built, in case any of it is useful upstream.
The gap I was trying to fill: PyMusicLooper finds great loop points, but for music with a long intro or outro the top candidates seem to often land mid-body rather than at section boundaries. I also wanted a crossfade renderer rather than a hard splice or metadata tags.
What I ended up with (disclaimer: largely with help of Claude Code but I verified the steps):
It works really well for the song I wanted to loop play. I can share the code or try to see if I can make a PR with some of the analysis pieces if they'd fit.