"To do the calculation, we need to know what value to use for the DC offset. To get a clean signal, the amplifier circuit for the microphone will have been designed to have a DC offset as close as possible to the middle of the possible range of voltage so that the signal can get as big as possible without distorting. The code assumes this and uses the value 512 (right in the middle of the analog input range of 0 to 1,023)."
When the microphone is putting out 0V, read the A/D many times and average. It should be ~512, but the actual number will be a little different.
How do i calculate the real DC offset?
In other words, you don't calculate it, you measure it (by using the code from the Analog Read Serial example, etc.).