0

Currently, I'm trying to make an app that cancels out sound. I have everything setup, it can analyze what frequency is coming in from the microphone and it can play any frequency. Although, now I am stuck because I am trying to find a good algorithm. Could someone help me find an algorithm, and possibly explain the math involved in it because I'm in high school and have not taken physics yet. I have researched sound cancellation and get the main concept of it. I am working in Xcode using Swift, just to inform you.

  • Noise cancellation is more complex than simply inverting the sampled sound – meowgoesthedog May 09 '18 at 13:19
  • @meowgoesthedog Yes, I realize it is more complex than 'inverting the sampled sound". That is why I am asking for help with an algorithm, and an explanation that a high schooler can understand. – Jacob Kantor May 09 '18 at 16:03
  • As a side note, it might be worth migrating this to the DSP Stackexchange. Also, have you researched relevant algorithms yourself? A quick Google search gave [this](https://stackoverflow.com/questions/6503562/which-algorithm-is-used-for-noise-canceling-in-earphones?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa) and [this](https://github.com/markostam/active-noise-cancellation). – meowgoesthedog May 09 '18 at 16:06
  • @meowgoesthedog Yes, I have researched algorithms, and as I said before it is not in my level of understanding. If you would like I can show you one algorithm that I have been looking at. If possible could you explain? – Jacob Kantor May 09 '18 at 16:13
  • Yes it is good practice to show the fruits of your own research / efforts in question posts – meowgoesthedog May 09 '18 at 16:17
  • Here is the website I have been looking at. Towards the bottom is the formula. https://www.wired.com/2011/05/st_equation_noisecanceled/ – Jacob Kantor May 09 '18 at 16:30
  • That particular link is not very enlightening - the "formula" is just a Fourier transform, and a *continuous* one at that (so not very useful for numerical processing); it doesn't shed much light on precisely how noise cancellation works, other than simply stating that computing the frequency spectrum separates the signal into noise and useful sounds (which it technically doesn't - it merely extracts frequency components). Bottom line is, you'll be better off looking at professional papers and projects instead of layman blogs like Wired. – meowgoesthedog May 09 '18 at 16:42
  • Would you consider this article below to of good quality. https://dsp.stackexchange.com/questions/19539/questions-about-active-noise-cancellation – Jacob Kantor May 09 '18 at 17:23
  • That looks more like a hardware implementation question than software - two very different beasts – meowgoesthedog May 09 '18 at 17:47
  • @meowgoesthedog Then what article do you think is the best. I used the website you recommended. – Jacob Kantor May 09 '18 at 17:48
  • I gave two links in my second comment. Best to search directly for sample code / projects rather than delve straight into the math (which is not exactly easy to explain in a layman-friendly manner). For example I simply searched for "sound cancellation C++" – meowgoesthedog May 09 '18 at 18:04
  • @meowgoesthedog Thank you! Will try and use those sources. – Jacob Kantor May 10 '18 at 02:10

1 Answers1

1

You can check out Wiener Filtering from Wikipedia. Using a wiener filter, you can estimate the background noise up to a few samples. Then subtracting these estimated noise samples from the audio you may suppress the noise.

abyesilyurt
  • 399
  • 3
  • 13