Signal Processing

pyvoimooo.make_root(bw, freq, fs)

Create a root that has the given bandwidth (bw) at the given frequency (freq).

Parameters
  • bw – The bandwidth of the root.

  • freq – The frequency of the root.

  • fs – The sampling frequency.

Returns

The corresponding root.

New in version 0.8.9.

pyvoimooo.roots2rpoly(rts)

Compute the real polynomial corresponding to a set of complex roots.

Parameters

rts – A complex-valued array of the roots. Since the result is assumed to be real, the roots should be in complex conjugate pairs. If this property is not respected, the result is undefined.

Returns

The real polynomial corresponding to the set of complex roots.

New in version 0.8.9.

pyvoimooo.levinson(ac, order)

Compute an AR model of a given auto-correlation sequence using the Levinon-Durbin recursion.

Parameters
  • ac – The given auto-correlation sequence.

  • order – The order of the AR model.

Returns

The auto-regressive coefficents of the AR model; the remaining squared error of the model w.r.t the given auto-correlation.

New in version 0.8.9.

pyvoimooo.rfft(in, dftlen)

Compute the DFT of a real-valued sequence in using the FFT algorithm.

Parameters
  • in – The input to transform, an array of samples.

  • dftlen – The dftlen of the frequency representation of in (for real sequence, the returned array will be of size dftlen/2+1).

Returns

A dftlen/2+1 array of complex values representing in.

rfftd provides the same for 64b float values.

Note

The computation time of this function is very likely to be slower than that of numpy.fft.rfft because of extra memory copies in the wrapper. Thus, this function should be used only for verification/debugging purpose.

New in version 0.8.9.

pyvoimooo.irfft(in, winlen=-1)

Compute the inverse DFT of a complex-valued sequence in using the iFFT algorithm.

Parameters
  • in – The complex-valued input sequence to inverse-transform. in is supposed to be of length dftlen/2+1.

  • winlen – The expected length of the output sequence. If set -1, the output length is assumed to be dftlen.

Returns

A real-valued array of size winlen (or dftlen if parameter winlen =-1).

irfftd provides the same for 64b float values.

Note

The computation time of this function is very likely to be slower than that of numpy.fft.irfft because of extra memory copies in the wrapper. Thus, this function should be used only for verification/debugging purpose.

New in version 0.8.9.

pyvoimooo.filter_biquad(in, fs, rta_filter_type, cutoff, gain, q)

Filter a waveform using a biquad filter.

Parameters
  • in (array<float>) – The input wavform to transform.

  • fs (int, Hz) – The sampling rate.

  • rta_filter_type (int) –

    An integer to select the type of filtering:

    1. rta_lowpass

    2. rta_highpass

    3. rta_bandpass_constant_skirt, msp name: resonant

    4. rta_bandpass_constant_peak, msp name: bandpass

    5. rta_notch, msp name: bandstop

    6. rta_allpass

    7. rta_peaking, msp name: peaknotch

    8. rta_lowshelf

    9. rta_highshelf

    Source: https://github.com/Ircam-RnD/rta-lib/blob/master/src/signal/rta_filter.h

    See also

    rta_biquad_coefs() function of the library’s documentation: https://github.com/Ircam-RnD/rta-lib/blob/master/src/signal/rta_biquad.h

  • cutoff (float, Hz) – Cut-off frequency of the filter

  • gain (float, >0) – Gain of the filter

  • q (float, >0) – generally >= 0.5 for audio filtering. q <= 1./sqrt(2.) is the limit for monotonic response for lowpass, highpass, lowshelf and highshelf types.

Returns

  • syn (array<float>) - The filtered waveform.

Example:

syn = vmo.filter_biquad(wav, fs, 8, 8000.0, 3.0, 1.0)

New in version 0.10.1.