【问题标题】:How to find noise point of .wav file. i mean, not remove noise, just when occurred noise by using python如何找到 .wav 文件的噪声点。我的意思是,不消除噪音,只是在使用 python 发生噪音时
【发布时间】:2020-07-17 07:44:06
【问题描述】:

如何找到 .wav 文件的噪声点。我的意思是,不是消除噪音,只是在发生噪音时 我检查了这个分类狗和猫声音的网站

https://www.kaggle.com/nadir89/classification-logistic-regression-svm-on-mfccs/notebook?select=utils.py

但它没有正常工作......

你们能给我一些建议或其他方法来找到 .wav 文件的噪声点

  1. 是否可以使用 logreg(机器学习)从声音中找出噪音?不删除..
  2. 有没有办法找到噪声点?

【问题讨论】:

  • 你好,尝试获取信号的静音部分,大部分静音部分包含噪声,静音表示声波的低能量位置。并取部分的小框架。所以你可以使用这个框架来去除噪音

标签: python python-3.x machine-learning wav noise


【解决方案1】:

试试这个

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

【讨论】:

  • “温度”是噪音点吗?我只是想找出 wav 文件中的噪音在哪里没有删除..
  • 不,temp 是您的实际信号。为了找到噪声部分,首先您需要计算信号的平均能量。然后您应该将信号分成帧(持续时间 0.2 秒) .然后您可以将每一帧的能量与整体信号的平均能量进行比较,如果帧的能量
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-10-17
  • 2019-10-04
  • 2011-11-11
  • 2013-03-24
  • 2020-10-08
  • 2021-05-13
  • 1970-01-01
相关资源
最近更新 更多