In this study, we present a procedure to optimize a set of finite impulse response filter (FIR) coefficients for digital pulse-amplitude measurement. Such an optimized filter is designed using an adapted digital penalized least mean square (DPLMS) method. The effectiveness of the procedure is demonstrated using a dataset from a case study on high-resolution X-ray spectroscopy based on single-photon detection and energy measurements. The energy resolutions of the Kα and Kβ lines of the Manganese energy spectrum have been improved by approximately 20%, compared to the reference values obtained by fitting individual photon pulses with the corresponding mathematical model.