psykulsk / RpiANC

Active Noise Control on Raspberry Pi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using the project in a room instead of in the headphone

leoheck opened this issue · comments

Hi.

I found your project after thinking to try this noise canceling idea for a room instead of in a headphone.

Do you have any idea if this idea could possibly work?

Also, since it is a small room, I could put the feedback mic close to the speaker and the main mic close to the noise source. Or maybe using a single mic without the feedback one.

Do you have any idea if your tool os going to work with only one microphone?

I'm still checking if I have everything to test this idea. Your project looks really good. Thanks for sharing it.

Hi!

So generally, when using the algorithms that I used in this project, you can only cancel out noise right next to the microphone that collects the error (leftover noise) signal. Same algorithms are used in noise cancelling systems inside cars, that put the error microphones inside the headrests, so close to your ears. Inside cars they are mainly concerned with cancelling out the engine noise so they put the microphone that collects the reference noise signal right next to the engine. Using these methods you cannot really cancel out noise in a larger area, like a room, because the algorithm simply tries to minimise the error signal. And since you are collecting it in a single place, it can be minimised only there. You can have multiple error microphones and multiple speakers that emit the cancelling signal. Simple example are of course the headphones. With headphones it is easier, because the error mic and speaker pair is isolated from the other mic speaker pair. If you would have multiple speakers in an open space you have to deal with interference between them.

In this project I achieved only some attenuation for a very simple noise signal, so it didn't work that great. I think the main blocker was the way how audio device drivers are working in linux. You get samples in blocks of samples (for my microphones the minimum was 32 samples), while when you are using digital signal processors, you usually do processing sample, by sample. Thanks to that, the time it takes to do a whole processing loop (getting reference signal, error signal, processing them and emitting the cancelling noise) is much shorter with dsp and the algorithm can "react" quickly to a changing noise signal.

If you have access to IEEE digital library (I unfortunately do not have it any more) I suggest you to checkout these articles/books:

Best of luck with your project!

Hey, thanks for the explanation @psykulsk . Yeah, the headphone is a beautiful environment to work on since it is a small and closed environment. I did not know that it was not work really well as you expected.

So, my main idea is to cancel out the washing machine noise. Maybe it is a good environment for give it a try. So, if I put the speakers close to it, or inside of it I may have such a good environment too. The only issue is that I am not sure if it will be easy to find microphones as yours. I will have to adapt something different.

What do you think of this crazy idea? Do you think it may work?

In that case I would suggest putting the reference microphone close to the washing machine and speakers, together with the error microphone, somewhere further away. The more you increase the distance between the reference and error microphones the more chance you have to succesfully cancel the noise. That's because, with the distance, the acoustic waves that carries the noise, have to travel further, while after you register the noise with the reference microphone you have more time to process it and run the adaptive filtering loop.

So a setup: reference mic next to the washing machine, speakers and the error mic further away (f.e. somewhere at your desk), could work and create a noise free zone next to the error microphone. I believe that with proper tuning of parameters and maybe enhancing/fixing this project you could achieve some attenuation, but if you would use a digital signal processor for that it could bring better results for sure.

I've used a DSP like this one https://www.hifiberry.com/shop/boards/hifiberry-dac-dsp/. It is pretty cool. You connect it to a raspberry pi and then you can "program" the dsp via a graphical IDE (https://www.analog.com/en/design-center/evaluation-hardware-and-software/software/ss_sigst_02.html) and upload it wirelessly to the DSP (Raspberry Pi acts as a server and passes data between the DSP and your host). However, it took me a long time to configure it to work with my microphones and speakers (as I remember there were some errors in the datasheet https://support.hifiberry.com/hc/en-us/community/posts/360003426118-DAC-DSP-board-DSP-analog-audio-output-I2S-input).

As for the microphones, they are still available on the adafruit site (https://www.adafruit.com/product/3421).