On 22 September 2012 12:52, Fons Adriaensen <fons(a)linuxaudio.org> wrote:
  On Sat, Sep 22, 2012 at 04:19:48AM +0200, Robin Gareus
wrote:
  Fons - author of JAAA and JAPA - is on this list
and may chime in sooner
 or later. 
 Eccomi.
 Confusion as to what JAPA actually measures is a recurring thing...
 Unfortunately it's not that easy to explain without going into a
 bit of theory.
 Any spectrum analyser is in the end just a set of bandpass filters
 acting on the input signal. The outputs levels of these filters are
 then displayed as a function of frequency.
 The differences are about how these filters are distributed over
 the audio range. In all cases we'll assume that together they cover
 this range, and that they overlap in a 'sensible' way, for example
 the filter curves intersect at the -3dB points [1]. So the distances
 between the center frequencies and the bandwidth of the filters
 are related.
 A second thing to consider is the nature of the signal that is being
 measured. This could have a line spectrum, i.e. consist of a set of
 discrete frequencies (sine waves), or it could be a noise-like signal,
 or a mix of the two. The point about noise signals is that their energy
 is not concentrated into single frequencies but distributed over a
 continuous frequency range. If you could measure them at exactly one
 single frequency (not possible, it would take infinite time), you
 would find zero. But if you measure them over a finite frequency
 interval you find a non-zero value. Noise is characterized by its
 _density_, that is the power per Hz.
 White noise has the same density at all frequency (within some range).
 There is as much energy between say 5000 and 5010 Hz as there is between
 100 and 110 Hz, or 20 and 30 Hz etc. If you send white noise through two
 bandfilters, one with a bandwidth B and one with a bandwidth 2 * B, then
 the output level of the second one would be 3 dB (a factor of 2 in power)
 higher than the first one.
 Pink noise has a density that is inversely proportional to frequency.
 That means that if you integrate over an interval corresponding to
 some fixed _ratio_ (rather than difference) of frequencies, you find
 the same value. For example there is as much power between 1000 and
 2000 Hz as there is between 100 and 200 Hz, or between 10 and 20 Hz.
 Returning to the analyser, the simplest case is a set of filters that
 all have the same bandwidth (measured in Hz, not octaves) and the same
 gain at their center frequencies. That's the case for e.g. JAAA. Since
 all filters have the same gain, sine waves will be measured correctly.
 White noise will produce the same output level for all filters, and
 be displayed as a flat trace. Pink noise will result in a trace that
 goes down by 3 dB per octave, since its density is proportional to the
 inverse of frequency.
 Now imagine the set of filters used in e.g. a 1/3 octave analyser.
 Center frequencies are a factor of around 1.26 apart, e.g. 100, 125,
 160, 200, 250, 315, etc [2]. The bandwidths of the filters increase in
 the same way - they are proportional to the center frequencies instead
 of being all the same. The filter centered at 1 kHz is ten times as wide
 (in Hz) as the one at 100 Hz. If all filters have again the same gain,
 then sine waves (at the center frequencies) will be measured correctly.
 But now, since the bandwidths increase with frequency, white noise
 will appear as spectrum that rises +3dB / octave, and pink noise will
 be shown as a flat spectrum.
 What this shows is that, at least for noise-like signals, or when
 you are not interested in single frequencies but more in the general
 shape of the spectrum, there is no single 'correct' way to show it,
 it's a matter of interpretation. Which one of the two above is the
 more relevant depends on the application [3].
 The filter set used by JAPA is something in between the two shown
 above. At least in the medium frequency range, the filter bandwidths
 are proportional to the 'critical bandwidths' of the human hearing
 mechanism [4]. You can get an idea of how the filters are distributed
 by selecting the 'warped' frequency scale. With this option, all
 filter have the same width *on the display*. You will see that the
 very low and very high frequency ranges are 'compressed' compared
 to a logarithmic scale, there are less filters there, while the
 resolution in the mid frequency range is increased. How exactly
 this is done depends on the 'warp factor' which you can select
 on the right panel. The same filters are used if you select the
 normal logarithmic scale, only the display is different.
 With the response set to 'flat', all filters have the same gain.
 So a slow sine sweep would produce a flat trace. But since the
 filter bandwidts are neither constant nor proportional to frequency,
 neither white nor pink noise will be shown as a flat spectrum.
 What happens if you select the 'prop' response is that the filter
 _gains_ are modified so you get a flat trace for pink noise. The
 consequence is that sine waves will not be measured correctly, so
 it depends on your application which response makes sense.
 Ciao,
 [1] In both JAAA and JAPA there are actually about twice as much
 filters as would be suggested by this, but that doesn't change
 the principle.
 [2] Actually 1/3 octave is a misnomer, all real-life analysers
 use a ratio of 1/10 decade in order to have a set of 'round'
 center frequencies including e.g. 100, 1k, 10k.
 10^(1/10) = 1.2589... while  2^(1/3) = 1.2599...
 [3] This also means that if you would modify e.g. JAPA to have
 a log frequency scale it would still be the same analyser, it
 will still show -3 dB/octave for pink noise. Which is not what
 one would expect from a 'log' analyser.
 
That said, I think I'd like a JAAA (that's what you meant, right?)
with a log frequency scale. The unevenly spaced bands and (default)
uneven response of JAPA have always troubled me.
Thanks for explaining things, and of course thanks for sharing all
your software with the world, Fons.
mH
  [4] This is not directly related to Fletcher-Munson or
other
 equal loudness curves. The critical bandwidths are about
 masking, that is to what extent one frequency can hide the
 presence of another, which in turn is related to what level
 of detail in a spectrum is relevant to human hearing.
 --
 FA
 A world of exhaustive, reliable metadata would be an utopia.
 It's also a pipe-dream, founded on self-delusion, nerd hubris
 and hysterically inflated market opportunities. (Cory Doctorow)
 _______________________________________________
 Linux-audio-user mailing list
 Linux-audio-user(a)lists.linuxaudio.org
 
http://lists.linuxaudio.org/listinfo/linux-audio-user