# Noise reduction on wave file

I have created a simple plot of waveforms using matplotlib of 2 wave files on python. Here is the code:

import matplotlib.pyplot as plt
import numpy as np
from statistics import mean
import wave
import sys

plt.figure(1)

class Audio:
def __init__(self, audio):
self.audio = wave.open(audio,'r')
self.signal = np.fromstring(self.signal, 'Int16')
self.fr = self.audio.getframerate()
self.time = np.linspace(0, 100, num=(len(self.signal)))
self.fft = np.fft.fft(self.signal)

def plot(self):
plt.title("Audio waveforms")
plt.plot(self.time, self.signal, '.')

gana = Audio('gana.wav')
humm = Audio('humm.wav')

gana.plot()
humm.plot()
plt.show()


The output is this:

What I want to do is remove the noise from both the files. I have seen many examples that use FFT to remove noise. I have taken out the fft of the signals of these wave files but the problems I am having is I have no idea of what to do after taking out the FFT. Do I have to plot the FFT or do something else?

P.S The noise in the green wave form is hiss and in the blue is background sound. So is there any way that I could get rid of both of these noises? Thanks.

## migrated from stackoverflow.comJul 27 '15 at 14:14

This question came from our site for professional and enthusiast programmers.

• This is quite sparse info to go on. Before you decide on a denoising algorithm, you need some information about your noise, is it random noise or is it somehow static, is it quasi static? What is its spectrum? Is it corellated with the audio signal? – sobek Jul 27 '15 at 7:27
• It's a song....I did not understand any of your questions though. What is the spectrum of a audo? What do you mean by correlation of audio signals? – Mohammad Areeb Siddiqui Jul 27 '15 at 7:33
• The spectrum of an audio tells you what frequencies are in it. Basically to remove noise, you need to know "where it is", and "what kind of noise" it is, here we don't have enough info to tell you how to remove it. (Although in a naive approach, you could try to remove high frequencies, ie replace the last values of the fft by zero then do a ifft, since it's often where there is more noise than data, but I wouldn't be too confident about the result). – Nihl Jul 27 '15 at 7:41
• Since this question is more about the algorithmic approach than program language specific issues, i have flagged it to be transferred to the signal processing stack exchange site. – sobek Jul 27 '15 at 7:54
• stackoverflow.com/a/35963967/2128723 should help – Ronak Agrawal Nov 29 '16 at 12:34