[music-dsp] Algorithms for finding seamless loops in audio
robert bristow-johnson
rbj at audioimagination.com
Fri Nov 26 01:14:20 EST 2010
On Nov 26, 2010, at 1:01 AM, Ross Bencina wrote:
> Element Green wrote:
>> I would think autocorrelation or something like that would provide
>> the
>> location and size of the loop, so I don't see the need for a pitch
>> detection algorithm. Or am I overlooking something?
>
> Peaks in the ACF might be good loop candidates but won't necessarily
> all be multiples of the fundamental frequency (consider a sound with
> a missing fundamental for example).
you can have a periodic (or quasi-periodic) signal with absolutely no
energy at harmonic #1 (what i would call the fundamental), and as long
as it has energy in most other odd harmonics, the autocorrelation
function will work just as well. there will still be peaks at lags
are at integer multiples of the apparent period.
> The best loops will almost certainly be multiples of the
> fundamental.. and that algorithm I posted is more reliable than ACF
> peak picking. It really depends how good your algorithm needs to be
> -- it's definitely a second order concern -- especially if that PDF
> is melting your brain.
>
> Also, if you knew the fundamental frequency you would only need to
> use the ACF to test a small number of candidate loop points (eg near
> zero crossings at multiples of the fundamental frequency) so that
> could be a good performance optimisation too.
whatever finds you a pitch period (the reciprocal of the fundamental
frequency) also finds you loop candidates. i dunno how you would know
the fundamental without also knowing other loop candidates. for me, a
pitch detection algorithm does so by choosing from a set of candidate
pitches. each of those candidate pitches are also candidate loop
displacements, displacement in samples is the reciprocal of candidate
fundamental frequency (which of those candidates is best, for either
reason, is another issue).
--
r b-j rbj at audioimagination.com
"Imagination is more important than knowledge."
More information about the music-dsp
mailing list