Can you help me to program some easy spectrogram?

Please help me by not just giving me the solution but by finding out to do do it myself.