pyroomacoustics.utilities module¶
-
pyroomacoustics.utilities.
angle_from_points
(x1, x2)¶
-
pyroomacoustics.utilities.
clip
(signal, high, low)¶ Clip a signal from above at high and from below at low.
-
pyroomacoustics.utilities.
compare_plot
(signal1, signal2, Fs, fft_size=512, norm=False, equal=False, title1=None, title2=None)¶
-
pyroomacoustics.utilities.
convmtx
(x, n)¶ Create a convolution matrix H for the vector x of size len(x) times n. Then, the result of np.dot(H,v) where v is a vector of length n is the same as np.convolve(x, v).
-
pyroomacoustics.utilities.
dB
(signal, power=False)¶
-
pyroomacoustics.utilities.
fractional_delay
(t0)¶ Creates a fractional delay filter using a windowed sinc function. The length of the filter is fixed by the module wide constant frac_delay_length (default 81).
Parameters: t0 (float) – The delay in fraction of sample. Typically between 0 and 1. Returns: Return type: A fractional delay filter with specified delay.
-
pyroomacoustics.utilities.
fractional_delay_filter_bank
(delays)¶ Creates a fractional delay filter bank of windowed sinc filters
Parameters: delays (1d narray) – The delays corresponding to each filter in fractional samples Returns: - An ndarray where the ith row contains the fractional delay filter
- corresponding to the ith delay. The number of columns of the matrix
- is proportional to the maximum delay.
-
pyroomacoustics.utilities.
goertzel
(x, k)¶ Goertzel algorithm to compute DFT coefficients
-
pyroomacoustics.utilities.
highpass
(signal, Fs, fc=None, plot=False)¶ Filter out the really low frequencies, default is below 50Hz
-
pyroomacoustics.utilities.
levinson
(r, b)¶ Solve a system of the form Rx=b where R is hermitian toeplitz matrix and b is any vector using the generalized Levinson recursion as described in M.H. Hayes, Statistical Signal Processing and Modelling, p. 268.
Parameters: - r – First column of R, toeplitz hermitian matrix.
- b – The right-hand argument. If b is a matrix, the system is solved for every column vector in b.
Returns: Return type: The solution of the linear system Rx = b.
-
pyroomacoustics.utilities.
low_pass_dirac
(t0, alpha, Fs, N)¶ Creates a vector containing a lowpass Dirac of duration T sampled at Fs with delay t0 and attenuation alpha.
If t0 and alpha are 2D column vectors of the same size, then the function returns a matrix with each line corresponding to pair of t0/alpha values.
-
pyroomacoustics.utilities.
normalize
(signal, bits=None)¶ normalize to be in a given range. The default is to normalize the maximum amplitude to be one. An optional argument allows to normalize the signal to be within the range of a given signed integer representation of bits.
-
pyroomacoustics.utilities.
normalize_pwr
(sig1, sig2)¶ Normalize sig1 to have the same power as sig2.
-
pyroomacoustics.utilities.
prony
(x, p, q)¶ Prony’s Method from Monson H. Hayes’ Statistical Signal Processing, p. 154
Parameters: - x – signal to model
- p – order of denominator
- q – order of numerator
Returns: - a – numerator coefficients
- b – denominator coefficients
- err (the squared error of approximation)
-
pyroomacoustics.utilities.
real_spectrum
(signal, axis=-1, **kwargs)¶
-
pyroomacoustics.utilities.
shanks
(x, p, q)¶ Shank’s Method from Monson H. Hayes’ Statistical Signal Processing, p. 154
Parameters: - x – signal to model
- p – order of denominator
- q – order of numerator
Returns: - a – numerator coefficients
- b – denominator coefficients
- err – the squared error of approximation
-
pyroomacoustics.utilities.
spectrum
(signal, Fs, N)¶
-
pyroomacoustics.utilities.
time_dB
(signal, Fs, bits=16)¶ Compute the signed dB amplitude of the oscillating signal normalized wrt the number of bits used for the signal.
-
pyroomacoustics.utilities.
to_16b
(signal)¶ converts float 32 bit signal (-1 to 1) to a signed 16 bits representation No clipping in performed, you are responsible to ensure signal is within the correct interval.