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

MatchingP
ExtensionExtension

Real time sparse representation

Description

This UGen analyses frames of input audio, a bit like FFT does, but using the assumption that most of the energy in each audio frame can be represented as a combination of a small number of "atoms". This is achieved using Matching Pursuit, which is a standard technique in the field of sparse representations.

You must supply a "dictionary" of atoms, given as a Buffer. Each channel of the Buffer is one atom (this means the atoms all have to be the same length - but zero-padding is OK).

This analysis is less efficient than FFT, so be careful of your CPU usage, and use small, short dictionaries if possible. It also outputs a lot of multichannel data.

Class Methods

.ar

.kr

Arguments:

dict

The Buffer which holds the atoms. NOTE: in most use cases, the atoms should typically all be normalised so that they all have the same L2-norm (see examples below).

in

The input signal.

dictsize

The number of atoms (channels) in the dict.

ntofind

Specifies the number of activations to find in each frame - i.e. the number of atoms that are assumed to be "on" in each frame.

hop

The amount of hop between frames, expressed as a proportion of the dict length (like in FFT). Maximum is 1.

method

Reserved. (Doesn't currently do anything.)

Returns:

[trigger, residual, index0, activ0, index1, activ1, ...] where trigger indicates the moment when a frame has been processed, residual gives the signal that remains after subtracting the contribution from the selected atoms, and each pair of outputs such as index0, activ0 indicates the index of the selected atom and the strength of its activation. This means there will be ntofind * 2 + 2 outputs in all.

Examples

In this example we make a simple dictionary which happens to be quite similar to an un-windowed FFT basis, and then analyse it.