PV_ExtractRepeat:
Filter:
Classes (extension) | UGens > FFT | UGens > Analysis

PV_ExtractRepeat : PV_ChainUGen : WidthFirstUGen : UGen : AbstractFunction : Object
ExtensionExtension

extract a repeating loop out from audio

Description

If you have a signal that consists of some fixed looping audio (e.g. a beat) plus some varying content (e.g. singing), this UGen uses a simple binary-masking technique to try and separate the looping bit from the non-looping bit. The quality of the separation is quite rough, but useful in some circumstances.

Note that this unit estimates the loop characteristics online in real time, meaning it takes a few times through the loop before the separation really kicks in. This means that at any point, any novel element is included in the nonrepeating part, even if it's really a loop that's starting.

You must know the loop duration - this unit will not estimate it for you.

Class Methods

PV_ExtractRepeat.new(buffer, loopbuf, loopdur, memorytime: 30, which: 0, ffthop: 0.5, thresh: 1)

Arguments:

array

The array of input signals.

chain

an fft chain

loopbuf

a buffer where data about the loop is calculated/stored. num frames should be enough to hold the loop (you'll get a warning if not), num channels should be (fftsize/2 + 1).

loopdur

duration in seconds of the bit you want extracted. (You can change the loop duration on-the-fly but you'll get some unhelpful results while the unit settles in to the new loop duration.)

memorytime

how quickly (in seconds) the recursive estimation converges

which

set to 0 to extract the loop, set to 1 to extract everything else

ffthop

this should match the hop size used in the FFT. typically 0.5.

(thresh)

threshold for allocating bins to repeating/nonrepeating. Default is 1, and raising it means more gets allocated to the repeating part.

Inherited class methods

Instance Methods

Inherited instance methods

Examples

First a toy example with synthetic material; then an example reading a WAV file from disk (you'll have to find one, and also find its bpm).

This unit is (c) Dan Stowell, based on the technique presented in this paper (but different - adapted for online estimation and with some other little differences):

Zafar Rafii and Bryan Pardo. "A Simple Music/Voice Separation Method based on the Extraction of the Repeating Musical Structure," 36th International Conference on Acoustics, Speech and Signal Processing (ICASSP 2011), Prague, Czech Republic, May 22-27, 2011. http://www.cs.northwestern.edu/~zra446/research.html