python - 如何找到 .wav 文件的噪声点。我的意思是,不消除噪音,只是在使用 python 发生噪音时
问题描述
如何找到 .wav 文件的噪声点。我的意思是,不消除噪音,就在发生噪音时我检查了这个分类狗和猫声音的网站
但它没有正常工作......
你们能给我一些建议或其他方法来找到.wav文件的噪声点吗
- 是否可以使用 logreg(机器学习)从声音中找到噪音?不删。。
- 有什么方法可以找到噪音点吗?
解决方案
试试这个
import noisereduce
temp = noisereduce.reduce_noise(noise_clip=noise_clip,audio_clip=temp,verbose=True)
noise_clip
信号的一小部分(噪声样本,可能为 1s frame_duration)
audio_clip
实际音频
signal, fs = librosa.load(path)
signln = len(signal)
avg_energy = np.sum(signal ** 2) / float(signln) #avg_energy of acual signal
f_d = 0.02 #frame duration
perc = 0.01
flag = True
j = 0
f_length = fs * f_d #frame length is `frame per second(fs) * frame_duration(f_d)`
signln = len(signal)
retsig = []
noise = signal[0:441] # just considering first little part as noise
avg_energy = np.sum(signal ** 2) / float(signln)
while j < signln:
subsig = signal[int(j): int(j) + int(f_length)]
average_energy = np.sum(subsig ** 2) / float(len(subsig)) # avg energy of current frame
if average_energy <= avg_energy: #if enegy of the current frame is less than actual signal then then we can confirm that this frame as silence or noise part
if flag: #to get first noise or silence appearing on the signal
noise = subsig #if you want to get all the noise frame, then just create a list and append it(noise_list.append(subsig)) and also don't use the flag condition
flag = False
else: # if avg energy of current frame is grater than actual signal energy then this frame contain the data
retsig.append(subsig) # so you need to add that frame to new variable
j += f_length
推荐阅读
- laravel - laravel 中用于订单信息的自定义中间件
- javascript - 为班级制作风格并为其他人删除
- java - 如何从命令行获取分数?
- oracle - SQL PLUS 不启动
- postgresql - 为 Postgres SQL 分离 WAL 日志和两个不同磁盘中的数据
- c# - 使用windows form c#登录谷歌
- python-3.x - python如何选择打印机打印收据
- regex - 如何使用 Ruby 正则表达式返回字符串的第一个匹配子字符串?
- python-3.x - 如何获取包含在多个类中的确切文本
- javascript - 如何在 d3 中访问数据集中的元素