Search code examples
caudiocompressionmp3wav

Why is there a click after I compress the wav?


I'm using freemp3droid to convert wav files into mp3s. There is a click at the beginning of the file. When I take a look at the file in audacity, the initial 100bytes (beyond the header) have the same pattern. What could be happening??

Here is the waveform of the click (it is the 99% identical,EVERY single time)

enter image description here

http://code.google.com/p/freemp3fordroid/source/browse/trunk/jni/frontend/main.c#215


Solution

  • It is worth understanding what the click is. If you in fact compressed the header, you are getting a weird discontinuous signal to start with. You have to understand a bit about signals to realize what is happening. Your waveform does not start with a zero value. That means that you instantaneously have to get from no voltage to some voltage. If you had a sine wave starting with zero, you would hear a pure tone. Since you start with a signal, that is the equivalent of a high frequency squeak at the start, which your speakers turn into a pop.

    You will get the same pop if you compress a signal that doesn't start with zero.

    The way to stop this is to add a rampup to start your sound. Start with zero and linearly ramp up until you get to the starting value of your wave, and you won't get a pop sound.