簡體   English   中英

如何找到.wav 文件的噪聲點。 我的意思是,不消除噪音,只是在使用 python 發生噪音時

[英]How to find noise point of .wav file. i mean, not remove noise, just when occurred noise by using python

如何找到.wav 文件的噪聲點。 我的意思是,不是消除噪音,就在發生噪音時我檢查了這個分類狗和貓聲音的網站

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

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

你們能給我一些建議或其他方法來找到.wav文件的噪聲點嗎

  1. 是否可以使用 logreg(機器學習)從聲音中找到噪音? 不刪。。
  2. 有什么方法可以找到噪音點嗎?

嘗試這個

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM