I have an PCM (pulse-code modulation) signal. If I want to work out the frequency of a sample $ x $ long, I count the number of peaks/troughs of the sample, and divide by $ x $. The equivent dB of frequencies $ 20Hz > 20 000 Hz $ is then just the equivelent dB of the signal as a whole
However, I would like to create a spectrum analyzer of the type shown below. This requires extracting the equivelent decibels of different frequencies in the signal. So I need to split the signal into different signals of different frequencies, so I have signals of $ 20Hz > 5000Hz $, $ 5000Hz > 10000Hz $, $ 10000Hz > 20000 Hz $, ect.
How can I extract signals for the different frequencies from one master signal?