May 27, 2019, 01:24:42 AM

Author Topic: Anti sound generation, how?  (Read 761 times)

Offline Rick Nasher

  • Hero Member
  • *****
  • Posts: 684
Anti sound generation, how?
« on: January 09, 2018, 10:09:30 AM »
Hi guys,

I would like to create an antisound to cancel out noise of a certain(noisy) device.
This is called anti sound or active noise canceling. See: https://en.wikipedia.org/wiki/Active_noise_control
I think on my old Miggy I had a sampler that could create negative sound.

Any suggestions which tool(s) or code I can use to create something like that(for instance a wav sample I can play) ?

All help is appreciated. Thanks in advance.
_______________________________________
 B3D + physics + shaders + X-platform = AGK!
:D ..ALIENBREED *LIVES* (thanks to Qube).. :D
_______________________________________

Offline RemiD

  • Hero Member
  • *****
  • Posts: 802
Re: Anti sound generation, how?
« Reply #1 on: January 09, 2018, 05:20:56 PM »
When i need specific sounds, i usually capture them myself using a portable microphone, and sometimes the device make a continuous noise during the recording.
But using "Wavepad" (sound editor) you can see what is the continous noise and cancel it to output a "clean sound" (without the continous noise)

This is probably not what you want... this is more to remove noises in a sound than to generate an "anti sound"...
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline Rick Nasher

  • Hero Member
  • *****
  • Posts: 684
Re: Anti sound generation, how?
« Reply #2 on: January 09, 2018, 06:24:10 PM »
True, but indeed not what I need.

I want the peaks converted to lows and lows to peaks, creating the exact opposite of the sound, so that when played together they'll bounce and cancel each other out, resulting in less noise from the device in question(a machine creating a constant noisy sound).

At least that's the theory. I once seen this applied to a garbage truck in a TV science show, which made it much more quiet. Would like to test this.
_______________________________________
 B3D + physics + shaders + X-platform = AGK!
:D ..ALIENBREED *LIVES* (thanks to Qube).. :D
_______________________________________

Offline RemiD

  • Hero Member
  • *****
  • Posts: 802
Re: Anti sound generation, how?
« Reply #3 on: January 09, 2018, 06:43:11 PM »
Quote
I want the peaks converted to lows and lows to peaks, creating the exact opposite of the sound, so that when played together they'll bounce and cancel each other out, resulting in less noise from the device in question
then, i suppose that the next step is to study how the .wav sound format is composed and how to read/write it...

record the noise sound, then "invert" it.

Maybe there is something about the wav format in the old blitzbasic forums ?
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline GW

  • Full Member
  • ***
  • Posts: 157
Re: Anti sound generation, how?
« Reply #4 on: January 09, 2018, 06:58:30 PM »
To cancel the sound (assuming it's a float), just invert the sign (x*-1).
If you want to do this in realtime, it harder, because of the delay in the audio stack and because your new inverted sound will still make it's way into the background.
Any delay in the processsing, will cause the new sound to be out of phase and will sound like a flange effect.  If the sound was very periodic and very stable (like an idling car engine), you can use some kind of autocorrelation the predict the next sound sample and try to cancel that, but it would probably need to be tuned.
 

Offline Rick Nasher

  • Hero Member
  • *****
  • Posts: 684
Re: Anti sound generation, how?
« Reply #5 on: January 10, 2018, 08:37:16 AM »
Thanks, guys that indeed sounds(hence the word lol) like the way to do it.

Was just hoping for a tool like I had on my Amiga that could do it, which would save a great deal of time as it is a monotonous sound I'm want to kill/reduce.
_______________________________________
 B3D + physics + shaders + X-platform = AGK!
:D ..ALIENBREED *LIVES* (thanks to Qube).. :D
_______________________________________

Offline TomToad

  • Sr. Member
  • ****
  • Posts: 382
Re: Anti sound generation, how?
« Reply #6 on: January 13, 2018, 12:03:43 PM »
removing a monotonous sound shouldn't be too difficult.  You might already have the capability on your computer.  On mine, under the microphone's properties, I have an option "Noise Suppression" which will help reduce background noise.  Some drivers will even let you control which frequencies to filter out.

If you wish to do it in software, just do a Fourier transform on the incoming wave, remove the offending frequency, then transform back into the wave.

If you are trying to remove sounds that are not consistent, such as nearby traffic or office noises, then it is a bit more difficult.  You would need something that can analyze the waveform and determine which noises are not part of the active recording, then remove those noises.

Looking around, I came across this very interesting article on Fourier transforms.  https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/
------------------------------------------------
8 rabbits equals 1 rabbyte.

Offline Rick Nasher

  • Hero Member
  • *****
  • Posts: 684
Re: Anti sound generation, how?
« Reply #7 on: January 13, 2018, 04:12:15 PM »
Interesting stuff, but not really what I'm after. I just need to simply be able to create an inverted sample, not reversed horizontally but vertically if where talking visual wave representation.

I've already seen it in action so I know it works really well for sounds produced by certain machines.

The one I've seen was on a university project, way back in the 90's. It was used on a traditional style garbage truck, which was suddenly very quiet in comparison to before application. Now I want to use this on a very monotonous noise so should work fine by just playing the opposite, or negative if you like, of the original sound sample in a loop, breaking up the sound waves, resulting in much less sound emission(not zero, for it's of course digital vs analog waves).


_______________________________________
 B3D + physics + shaders + X-platform = AGK!
:D ..ALIENBREED *LIVES* (thanks to Qube).. :D
_______________________________________