# Summing magnitudes of individual frequency bins

I am working on signal analyser and have problem with understanding relationship between display resolution and frequency resolution (range). My frequency range is $1-20000\quad [ H z ]$ so to project each frequencies magnitude on display (horizontally in linear scale) I need display horizontal resolution at least 20000. But of course I don't have :)

So let's say I have 1000 pixels horizontal resolution. So to project whole frequency range I need to express $\frac { 20000} { 1000} = 20$ frequency bin magnitudes by one pixel.

And my question is what is the most relevant manner to do that?

Should I just sum all 20 magnitudes? Or better make some avarage value like $\frac { 1} { 20} \sum _ { i = 1} ^ { 20} mag_{fbin}$

I am pretty sure it's concern a lot of other subjects like: is magnitude print in decibels (log) scale or as range from 0 to 1? Also important thing is perception of human ear (if it's audio). And other things. But I don't know how to deal with that. Could you give any advice? To make the answer easier, let's say I want to create audio signal analyser.

• Do you need the 20,000 bins for anything else? If not, the easiest solution is to calculate only 1000 bins.
– MBaz
Apr 27 '18 at 17:00
• I am not sure what do you mean. I have signal with freq range from 1 to 20000, so I need to calculate all freq bins, and need to show them on the graph in some way, but I have onle 1000 pixels to use. What do you mean to calculate only 1000 bins, but what about the rest? :) I can’t see the idea. Apr 27 '18 at 17:15
• Ok now I think I know what you mean. Do you think to make fft with fft buffer size of 1000? That’s OK. But I want to have possibility to change that buffer from 20 to sample rate of input signal. Apr 27 '18 at 17:18
• Using the DFT, you can choose how many ffrequency bins to calculate, without changing your frequency range. Basically if you use $N$ samples to find the DFT, it gives you $N$ frequency bins.
– MBaz
Apr 27 '18 at 17:19
• The sampling rate gives you the frequency range. You can still take a slice of $N$ samples to get $N$ bins.
– MBaz
Apr 27 '18 at 17:19