Forums > MaxMSP

noise cancellation

January 3, 2008 | 8:31 pm

im fairly new to max/msp and im undertaking a noise canceling project, i need to cancel the incoming signal with an inverted phase version of the original. issues arose with the latency of passing one of the split signals into the pfft~ object. im not sure how do deal with this latency such that it maximizes the cancellation process back in the main patcher.some sort of feedback from the main patcher to the pfft patcher needs to be to be carried out. any thoughts?


January 3, 2008 | 9:23 pm

you can invert a signal simply by multiplying it by -1. I’m not sure what you are doing in fft. but maybe this is helpful?


January 3, 2008 | 9:44 pm

i think the inversion of the signal needs to carried out within the frequency domain, i want to cancel only selected frequencies from within the signal. so im thinking of shifting the phase of individual selected bins from a cartpol object. im just a bit lost as to how to select and phase shift certain bins. any ideas?


January 4, 2008 | 10:49 am

Hi Ben,

Unless the extracted noise is sample by sample identical to the origiinal
signal, just inverting won;t do much.

As far as the latency goes you can compensate by having a delayed copy of
the untreated and then adding afterwards.

best, P

On 03/01/2008, Leafcutter John

wrote:
>
>
> you can invert a signal simply by multiplying it by -1. I’m not sure what
> you are doing in fft. but maybe this is helpful?
> –
> http://www.leafcutterjohn.com
>
> "The Forest And The Sea"
> Out on Staubgold Records
> Staubgold 68 CD/LP
>


January 4, 2008 | 11:25 am

One good way to cancel noise is in the frequency domain.
In your Pfft, use a < ~ on the amplitude (after your cartopol) to trigger
gates so that you only frequency bins that are above a certain amplitude.
What this does is cut out all quiet sounds, allowing only louder desired
sounds.
As my example (hopefully) shows. Haven’t actually tested this, so sorry if
it doesn’t work.
This is a good method as it can be rather effective at removing noise
without affecting the desired signal. Avoid setting the noise level to too
high a number as you will be cutting out parts of your desired signal and
will create audible artifacts.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 326 214 31 9109513 gate~;
#P newex 290 216 31 9109513 gate~;
#P flonum 231 138 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 214 181 27 9109513 < ~;
#P newex 289 242 46 9109513 poltocar~;
#P newex 290 143 46 9109513 cartopol~;
#P newex 288 280 45 9109513 fftout~ 1;
#P newex 289 104 40 9109513 fftin~ 1;
#P comment 187 119 100 9109513 minimum amplitude;
#P comment 340 314 24 9109513 Joe;
#P fasten 4 0 6 0 295 169 219 169;
#P connect 4 0 8 1;
#P fasten 6 0 8 0 219 207 295 207;
#P fasten 6 0 9 0 219 207 331 207;
#P connect 4 1 9 1;
#P connect 9 0 5 1;
#P connect 8 0 5 0;
#P connect 7 0 6 1;
#P connect 5 1 3 1;
#P connect 5 0 3 0;
#P connect 2 1 4 1;
#P connect 2 0 4 0;
#P window clipboard copycount 10;

On 03/01/2008, ben Gilman wrote:
>
>
> im fairly new to max/msp and im undertaking a noise canceling project, i
> need to cancel the incoming signal with an inverted phase version of the
> original. issues arose with the latency of passing one of the split signals
> into the pfft~ object. im not sure how do deal with this latency such that
> it maximizes the cancellation process back in the main patcher.some sort
> of feedback from the main patcher to the pfft patcher needs to be to be
> carried out. any thoughts?
>


January 4, 2008 | 1:39 pm

I suppose this is related. I have some digital hardware synths coming into
MSP via an 828 and a mixer. I am getting a lot of machine noise in the
audio. When I unplug the power transformer from my MacBook it reduces and
removing the second monitor reduces it further. Any suggestions.

Cheers
Gary Lee Nelson
Oberlin College
http://www.timara.oberlin.edu/GaryLeeNelson


January 4, 2008 | 2:51 pm

If it’s from a transformer, then there’s a strong chance it’s 50Hz, so
filtering about that range might in theory reduce it

On 04/01/2008, Gary Lee Nelson wrote:
>
> I suppose this is related. I have some digital hardware synths coming
> into MSP via an 828 and a mixer. I am getting a lot of machine noise in the
> audio. When I unplug the power transformer from my MacBook it reduces and
> removing the second monitor reduces it further. Any suggestions.
>
> Cheers
> Gary Lee Nelson
> Oberlin College
> http://www.timara.oberlin.edu/GaryLeeNelson
>
>
>


January 4, 2008 | 3:57 pm

50Hz (60Hz in USA) is hum. My noise is broader band and somehow related to
computer signals (see below). I have all of my audio devices connected to
one power point and all the computer stuff to another. What else?

On 1/4/08 9:51 AM, "Joe Bicker" wrote:

> If it’s from a transformer, then there’s a strong chance it’s 50Hz, so
> filtering about that range might in theory reduce it
>
> On 04/01/2008, Gary Lee Nelson wrote:
>> I suppose this is related. I have some digital hardware synths coming into
>> MSP via an 828 and a mixer. I am getting a lot of machine noise in the
>> audio. When I unplug the power transformer from my MacBook it reduces and
>> removing the second monitor reduces it further. Any suggestions.
>>
>> Cheers
>> Gary Lee Nelson
>> Oberlin College
>> http://www.timara.oberlin.edu/GaryLeeNelson
>> < http://www.timara.oberlin.edu/GaryLeeNelson>
>>
>>
>
>
>

Cheers
Gary Lee Nelson
Oberlin College
http://www.timara.oberlin.edu/GaryLeeNelson


January 4, 2008 | 3:59 pm

ben Gilman schrieb:
> i think the inversion of the signal needs to carried out within the
> frequency domain, i want to cancel only selected frequencies from
> within the signal. so im thinking of shifting the phase of individual
> selected bins from a cartpol object. im just a bit lost as to how to
> select and phase shift certain bins. any ideas?

Maybe a multiplication with zero? seems easier…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com


January 4, 2008 | 4:20 pm

Are the mixer-to-interface (828) connections balanced? If not, that
might help. If they are, you might need to lift the ground on one end
- either send or receive end, but not both – (disconnect the ground
connection inside the cable/plug) of each of the balanced cables. Are
the audio and/or computing devices plugged in to a power conditioner/
transformer? (Furman, for example, sells a whole line of them). Noise
in audio systems is often a real pain to sort out.

On Jan 4, 2008, at 8:57 AM, Gary Lee Nelson wrote:

> 50Hz (60Hz in USA) is hum. My noise is broader band and somehow
> related to computer signals (see below). I have all of my audio
> devices connected to one power point and all the computer stuff to
> another. What else?

—-
Steven M. Miller
Professor, Contemporary Music Program
College of Santa Fe

Home < http://pubweb.csf.edu/~smill>
SFIFEM <
http://sfifem.csf.edu>
Atrium Sound Space <
http://atrium.csf.edu>
OVOS <
http://pubweb.csf.edu/~smill/ovos.html>
CMP <
http://www.csf.edu/csf/academics/cmp/index.html>


January 4, 2008 | 4:28 pm

If it’s an analogue connection from mixer to 828, are you using balanced
cables? It could be a cable microphony problem …


Owen

Gary Lee Nelson wrote:
> 50Hz (60Hz in USA) is hum. My noise is broader band and somehow related to
> computer signals (see below). I have all of my audio devices connected to
> one power point and all the computer stuff to another. What else?


January 4, 2008 | 4:33 pm

Are the mixer-to-interface (828) connections balanced? If not, that
might help. If they are, you might need to lift the ground on one end
- either send or receive end, but not both – (disconnect the ground
connection inside the cable/plug) of each of the balanced cables. Are
the audio and/or computing devices plugged in to a power conditioner/
transformer? (Furman, for example, sells a whole line of them). Noise
in audio systems is often a real pain to sort out.

On Jan 4, 2008, at 8:57 AM, Gary Lee Nelson wrote:

> 50Hz (60Hz in USA) is hum. My noise is broader band and somehow
> related to computer signals (see below). I have all of my audio
> devices connected to one power point and all the computer stuff to
> another. What else?

—-
Steven M. Miller
Professor, Contemporary Music Program
College of Santa Fe

Home < http://pubweb.csf.edu/~smill>
SFIFEM <
http://sfifem.csf.edu>
Atrium Sound Space <
http://atrium.csf.edu>
OVOS <
http://pubweb.csf.edu/~smill/ovos.html>
CMP <
http://www.csf.edu/csf/academics/cmp/index.html>


January 4, 2008 | 5:56 pm

Quote: Stefan Tiedje wrote on Fri, 04 January 2008 15:59
—————————————————-
> ben Gilman schrieb:
> > i think the inversion of the signal needs to carried out within the
> > frequency domain, i want to cancel only selected frequencies from
> > within the signal. so im thinking of shifting the phase of individual
> > selected bins from a cartpol object. im just a bit lost as to how to
> > select and phase shift certain bins. any ideas?
>
> Maybe a multiplication with zero? seems easier…
>
> Stefan
>
> —
> Stefan Tiedje————x——-
> –_____———–|————–
> –(_|_ —-|—–|—–()——-
> — _|_)—-|—–()————–
> ———-()——–www.ccmix.com
>
>
—————————————————-

im basically trying to construct a noise canceling simulation. i want control over the frequencies that are cancelled within the residual signal. i started out by splitting an input signal and sending both signal through an pfft. one of the signals was inverted and the amplitudes of the bins were passed into a buffer. here multi-sliders were used as control over which amplitude bins were zeroed. the signal was then passed out the buffer and back to the main patcher along with the unchanged signal. back in main patcher the two signals were added together and output. this worked very well but then i came to the realization that this is no real representation. both the split signals were undergoing the same delay as they were both being passed into the pfft. at present im trying to make it function without passing the unchanged signal into the pfft. this would obviously mean there would be some latency when the two signals are added together back in the main patcher. because im passing periodic signals into the system i thought i could shift the phase of the signal passed into the pfft to allow for the latency. but it seems that a shift in phase in the pfft will only have the affects of canceling certain frequencies within the residual signal. almost like there is different latencies on different bins. the patcher below shows the affects.

main patcher -

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 145 252 27 196617 +~;
#P user spectroscope~ 184 311 300 100 20 0 0 0 1 1 0 0 0 0 0 0;
#X frgb 224 224 224;
#X brgb 255 255 255;
#X rgb2 0 0 0;
#X rgb3 243 204 204;
#X rgb4 255 0 0;
#X rgb5 184 184 184;
#X rgb6 0 0 0;
#X rgb7 0 0 0;
#X rgb8 255 255 255;
#X rgb9 255 0 0;
#X rgb10 255 191 0;
#X rgb11 0 191 127;
#X rgb12 127 0 127;
#X rgb13 0 0 0;
#X range 0. 1.2;
#X domain 0. 22050.;
#X done;
#P number 205 75 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 162 76 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 162 141 27 196617 +~;
#P newex 205 99 40 196617 cycle~;
#P newex 162 211 97 196617 pfft~ freq1 1024 2;
#P user ezdac~ 128 313 172 346 0;
#P newex 162 100 40 196617 cycle~;
#P connect 8 0 1 0;
#P fasten 4 0 8 0 167 176 150 176;
#P connect 5 0 0 0;
#P connect 0 0 4 0;
#P connect 4 0 2 0;
#P fasten 2 0 8 1 167 242 167 242;
#P connect 8 0 1 1;
#P fasten 3 0 4 1 210 129 184 129;
#P connect 8 0 7 0;
#P connect 6 0 3 0;
#P window clipboard copycount 9;

pfft – patcher (save as freq1)

#P window setfont "Sans Serif" 9.;
#P flonum 207 167 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 190 197 27 196617 +~;
#P newex 147 238 53 196617 poltocar~;
#P newex 147 132 53 196617 cartopol~;
#P newex 147 268 53 196617 fftout~ 1;
#P newex 147 100 96 196617 fftin~ 1;
#P connect 5 0 4 1;
#P connect 3 1 1 1;
#P connect 4 0 3 1;
#P connect 2 1 4 0;
#P connect 0 1 2 1;
#P connect 3 0 1 0;
#P connect 2 0 3 0;
#P connect 0 0 2 0;
#P window clipboard copycount 6;

shifting the phase in the pfft subpatcher shows the amplitude of different frequencies in the main going both up and down. im not sure what to do i need control over the latency somehow.


January 4, 2008 | 5:59 pm

You say noise. Do you mean noise as hum or wide band noise, like hiss or
tranny thermal noise?. Monitor as in screen or speakers?

CRT’s where notorious for interference ( as a guitarist it was a real nag!
single coils.) Which synths are plugged in? Maybe we can narrow it down a
bit further and nail it.

On 04/01/2008, Joe Bicker wrote:
>
> If it’s from a transformer, then there’s a strong chance it’s 50Hz, so
> filtering about that range might in theory reduce it
>
> On 04/01/2008, Gary Lee Nelson wrote:
>
> > I suppose this is related. I have some digital hardware synths coming
> > into MSP via an 828 and a mixer. I am getting a lot of machine noise in the
> > audio. When I unplug the power transformer from my MacBook it reduces and
> > removing the second monitor reduces it further. Any suggestions.
> >
> > Cheers
> > Gary Lee Nelson
> > Oberlin College
> > http://www.timara.oberlin.edu/GaryLeeNelson
> >
> >
> >
>
>
>


January 4, 2008 | 6:53 pm


January 4, 2008 | 7:04 pm

Can’t you simply calculate the latency of the fft’d signal, and delay
the direct signal to match before adding them together? It seems like
it should work.

On Jan 4, 2008, at 5:56 PM, ben Gilman wrote:

>
> im basically trying to construct a noise canceling simulation. i
> want control over the frequencies that are cancelled within the
> residual signal. i started out by splitting an input signal and
> sending both signal through an pfft. one of the signals was
> inverted and the amplitudes of the bins were passed into a buffer.
> here multi-sliders were used as control over which amplitude bins
> were zeroed. the signal was then passed out the buffer and back to
> the main patcher along with the unchanged signal. back in main
> patcher the two signals were added together and output. this worked
> very well but then i came to the realization that this is no real
> representation. both the split signals were undergoing the same
> delay as they were both being passed into the pfft. at present im
> trying to make it function without passing the unchanged signal
> into the pfft. this would obviously mean there would be some
> latency when the two signals are added together back in the main
> patcher. because im!
>
> passing periodic signals into the system i thought i could shift
> the phase of the signal passed into the pfft to allow for the
> latency. but it seems that a shift in phase in the pfft will only
> have the affects of canceling certain frequencies within the
> residual signal. almost like there is different latencies on
> different bins. the patcher below shows the affects.
>
>

—-
Steven M. Miller
Professor, Contemporary Music Program
College of Santa Fe

Home < http://pubweb.csf.edu/~smill>
SFIFEM <
http://sfifem.csf.edu>
Atrium Sound Space <
http://atrium.csf.edu>
OVOS <
http://pubweb.csf.edu/~smill/ovos.html>
CMP <
http://www.csf.edu/csf/academics/cmp/index.html>


January 4, 2008 | 7:24 pm

yes that would work but it needs to be applied to real world sounds, eventually the input to the system will be a microphone and the system will be functioning on periodic sounds within a real world environment. essentially what your suggesting is very similar to what i did originally, apart from i added a delay by passing the direct signal through pfft to incur the delay.


January 4, 2008 | 8:51 pm

Quote: smill wrote on Fri, 04 January 2008 19:04
—————————————————-
> Can’t you simply calculate the latency of the fft’d signal, and delay
> the direct signal to match before adding them together? It seems like
> it should work.
>
> On Jan 4, 2008, at 5:56 PM, ben Gilman wrote:
>
> >
> > im basically trying to construct a noise canceling simulation. i
> > want control over the frequencies that are cancelled within the
> > residual signal. i started out by splitting an input signal and
> > sending both signal through an pfft. one of the signals was
> > inverted and the amplitudes of the bins were passed into a buffer.
> > here multi-sliders were used as control over which amplitude bins
> > were zeroed. the signal was then passed out the buffer and back to
> > the main patcher along with the unchanged signal. back in main
> > patcher the two signals were added together and output. this worked
> > very well but then i came to the realization that this is no real
> > representation. both the split signals were undergoing the same
> > delay as they were both being passed into the pfft. at present im
> > trying to make it function without passing the unchanged signal
> > into the pfft. this would obviously mean there would be some
> > latency when the two signals are added together back in the main
> > patcher. because im!
> >
> > passing periodic signals into the system i thought i could shift
> > the phase of the signal passed into the pfft to allow for the
> > latency. but it seems that a shift in phase in the pfft will only
> > have the affects of canceling certain frequencies within the
> > residual signal. almost like there is different latencies on
> > different bins. the patcher below shows the affects.
> >
> >
>
> —-
> Steven M. Miller
> Professor, Contemporary Music Program
> College of Santa Fe
>
> Home < http://pubweb.csf.edu/~smill>
> SFIFEM <
http://sfifem.csf.edu>
> Atrium Sound Space <
http://atrium.csf.edu>
> OVOS <
http://pubweb.csf.edu/~smill/ovos.html>
> CMP <
http://www.csf.edu/csf/academics/cmp/index.html>
>
>
>
—————————————————-

i’ve just tried what you suggested and it still has the same affect. not sure what is going on or what can be done to resolve it. has no one else experienced this problem.


January 5, 2008 | 9:36 pm

ben Gilman schrieb:
> the patcher below shows the affects.

This will never work, if you add a constant to the phase information of
a bin, it will just change the frequency of that bin if you
resynthesize. Still the easiest way to get rid of a bin is to set it to
zero, thats what all denoiser plugs do.
The methods the noisecanceling headphones are using isn’t a fft method
and only works for very low noise, its just inverting a (filtered) signal…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com


January 7, 2008 | 9:14 pm

[not too off topic I don't think]

I am interested in the kind of noise cancellation used in telephony to avoid echoes. (Skype/mobile handsets etc)

Does anyone give any insight into this technique? Does it have a name, is it described in any book? Has anyone worked on a max msp implementation?

thanks in advance,
Peter


January 9, 2008 | 7:59 pm

What you are looking for is called Acoustic Echo Cancellation and is a closely guarded dark art practiced by DSP companies and makers of conference phones.

Performance is highly dependent on room reflections, distortion in both speaker and microphone and varying line delay times. It also needs to be adaptive as people – objects – conditions change and move about the room.

This is not for the faint of heart. We spent 18 months developing a usable algorithm that ultimately ran on a SHARC. Many company sell code for this which can be modified. I have never seen a complete Max/MSP implementation, altho I started using MSP for basic experiments before we moved to Matlab and Simulink.

This is why most internet phone systems work best with a headset – to keep the incoming audio from getting to the outgoing audio.

KMc

Peter Reid

wrote:
[not too off topic I don't think]

I am interested in the kind of noise cancellation used in telephony to avoid echoes. (Skype/mobile handsets etc)

Does anyone give any insight into this technique? Does it have a name, is it described in any book? Has anyone worked on a max msp implementation?

thanks in advance,
Peter

http://www.peterreid.org/code/

Keith McMillen
BEAM Foundation
http://www.beamfoundation.org/
510.502.5310


March 15, 2014 | 4:46 am

Can I reopen this topic even after so many years???
So KMc, here…

What you are looking for is called Acoustic Echo Cancellation and is a closely guarded dark art practiced by DSP companies and makers of conference phones….This is not for the faint of heart. We spent 18 months developing a usable algorithm that ultimately ran on a SHARC. Many company sell code for this which can be modified. I have never seen a complete Max/MSP implementation, altho I started using MSP for basic experiments before we moved to Matlab and Simulink.

…you are saying that there is no way to reproduce something like it in Max? Not even a basic version of it?

In my project I am also attempting to subtract the music signal from a mp3 player (for example) "minus" the sound signal picked up by a mic in the room, which will be made of music reproduced by the speakers and ambient/crowd noise. Exactly what an Automatic Gain & Equalization Control does on modern headsets…

So what I want to achieve is a realistic estimation of the ambient/crowd noise loudness.
Is this anyway possible in Max?

Any ideas and help anyone?

Thanks


Viewing 22 posts - 1 through 22 (of 22 total)