how can i center an audio signal? I'm trying to reconstruct an audio signal, and below is what i got after rescaling.



How can i obtain centered audio signal such as below?





SOLVED:

ruoho ruotsi's answer addresses my problem :)

i found someone asked the similar question before 

How to remove or filter the drift problem in measured Strain signal?
"Center" isn't the word that I'd use to describe what you want to do. Your signal does not have a zero-mean, so like @Dole suggested you should use a DC-Blocker (DC-Offset removing) filter to get the job done:

Here are your references:

https://ccrma.stanford.edu/~jos/filters/DC_Blocker.html
https://ccrma.stanford.edu/~jos/filters/DC_Blocker_Frequency_Response.html
https://ccrma.stanford.edu/~jos/filters/DC_Blocker_Software_Implementations.html

the code (from the above links) can be as simple as this, where x is the current sample and y is the filtered sample, while xm1 and ym1 are the x,y from the previous step (i.e. x[i-1], y[i-1]):

  y = x - xm1 + 0.995 * ym1;
  xm1 = x;
  ym1 = y;