Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AudioUnit: How to get rid of popping/clicking at the start and end of tones?

Working on a game where I'm using AudioUnits to generate sound effects. I've based my sound generation code off of the sample here: http://cocoawithlove.com/2010/10/ios-tone-generator-introduction-to.html

I've gotten almost everything working, except I get a really annoying popping noise as each tone is starting and ending. Is there any way to filter this out? I've been working for hours to try and fix it and I could really use some pointers. What could cause this popping noise?

like image 852
Cara Esten Hurtle Avatar asked Nov 16 '11 21:11

Cara Esten Hurtle


People also ask

How do I stop my speakers from popping?

Make sure that the speaker wires are properly connected to both the speakers and audio device. Turn off any nearby electronic devices that may be interfering with the speaker sound. Move the speaker wires away from any electrical cords. Try to play from a different source.

How do I stop FL Studio from clicking?

Just click the automation clip channel in the Channel rack, and then the wrench on the left side of the new window. Then click “Smooth up abrupt changes” in the menu.

Why does my audio make a popping sound?

Speaker crackling is almost always caused by a connection problem. Someplace between your amplifier and your speaker driver, there's a bad wire which is causing the driver to move abruptly, causing interference.


1 Answers

The popping noise is caused by the constant amplitude of your generated sound. The diaphragm of the speaker has to move instantly from rest position (0 amplitude) to the correct displacement for the amplitude of your first sample. The "jump" that it makes causes a popping sound.

You need to ramp up the amplitude over the first few tens of samples, and likewise ramp down when the sound ends.

like image 196
jscs Avatar answered Sep 22 '22 19:09

jscs