I want to remove noise(hisss) from a wave audio file. The full wave audio graph is here :
I'm using below code. It might be a stupid attempt but in matlab i've noticed that the noise part's amplitude varies between 0-3000. So i tried to make all of them to zero and save new frames to a new wav file. Somehow it did not work!
import wave
import sys
ip = wave.open(sys.argv[1], 'r')
op = wave.open(sys.argv[2], 'w')
op.setparams(ip.getparams())
for i in range(ip.getnframes()):
iframes = ip.readframes(1)
amp = int(iframes.encode('hex'),16)
if amp > 32767:
amp = 65535 - int(iframes.encode('hex'),16)#-ve
print amp
else:
amp = int(iframes.encode('hex'),16)#+ve
print amp
if amp < 2000:
#make it zero
final_frame = '\x00\x00'
else:
#Keep the frame
final_frame = iframe
op.writeframes(final_frame)
op.close()
ip.close()
After running above script it became this:
The noise part (<= 2500 ) is still present..So Please suggest how i can remove those unnecessary parts !
Best Regards,