Alsabat reports error when noise above threshold be detected.
Use either of the options below to designate the threshold. (e.g.
if the ratio of noise to signal is 5%, the snr is about 26dB.)
--snr-db <value in dB>
--snr-pc <value in %>
The noise detection is performed in time domain. On each period
of the sine wave being analyzed, alsabat substracts a clean sine
wave from the source, calculates the RMS value of the residual,
and compares the result with the threshold. At last, alsabat
returns the number of periods with noise above threshold. 0 is
returned when the source is clean.
Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Aligning the data type of fftw analyzer, sample converter and other
components on float, because:
1. avoid unnecessary data type conversion;
2. using float is more efficient than using double;
3. the extra double accuracy is not required.
Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
All files should be opened in either "rb" or "wb" in current
usage.
Remove incorrect and unneccesary prints.
Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Preserve errno value before use, since the value might be
changed by another library call.
Add "#include <errno.h>" and remove redundant include.
Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Truncate the sample frames to powers of 2, since the FFTW algorithm
runs especially fast in this case, and other sizes may be computed
by means of a slow, general-purpose algorithm.
In my test environment applying the patch, a sound clip of 33072
frames is cut off to 32768 frames before analysis, and the time
cost is reduced from 6.128s to 0.224s.
Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Add functions that detecting signal frequency through spectrum
analyzing.
Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@intel.com>
Signed-off-by: Bernard Gautier <bernard.gautier@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>