我正在尝试减少录制的语音文件中的噪音。我正在使用 python 降噪并进行一些测试来优化。由于噪音是永久且相对稳定的,我希望使用没有语音的声音作为滤波器,将其反向应用于录制的语音。
问题是我没有发现两个版本之间有任何区别,所以我想知道我是否做错了,是否只是从一个版本到另一个版本不能做得更好的过程。 使用
from scipy.io import wavfile
import noisereduce as nr
# Using a profile
rate, data = wavfile.read("thisisatest.wav")
prof_rate, noise_profile = wavfile.read("empty_noise.wav")
reduced_noise = nr.reduce_noise(y=data, sr=rate, y_noise=noise_profile)
wavfile.write("not_noisy_anymore_profile.wav", rate, reduced_noise)
#Classic way
rate, data = wavfile.read("thisisatest.wav")
reduced_noise = nr.reduce_noise(y=data, sr=rate)
wavfile.write("not_noisy_anymore.wav", rate, reduced_noise)
有人用过这个吗?
正如您使用的库的文档所说,仅当
y_noise
时才使用stationary=True
。
y_noise : np.ndarray [shape=(# frames,) or (# channels, # frames)], real-valued
noise signal to compute statistics over (only for stationary noise reduction).
stationary : bool, optional
Whether to perform stationary, or non-stationary noise reduction, by default False
您没有通过
stationary=True
,因此 y_noise
会被忽略。