4

I have recorded a sound using AVFoundation Framework. It plays well but it contains a lot of surrounding noise.

I need to remove this noise and also amplify the sound to increase the volume.

Can anybody please help with some sample code. Or please guide me how can I proceed further.

Jassi
  • 537
  • 8
  • 21
  • This is likely to be non-trivial. (i.e. beyond the scope that could be adequately addressed in a single SO question) You should google around some more for "CoreAudio noise reduction normalization" and get some background. That'd allow you to ask more pointed questions that are more likely to garner useful answers. – ipmcc Jun 11 '13 at 12:32
  • I googled a lot. But I am not sure which API's to check and how to convert a sound to the base level which can be used by other API's to filter it. Please help. – Jassi Jun 11 '13 at 12:34
  • This questions covers normalization in some depth: http://stackoverflow.com/questions/14327091/normalize-audio-file-obj-c – ipmcc Jun 11 '13 at 12:35
  • Thank you. I will look into this, and will revert back. – Jassi Jun 11 '13 at 12:39
  • It will probably be much simpler/better to just record the sound again, in a more favourable environment. – Paul R Jun 11 '13 at 12:44
  • Yes Paul, you are right, but what if there is a noise in the sound and I need to remove it, Also I need to amplify it. – Jassi Jun 11 '13 at 12:47
  • Do you have to sweeten the audio in code (in your app)? You can't clean it up in an audio editor? – Marcus Adams Jun 11 '13 at 12:53
  • @MarcusAdams: Yes, I have to do it via code in my app. – Jassi Jun 11 '13 at 12:58
  • @Jassi: it's almost impossible to do this after the fact, unless the noise is outside the frequency range of interest, or unless you have some other *a priori* knowledge of the signals. – Paul R Jun 11 '13 at 13:09
  • @ipmcc: I have gone through this link "http://stackoverflow.com/questions/14327091/normalize-audio-file-obj-c", and able to read the Audio in a buffer. But Now I am stuck as how to perform Normalization. Can you please guide. I need to increase the volume. – Jassi Jun 12 '13 at 05:27
  • @Jassi: Are you able to remove background noise from the audio file? I'm also looking for the same. – Sachin Kumaram Mar 21 '17 at 14:09

1 Answers1

0

You may be able to convert to the frequency domain, process in the frequency domain to remove noise, and then convert back to the time domain.

To do this you could use overlapping frames. In fact you could lift the code straight out of here: http://www.dspdimension.com/admin/pitch-shifting-using-the-ft/ and then just replace the few lines where he is accomplishing pitch shifting with your own algorithm to reduce noise.

But as Paul R pointed out, you won't be able to design an algorithm that will handle all situations.

You should really look at the data in the frequency domain (there are plenty of spectralyzer apps available for the iPhone for example) and get some sort of idea of where the target signal is, and where the noise is, and whether you are likely to be able to separate them: if you can't do it easily by eye, you have practically no chance of getting an algorithm to do it.

P i
  • 29,020
  • 36
  • 159
  • 267