Good day. I need to calculate the SNR of the audio file. I found the information that in there is a finished function in the package: scipy.stats.signaltonoise. But did not find examples of use. How does this function actually work (calculate)?
I also found an example:
import scipy.io.wavfile as wavfile import numpy import os.path def snr(file): if (os.path.isfile(file)): data = wavfile.read(fileWav)[1] singleChannel = data try: singleChannel = numpy.sum(data, axis=1) except: # was mono after all pass norm = singleChannel / (max(numpy.amax(singleChannel), -1 * numpy.amin(singleChannel))) return stats.signaltonoise(norm) maybe someone already wrote something like that?
signaltonoise- was removed fromscipy.stats- in modern versions of scipy it is not. Have you already looked here? Do you have a formula for which is SNR? - MaxU