An analytical response function is presented that is based on a perturbed Pearson-IV model for the peak shape and additional models for the first four moments of the distribution, mean, variance, skewness and kurtosis. The parametrisation of these moment models is acquired by using an evolutionary ensemble algorithm, delivering corresponding energy dependent functions for each of the moments. Using the relationship between the moments and the actual peak shape, this analytical equation is introduced into the Maximum-Likelihood inversion, delivering a formula for deconvolving spectra. Through the parametrisation, the technique can be tailored to any CZT detector. Without having to store a large response matrix, the analytical deconvolution can be easily deployed also on smaller devices, with less computational performance. The technique is validated on a Raspberry Pi connected to a muSPEC500 device from Ritec, featuring a 300mm3 CZT crystal. Example measurements for cesium 137Cs, cobalt 60Co, europium 152Eu and uranium 238U are deconvolved and show a significant capability of resolving peaks.