The task is to efficiently encode analog input signals x by the response of a population of spiking neurons z. (A) To that end, neurons couple to the input via feedforward weights F (dominated by excitation) and to each other via recurrent weights W (dominated by inhibition). From the encoding an external observer can decode an approximation of the original input signal x via a linear transformation D. (B) The membrane potential uj of neuron j is a linear sum of continuous inputs xi and spike traces zk. Spikes cause an immediate self-inhibition, which can be seen as an approximate reset of uj. Spikes of other neurons are transmitted with a delay δ. When recurrent weights are learned such that recurrent input zk cancels feedforward input xi, uj is balanced and reflects the global encoding error . In that case, spikes are fired only when the encoding error is high, so that the spike encoding is efficiently distributed over the population.