Skip to content

Major Updates and New Classes

Latest
Compare
Choose a tag to compare
@woolgathering woolgathering released this 24 Sep 22:16
· 14 commits to develop since this release

This package now includes a few different periodicity transforms and will likley be further updated in the future.

Periods

Sethares and Staley's Periodicity Transforms in Python. See the paper here.

Efficiency was improved by modifying the projection algorithm so that we take advantage of the very fast matrix operations in Numpy. The result is identical. There are two flags in the project method: trunc_to_integer_multiple and orthogonalize.

  • trunc_to_integer_multiple allows for the input to be truncated to an integer multiple of the period one is testing for. Say p = 3 and N = len(x), we allow the algorithm to truncate x so that 3|N. Assuming a period is constant in the analysis window (with regard to values), setting this as True tends to produce a better result and minimizes the residual more than otherwise.
  • orthogonalize removes prime factors of p from the projection. That is, for some period p and its projection y, we project y onto the prime factors of p to get y_hat. Then we do y - y_hat and return the result. This idea was taken from "Orthogonal, exactly periodic subspace decomposition" (D.D. Muresan, T.W. Parks), 2003, and the process simplified. Setting both trunc_to_integer_multiple and orthogonalize to True results in a projection that is identical to that acquired using the process described in Muresan and Parks. Note that orthogonalize has no effect in the M-best family as it makes no sense.

RamanujanPeriods

Periodic decomposition using Ramanujan summation, taken from the work of P. P. Vaidyanathan and Srikanth V. Tenneti. This class is nowhere near completion (I have parts of the entire thing laying around my machine...) but this does a basic decomposition using the basis vectors derived from the Ramanujan sum.

A method is included in this class (find_periods_with_weights) which will return the periods found by the Ramanujan transform above some threshold (thresh). Using this with get_periods() essentially combines the the Ramanujan transform with the quadratic program of QOPeriods and allows for good (albeit slow) results without fidding with parameters as is often the case in QOPeriods.

QOPeriods

This is an adaptation of the Sethares and Staley transform where the residual is computed by framing the problem as a quadratic program and each projection is orthogonalized. This produces a better result (up to a point) and is the basis for my forthcoming PhD dissertation on audio applications of these transforms. Note that because this particular ''residualization'' employs a quadratic program, the results of all previously found periods can and often will change. The criteria of when to stop pursuing further periods in the face of residual noise is an ongoing problem and likley unique to each situation. To this end, find_periods() can be passed an argument called test_function which in turn is passed the residual and expects a boolean return on whether or not to process again.

A method is also included in this class called get_periods() that allows one to retrieve the original periods for further analysis.