PV_ExtractRepeat:
Filter:
sc3-plugins/Classes (extension) | UGens > FFT | UGens > Analysis

PV_ExtractRepeat
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

.new

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.

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