-1

How to find noise point of .wav file. i mean, not remove noise, just when occurred noise i checked this site that classify dog and cat sound

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

but it didnt work properly...

can you guys give me some advises or other way to find noise point of .wav file

  1. is it available to find noise from sound by using logreg(machine learning)? not removing..
  2. is there any way to find noise point?
desertnaut
  • 57,590
  • 26
  • 140
  • 166
  • Hey, Try to get silence part of the signal, mostly the silence part contain the noise, silence means low energy position of the sound wave.and take the small frame of the part. So you can use this frame to remove noise – badhusha muhammed Jul 17 '20 at 07:57

1 Answers1

0

Try this

import noisereduce

temp = noisereduce.reduce_noise(noise_clip=noise_clip,audio_clip=temp,verbose=True)

noise_clip small part of the signal(sample of noise, maybe 1s frame_duration)

audio_clip actual audio

 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
  • is "temp" is noise point? i just want to find where is noise in wav file not removing.. – sunchul choi Jul 17 '20 at 08:27
  • No, `temp` is you actual signal.In order to find noise part, fist u need to calculate the average energy of the signal.then u should split the signal into frame (duration 0.2 sec).Then you can compare the energy of the each frame to the average energy of the overall signal, if energy of the frame < avg energy of actual signal then we can consider that frame as a noise or silence. – badhusha muhammed Jul 17 '20 at 09:35