whatevs
Posts: 1
Joined: Tue Jun 19, 2012 11:01 am

Active noise (acoustic) cancellation

Tue Jun 19, 2012 11:30 am

I'm considering using a Raspberry Pi as the basis of a noise cancellation unit.

The aim of the project is to combine a loud speaker, microphone and Raspberry Pi to create a small unit which can be situated next to a constant sound source to provide active noise reduction (working in a similar manner to 'noise cancelling' headphones).

The intended application is to reduce the noise created by an office server or a portable air-conditioning unit.

The aim of this post is to find out whether anyone has attempted anything similar, or simply whether anyone has any advice, hints or tips that could help me in the right direction.

Thanks in advance for any replies!

Richard_P
Posts: 39
Joined: Mon Jun 11, 2012 10:43 am

Re: Active noise (acoustic) cancellation

Tue Jun 19, 2012 1:07 pm

whatevs wrote:I'm considering using a Raspberry Pi as the basis of a noise cancellation unit.

The aim of the project is to combine a loud speaker, microphone and Raspberry Pi to create a small unit which can be situated next to a constant sound source to provide active noise reduction (working in a similar manner to 'noise cancelling' headphones).

The intended application is to reduce the noise created by an office server or a portable air-conditioning unit.

The aim of this post is to find out whether anyone has attempted anything similar, or simply whether anyone has any advice, hints or tips that could help me in the right direction.

Thanks in advance for any replies!
I am trying a similar thing, except I want to use it in an aircraft. I plan to use use gstreamer with the bandpass filter component (300hz to 3khz) with USB sound cards for in/out. (although the cheap USB dongles pass all the PSU noise right though)

http://gstreamer.freedesktop.org/data/d ... bband.html

Richard

Jojoba86
Posts: 2
Joined: Tue Feb 26, 2013 1:30 pm

Re: Active noise (acoustic) cancellation

Tue Feb 26, 2013 1:32 pm

Just wondering if you made any progress with this? It's a project I would be interested in, and I am just wondering if it is possible to pull off with the Raspberry Pi.

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: Active noise (acoustic) cancellation

Tue Feb 26, 2013 2:33 pm

Noise cancelling headphones work because the microphone connected to an amplifier produces an output that is a 180 degrees out of phase (inverted) to the noise source.
When combining the output and the original noise source this has the effect of reducing the overall noise to the ear because the airflow is effectively balanced out.

For a noise cancelling system to work:
- the microphone must sits directly behind the speaker if the distance is too far apart you create a phase shift due to fact that the speed of sound isn't as all that fast.
Having your microphone placed in different locations would also affect the acoustic response because sound can bounce off surfaces and then amplify or attenuate certain frequencies.
Only a "dead room" would be immune from this problem or if the noise source has a single set frequency since the only parameter involved would be the phase shift of the waveform.

- the frequency response across the audible spectrum for the microphone + amplifier and speaker must be matched close as possible otherwise when cancelling audio certain frequencies will get attenuated more than others.

- audio cancellation can only be achieved in a small confined area like the human ear or a certain location in your room, it would be impossible attenuate noise everywhere you move.

If you're going to use the Pi to record and play audio this would require a sound card with 0 or no latency which would be practically impossible to achieve.
If the noise source has a certain buzz or high pitch whine then a project involving the Pi maybe feasible.

Richard S.

Jojoba86
Posts: 2
Joined: Tue Feb 26, 2013 1:30 pm

Re: Active noise (acoustic) cancellation

Tue Feb 26, 2013 2:51 pm

redhawk - while much of what you say is true, if you allow for some limitations in what you aim for you I was wondering if you could make something work. The Pi does need need to have zero latency for example, as the speed of sound is much slower than the speed of electrical signals. If you place the microphone and speaker 1 cm apart* for example you get 0.3 ms to do the processing. Though that does sound a little optimistic, I am guessing by the time you have the signal go through a sound card, get processed, and be played through the speaker you are at a fair few ms.

I agree that this would be very difficult in a room, I was only thinking of doing it in a pair of headphones.

*Edit - Obviously then the noise cancelling will only work for noises in one direction, that is why this project would be educational rather than for anything practical/as good as commercial analogue offerings.

akaantz
Posts: 1
Joined: Sun Mar 17, 2013 11:26 pm

Re: Active noise (acoustic) cancellation

Mon Mar 18, 2013 1:52 am

Some awesome geek genius needs to come up with a raspberry pi anc aftermarket addon for vehicles...

JohnScarlett
Posts: 3
Joined: Fri Oct 04, 2013 4:01 pm

Re: Active noise (acoustic) cancellation

Mon Oct 07, 2013 5:06 pm

Jojoba86 wrote:If you place the microphone and speaker 1 cm apart* for example you get 0.3 ms to do the processing. Though that does sound a little optimistic[/i]
When I described my problem I wrote about noise reduction system being a separate unit that can broadcast FM on cochlear implant and hearing aids' frequencies. In my mind I was going to put the noise reduction system between the deaf kids and their FM receiver hearing aids, and the worst of the sound sources. I assumed this would be enough separation to largely offset any latency. The separation would be measured in meters.

User avatar
cyrano
Posts: 714
Joined: Wed Dec 05, 2012 11:48 pm
Location: Belgium

Re: Active noise (acoustic) cancellation

Mon Oct 07, 2013 7:54 pm

I have been tinkering with noise cancellation a very long time. The only relatively simple way to make it work, is the analog way, as redhawk explained.

To do DSP effects on a computer, you need to keep sub 25 msec latency. Hard to do, especially with USB audio interfaces and even harder with the Pi.

You could consider an ADC over SPI, but these are not available off-the-shelf. You'd need to build it, or buy one of the ADC boards available for the Pi.

As for your problem in the classroom, start with getting a good cardiod lavalier mic. Attach it near enough to your voice to pick up a decent input signal.

Then start by experimenting with a phase inverted mixer.

As for the sound of fans, it can't be filtered. Not in the analog, nor in the digital domain. It's too close to white noise and as such, too unpredictable to generate a noise killer anti-sound. Just filtering off higher frequencies (> 5kHz) will be about all you can do.

Engine sounds can be fairly predictable, but wind noise from the plane will blur your signal. I've never tried it, but it might just work.

Try looking for open source DAW plugins (VST format, usually) and see if you can use some of the code. Using an existing VST means you can experiment with the various DSP functions on your computer in software such as Audacity. Much easier to test the effect before you start implementing it on the Pi.

And to improve volume levels, you need to compress. Which is also available as a VST plugin. Also a lot easier than noise cancellation...

kevrone
Posts: 1
Joined: Wed Nov 13, 2013 4:45 pm

Re: Active noise (acoustic) cancellation

Wed Nov 13, 2013 4:55 pm

cyrano wrote:I have been tinkering with noise cancellation a very long time
Hey cyrano,
I'm a complete newb when it comes to noise cancellation tech. Are there any off the shelf products or diy solutions for dealing with noise transmitting walls? I have a very thin wall between me and my roommate and it would be pretty rad if I could solve the noise problem with active cancellation. If I used an analog solution (mic + speaker) and mounted it in the center of the wall, do you think that would achieve anything significant?

Thanks

bsnayak
Posts: 13
Joined: Fri Jun 13, 2014 1:30 pm

Re: Active noise (acoustic) cancellation

Tue Jun 17, 2014 9:29 am

Dear Everyone.

I am running my speech recognition code on Rasberry which i am applying on moving platform to do several operation using voice control. It works fine when noise is low but as the noise level increases it degrades with its performance.

I found when i tried to recognize the audio files after processing htme through matlab active noise cancellation scheme. It is getting recognized by the decoder.

Kindly let me know what would be the correct way to implement this Active noise cancellation first in the raspberry and then decode it later on my decoder continuously?

Best Regards

Nayak

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: Active noise (acoustic) cancellation

Tue Jun 17, 2014 11:00 am

There are several things you could do to improve your noise level issues by processing the incoming audio before it's sent to the Pi for recording.

Firstly make sure you have a good quality microphone and one sold as noise cancelling or uni-directional pick up they suppress noise better than traditional omnidirectional or cardioid.
Next you'll need a microphone pre-amp circuit with band-pass filtering to remove low frequency and high frequencies while faithfully maintaining the human voice with less background noise.
And finally a noise gate / expander circuit this adds more dynamics to loudness vs quietness of audio so background noise levels roll off faster or are totally eliminated.

Richard S.

bsnayak
Posts: 13
Joined: Fri Jun 13, 2014 1:30 pm

Re: Active noise (acoustic) cancellation

Wed Jun 18, 2014 2:33 pm

Hello

Thank you for your reply.

Can you suggest me one "microphone pre-amp circuit with band-pass filtering" which is supported by raspberry pi. I would also like to know the basics of connecting them with raspberry and Do you need to change some settings with raspberry for that??

Same question for " noise gate / expander circuit "

Microphone pre-amp circuit with also amplify the noise level, How to tackle this issue ?

If you have already implemented them and if you have mentioned it in your website , please do share a link of that. WOuld be helpful to know more on this.

Thank you

redhawk wrote:There are several things you could do to improve your noise level issues by processing the incoming audio before it's sent to the Pi for recording.

Firstly make sure you have a good quality microphone and one sold as noise cancelling or uni-directional pick up they suppress noise better than traditional omnidirectional or cardioid.
Next you'll need a microphone pre-amp circuit with band-pass filtering to remove low frequency and high frequencies while faithfully maintaining the human voice with less background noise.
And finally a noise gate / expander circuit this adds more dynamics to loudness vs quietness of audio so background noise levels roll off faster or are totally eliminated.

Richard S.

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: Active noise (acoustic) cancellation

Wed Jun 18, 2014 4:04 pm

If you're not familiar with analogue electronics then it's going to prove difficult building a noise gate as it's quite a involved circuit.
There are however some IC options like the SSM2166 to simplify the task and even pre-made boards like http://www.ebay.co.uk/itm//171337964731 if you're prepared to spend the money.
You could probably skip the band pass part since most cheapo electret/condenser microphones have poor bass response and audio capture at 8kHz would ultimately remove high frequency noise anyway.

Years ago I built a crude noise gate using a long-tail pair preamp stage where one input is normal while the other input has an audio limiter.
Since this cancels both inputs only audio which has been limited due to levels above threshold would would pass through to the output.
It worked quite well but the audio limiter being slightly non-linear did add a certain level of distortion to the audio output.
I guess for voice recognition it doesn't really matter so long as it can make out familiar patterns in the audio capture.

Richard S.

KenoRosarioPH
Posts: 41
Joined: Wed Nov 18, 2015 1:51 pm

Re: Active noise (acoustic) cancellation

Tue Dec 08, 2015 8:54 am

Hello Good Day! I was able to dig this post out of the internet and it is almost similar to what i'm building for my current project the difference is i am first to record a signal(w/ noise) and playback it (reduced noise) . I am stuck with the noise cancellation part. Thanks Guys

polska
Posts: 1
Joined: Thu Sep 08, 2016 2:17 pm

Re: Active noise (acoustic) cancellation

Thu Sep 08, 2016 2:19 pm

Hy !

I'm doing a similar code for some experiments.

Have you reached your project ? Can you share what you have done ?

Thanks a lot

MATRIX_Alfred
Posts: 4
Joined: Fri Sep 09, 2016 4:19 pm

Re: Active noise (acoustic) cancellation

Fri Sep 09, 2016 8:54 pm

Hey whatevs,

So the best way to do active noise cancelation is with the use of multiple microphones. This way you can differentiate between the sound coming from your speaker that is in one direction as well as the office server or any other sound that can be in any other direction. Using the 8 microphone array on the MATRIX Creator you can easily accomplish it. In fact this is very similar to how Amazon Alexa is able to detect your voice so well.

Heres the link to get it on Indiegogo: https://www.indiegogo.com/projects/matr ... oards-led/

martinmmps
Posts: 44
Joined: Fri Apr 29, 2016 5:47 pm

Re: Active noise (acoustic) cancellation

Thu Mar 02, 2017 8:49 pm

I really want to make a noise cancellation machine and for it i have a speaker and a microphone isn't there any simple piece of code in python you can use to cancel all noise in the room :?: :?: :?:

Thanks :!:

Pingme67
Posts: 1
Joined: Fri Jul 27, 2018 7:07 pm

Re: Active noise (acoustic) cancellation

Fri Jul 27, 2018 7:23 pm

I am looking to do the same thing I have a room that is maybe 12X12 with an ice machine and an no door. it has a very loud compressor.

not looking for a cone of silence just need to knock the Db down 6+ anything out there yet??
Also thinking of the same for my server room. Both are a consent level and freq

Thanks Tim

sanasahadev
Posts: 1
Joined: Mon Sep 03, 2018 1:05 pm

Re: Active noise (acoustic) cancellation

Mon Sep 03, 2018 1:06 pm

I suggest sound absorbing wall panels, these are often used in large rooms projects to reduce echo. Our sound absorbing acoustic panels are made of 100% polyester fiber, and were developed to replace glass wool, rock wool, and polyurethane foam. These sound absorbing panels can be recycled and often used in classrooms, airports, restaurants, home theatres, apartment buildings, conference room, laboratories, radio room, stadiums, and so on.

Return to “Automation, sensing and robotics”