References on the MP3 encoding algorithm
A compression standard is a quite delicate thing, that took years to develop and tune. I suggest Analysis of the MPEG-1 Layer III (MP3) Algorithm Using MATLAB, 2012 by Jayaraman J. Thiagarajan and Andreas Spanias. After a general overview, it leads you step by step though the different blocks of the whole scheme, providing some Matlab code for each of them.