DSPRelated.com
Forums

fastest accurate spectrum analyser routine

Started by robert_temp December 8, 2015
I think step one is an accurate definition of the goal.
The op said spectrum analyzer, which usually means an instrument with constant bandwidth across frequency range.  He also mentions 1/3 octave bandwidth which is not constant and is usually associated with 
an instrument usually called real time analyzer, in audio circles.
So, which is the goal... A constant BW spectrum analyzer, or 
a 1/3 octave BW real time analyzer.

It's more than an academic question.
A spectrum analyzer will display white noise as flat.
A real time analyzer will display pink noise as flat.

Which does the OP desire?

Mark
<makolber@yahoo.com> wrote:

>I think step one is an accurate definition of the goal. >The op said spectrum analyzer, which usually means an instrument with >constant bandwidth across frequency range. He also mentions 1/3 octave >bandwidth which is not constant and is usually associated with >an instrument usually called real time analyzer, in audio circles. >So, which is the goal... A constant BW spectrum analyzer, or >a 1/3 octave BW real time analyzer. > >It's more than an academic question. >A spectrum analyzer will display white noise as flat. >A real time analyzer will display pink noise as flat.
I had not heard this exact terminology distinction before. Thanks. Steve
On Wed, 9 Dec 2015 04:18:40 -0800 (PST), makolber@yahoo.com wrote:

>I think step one is an accurate definition of the goal. >The op said spectrum analyzer, which usually means an instrument with constant bandwidth across frequency range. He also mentions 1/3 octave bandwidth which is not constant and is usually associated with >an instrument usually called real time analyzer, in audio circles. >So, which is the goal... A constant BW spectrum analyzer, or >a 1/3 octave BW real time analyzer. > >It's more than an academic question. >A spectrum analyzer will display white noise as flat. >A real time analyzer will display pink noise as flat. > >Which does the OP desire? > >Mark
I hadn't commented previously because I couldn't sort out which case was desired, and the approaches to getting to each are very different. Given the processor and memory limitations, if a constant BW spectrum analyzer is desired it may be best to use an architecture with an NCO and a single, narrow, filter (IIR?). That would allow operation like a typical spectrum analyzer where the desired frequency region is swept with the NCO and the output power at the IIR is detected. The processing load is constant and not very big, and the memory requirement is very low. But that doesn't reconcile with the 1/3 octave specification, so may not be useful at all. Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
Cedron <103185@DSPRelated> replies to my post,

>>The OP will first need to split the problem into >>two analyses: a low-frequency analyses say from 20 - 500 Hz, at >>a reduced sample rate (let's say 1250 Hz); then an analysis >>up to 5 KHz, with a resolution on the order of 100 Hz.
>>Then for each of these, some binning of bins (so to speak) is >>needed to get to 1/3-octave output results.
>Yes, but he only has .5K of RAM to work with, so maybe he is better off >doing a Goertzel (or two or three) at each of the frequencies he is >interested in and somehow deriving an energy level for each neighborhood.
0.5K of RAM is pretty tight, but it's worth a look at what sort of direct PSD calculation this might support. Supposing one could store 500 sample values at 10 Ks/sec [*]. One could then compute and (potentially) window the autocorrelation function in-place; and at that point, once could multiply/accumulate by cosine waveforms (algorithmically generated so as not to chew up memory) and emit a series of values that, serially, form the PSD function. 500 samples at 10 KHz is 50 msec, which pretty easily gives you 200 Hz frequency resolution [**], so it should just about work for the "upper band" analyzer described above. [*] probably optimistic if 0.5K RAM means 0.5K bytes of RAM, as opposed to 0.5K words of RAM. [**] however the more stopband rejection you need, the longer needs be the window for a given resolution. OP did not specify SNR of the window or stopband resolution. Steve