LCAV / pyroomacoustics

Pyroomacoustics is a package for audio signal processing for indoor applications. It was developed as a fast prototyping platform for beamforming algorithms in indoor scenarios.
https://pyroomacoustics.readthedocs.io
MIT License
1.43k stars 427 forks source link

Future warning when fftSize and hopSize is defined on beamforming techniques #92

Closed xaviliz closed 5 years ago

xaviliz commented 5 years ago

Hi all,

I was trying to increase fftSize in Microphone.Beamformer object to compute far_field_weights and sum and delay weights. However I got a warning related with the last line of Microphone.Beamformer .filters_from_weights()

/home/xxxxxxxxx/anaconda2/envs/xxxxxxxxx/lib/python3.5/site-packages/pyroomacoustics/beamforming.py:455: FutureWarning:rcondparameter will change to the default of machine precision times ``max(M, N)`` where M and N are the input matrix dimensions. To use the future default and silence this warning we advise to passrcond=None, to keep using the old, explicitly passrcond=-1. self.filters[i] = np.real(np.linalg.lstsq(F, w)[0])

Thanks in advance, XL

fakufaku commented 5 years ago

@xaviliz Sorry for the late reply. This is a warning from numpy.linalg.lstsq. It indicates a change in the API and I don't think it is of importance to us. It relates to the rcond parameter as follows.

rcond : float, optional
    Cut-off ratio for small singular values of a. For the purposes of rank determination, singular values
    are treated as zero if they are smaller than rcond times the largest singular value of a.

    Changed in version 1.14.0: If not set, a FutureWarning is given. The previous default of -1 will use
    the machine precision as rcond parameter, the new default will use the machine precision times
    max(M, N). To silence the warning and use the new default, use rcond=None, to keep using the
    old behavior, use rcond=-1.

I will update the code to add rcond=None to silence the warning as I don't think it is relevant to us. Thanks for the heads up!

xaviliz commented 5 years ago

@fakufaku ok, thanks!

BTW, I have noticed when this warning appears the beamforming process is quite longer. I have not tested RTFs but I will do soon.

Have a fun day!

fakufaku commented 5 years ago

Fixed in PR #96 .

The reason is that when the requested filter length is shorter than the STFT analysis size, the filter is truncated with numpy.linalg.lstsq. This is the reason of both the warning and the extra computation time.