I'm creating an FFT-based real-time analyzer for audio (i.e. live sound,) and have pretty much everything figured out except for this one thing: should I plot the power spectrum (log of the _square_ of the magnitude of FFT outputs,) or the amplitude spectrum (log of the "plain old" magnitude of the FFT outputs)? (I think I'm using these terms correctly; correct me if I'm wrong.) Every description of the method I see says to use one of these two methods, but none of them say why you should square or not square the FFT magnitudes. I'm sure each answer has its own uses. I'd just like to know what the "norm" is for simple audio Real-Time Analyzers. Particularly, if anyone knows what Smaart's RTA does, I'd be interested in hearing that. As I understand it, a +3dB difference in an amplitude spectrum corresponds to double the sound pressure, but it takes a +6dB difference for it to sound twice as loud to humans. Whereas in a power spectrum, +3dB is the same as +6dB in an amplitude spectrum. If I'm not mistaken, SPL (and every other basic topic in audio) behaves like (uses) amplitude, not power, so I'm leaning toward amplitude, but the prevalence of people that say to square the magnitude has me confused. Am I wrong about any of these things? Please help me sort through this confusion.
Audio real-time analyzer: power spectrum or amplitude spectrum?
Started by ●July 15, 2011
Reply by ●July 15, 20112011-07-15
Reply by ●July 15, 20112011-07-15
On Jul 15, 4:28�pm, Tyler Mandry <tman...@gmail.com> wrote:> I'm creating an FFT-based real-time analyzer for audio (i.e. live > sound,) and have pretty much everything figured out except for this > one thing: should I plot the power spectrum (log of the _square_ of > the magnitude of FFT outputs,) or the amplitude spectrum (log of the > "plain old" magnitude of the FFT outputs)? (I think I'm using these > terms correctly; correct me if I'm wrong.) > > Every description of the method I see says to use one of these two > methods, but none of them say why you should square or not square the > FFT magnitudes. I'm sure each answer has its own uses. I'd just like > to know what the "norm" is for simple audio Real-Time Analyzers. > Particularly, if anyone knows what Smaart's RTA does, I'd be > interested in hearing that. > > As I understand it, a +3dB difference in an amplitude spectrum > corresponds to double the sound pressure, but it takes a +6dB > difference for it to sound twice as loud to humans. Whereas in a power > spectrum, +3dB is the same as +6dB in an amplitude spectrum. If I'm > not mistaken, SPL (and every other basic topic in audio) behaves like > (uses) amplitude, not power, so I'm leaning toward amplitude, but the > prevalence of people that say to square the magnitude has me confused. > > Am I wrong about any of these things? Please help me sort through this > confusion.On a log (that is, decibel) display, the difference is merely a level shift. for the curve ans a change of the scale numbers. Square root is an unnecessary calculation here. Jerry -- Engineering is the art of making what you want from things you can get.
Reply by ●July 15, 20112011-07-15
On Jul 15, 3:41�pm, Sebastian Doht <seb_d...@lycos.com> wrote:> Tyler Mandry schrieb: > > �>... > > http://en.wikipedia.org/wiki/DecibelI understand what a decibel is. Decibels could be used to describe either amplitude or power (squared amplitude.) I'm trying to figure out which one I should use for my application.
Reply by ●July 15, 20112011-07-15
On 7/15/2011 1:28 PM, Tyler Mandry wrote:> I'm creating an FFT-based real-time analyzer for audio (i.e. live > sound,) and have pretty much everything figured out except for this > one thing: should I plot the power spectrum (log of the _square_ of > the magnitude of FFT outputs,) or the amplitude spectrum (log of the > "plain old" magnitude of the FFT outputs)? (I think I'm using these > terms correctly; correct me if I'm wrong.) > > Every description of the method I see says to use one of these two > methods, but none of them say why you should square or not square the > FFT magnitudes. I'm sure each answer has its own uses. I'd just like > to know what the "norm" is for simple audio Real-Time Analyzers. > Particularly, if anyone knows what Smaart's RTA does, I'd be > interested in hearing that. > > As I understand it, a +3dB difference in an amplitude spectrum > corresponds to double the sound pressure, but it takes a +6dB > difference for it to sound twice as loud to humans. Whereas in a power > spectrum, +3dB is the same as +6dB in an amplitude spectrum. If I'm > not mistaken, SPL (and every other basic topic in audio) behaves like > (uses) amplitude, not power, so I'm leaning toward amplitude, but the > prevalence of people that say to square the magnitude has me confused. > > Am I wrong about any of these things? Please help me sort through this > confusion.You're forgetting the essential thing in all of this. 10*log(P) = 10*log(V2^2/R) = 20*log(V) - 10*log(R). The moral of that story being that, once you've normalized for a given 0dB level (which has to include the burden) then decibels in power and amplitude mean exactly the same thing. A signal with twice the amplitude (+6dB) has four times the power (+6dB). People are telling you to square the magnitude because the amplitude of a complex number is sqrt(re^2 + im^2), and by using the magnitude squared, you can save taking all those square roots. If you're taking the logarithms anyhow, you can get from the log of mag^2 back to the log of mag just by dividing by two. -- Rob Gaddi, Highland Technology Email address is currently out of order
Reply by ●July 15, 20112011-07-15
On Jul 15, 4:18�pm, Rob Gaddi <rga...@technologyhighland.com> wrote:> On 7/15/2011 1:28 PM, Tyler Mandry wrote: > > > > > > > > > > > I'm creating an FFT-based real-time analyzer for audio (i.e. live > > sound,) and have pretty much everything figured out except for this > > one thing: should I plot the power spectrum (log of the _square_ of > > the magnitude of FFT outputs,) or the amplitude spectrum (log of the > > "plain old" magnitude of the FFT outputs)? (I think I'm using these > > terms correctly; correct me if I'm wrong.) > > > Every description of the method I see says to use one of these two > > methods, but none of them say why you should square or not square the > > FFT magnitudes. I'm sure each answer has its own uses. I'd just like > > to know what the "norm" is for simple audio Real-Time Analyzers. > > Particularly, if anyone knows what Smaart's RTA does, I'd be > > interested in hearing that. > > > As I understand it, a +3dB difference in an amplitude spectrum > > corresponds to double the sound pressure, but it takes a +6dB > > difference for it to sound twice as loud to humans. Whereas in a power > > spectrum, +3dB is the same as +6dB in an amplitude spectrum. If I'm > > not mistaken, SPL (and every other basic topic in audio) behaves like > > (uses) amplitude, not power, so I'm leaning toward amplitude, but the > > prevalence of people that say to square the magnitude has me confused. > > > Am I wrong about any of these things? Please help me sort through this > > confusion. > > You're forgetting the essential thing in all of this. �10*log(P) = > 10*log(V2^2/R) = 20*log(V) - 10*log(R). �The moral of that story being > that, once you've normalized for a given 0dB level (which has to include > the burden) then decibels in power and amplitude mean exactly the same > thing. �A signal with twice the amplitude (+6dB) has four times the > power (+6dB). > > People are telling you to square the magnitude because the amplitude of > a complex number is sqrt(re^2 + im^2), and by using the magnitude > squared, you can save taking all those square roots. �If you're taking > the logarithms anyhow, you can get from the log of mag^2 back to the log > of mag just by dividing by two. > > -- > Rob Gaddi, Highland Technology > Email address is currently out of orderRight. So essentially, what I need to do is take 10*log(re^2 + im^2)/2 (or just 5*log) and add/subtract some normalizing value? I guess what my question comes down to then is, do most RTAs leave out that division by 2? (I would guess not, but I'm not sure.) @Jerry: Unless I'm mistaken, it's *not* just a level shift on a log scale, it's a linear stretch on the log scale.
Reply by ●July 15, 20112011-07-15
On Jul 15, 4:18�pm, Rob Gaddi <rga...@technologyhighland.com> wrote:> On 7/15/2011 1:28 PM, Tyler Mandry wrote: > > > > > > > > > > > I'm creating an FFT-based real-time analyzer for audio (i.e. live > > sound,) and have pretty much everything figured out except for this > > one thing: should I plot the power spectrum (log of the _square_ of > > the magnitude of FFT outputs,) or the amplitude spectrum (log of the > > "plain old" magnitude of the FFT outputs)? (I think I'm using these > > terms correctly; correct me if I'm wrong.) > > > Every description of the method I see says to use one of these two > > methods, but none of them say why you should square or not square the > > FFT magnitudes. I'm sure each answer has its own uses. I'd just like > > to know what the "norm" is for simple audio Real-Time Analyzers. > > Particularly, if anyone knows what Smaart's RTA does, I'd be > > interested in hearing that. > > > As I understand it, a +3dB difference in an amplitude spectrum > > corresponds to double the sound pressure, but it takes a +6dB > > difference for it to sound twice as loud to humans. Whereas in a power > > spectrum, +3dB is the same as +6dB in an amplitude spectrum. If I'm > > not mistaken, SPL (and every other basic topic in audio) behaves like > > (uses) amplitude, not power, so I'm leaning toward amplitude, but the > > prevalence of people that say to square the magnitude has me confused. > > > Am I wrong about any of these things? Please help me sort through this > > confusion. > > You're forgetting the essential thing in all of this. �10*log(P) = > 10*log(V2^2/R) = 20*log(V) - 10*log(R). �The moral of that story being > that, once you've normalized for a given 0dB level (which has to include > the burden) then decibels in power and amplitude mean exactly the same > thing. �A signal with twice the amplitude (+6dB) has four times the > power (+6dB). > > People are telling you to square the magnitude because the amplitude of > a complex number is sqrt(re^2 + im^2), and by using the magnitude > squared, you can save taking all those square roots. �If you're taking > the logarithms anyhow, you can get from the log of mag^2 back to the log > of mag just by dividing by two. > > -- > Rob Gaddi, Highland Technology > Email address is currently out of orderAlso - I thought twice the amplitude would be +3dB? I must be missing something from your explanation.
Reply by ●July 15, 20112011-07-15
On Jul 15, 6:03�pm, Tyler Mandry <tman...@gmail.com> wrote:> On Jul 15, 4:18�pm, Rob Gaddi <rga...@technologyhighland.com> wrote: > > > > > On 7/15/2011 1:28 PM, Tyler Mandry wrote: > > > > I'm creating an FFT-based real-time analyzer for audio (i.e. live > > > sound,) and have pretty much everything figured out except for this > > > one thing: should I plot the power spectrum (log of the _square_ of > > > the magnitude of FFT outputs,) or the amplitude spectrum (log of the > > > "plain old" magnitude of the FFT outputs)? (I think I'm using these > > > terms correctly; correct me if I'm wrong.) > > > > Every description of the method I see says to use one of these two > > > methods, but none of them say why you should square or not square the > > > FFT magnitudes. I'm sure each answer has its own uses. I'd just like > > > to know what the "norm" is for simple audio Real-Time Analyzers. > > > Particularly, if anyone knows what Smaart's RTA does, I'd be > > > interested in hearing that. > > > > As I understand it, a +3dB difference in an amplitude spectrum > > > corresponds to double the sound pressure, but it takes a +6dB > > > difference for it to sound twice as loud to humans. Whereas in a power > > > spectrum, +3dB is the same as +6dB in an amplitude spectrum. If I'm > > > not mistaken, SPL (and every other basic topic in audio) behaves like > > > (uses) amplitude, not power, so I'm leaning toward amplitude, but the > > > prevalence of people that say to square the magnitude has me confused. > > > > Am I wrong about any of these things? Please help me sort through this > > > confusion. > > > You're forgetting the essential thing in all of this. �10*log(P) = > > 10*log(V2^2/R) = 20*log(V) - 10*log(R). �The moral of that story being > > that, once you've normalized for a given 0dB level (which has to include > > the burden) then decibels in power and amplitude mean exactly the same > > thing. �A signal with twice the amplitude (+6dB) has four times the > > power (+6dB). > > > People are telling you to square the magnitude because the amplitude of > > a complex number is sqrt(re^2 + im^2), and by using the magnitude > > squared, you can save taking all those square roots. �If you're taking > > the logarithms anyhow, you can get from the log of mag^2 back to the log > > of mag just by dividing by two. > > > -- > > Rob Gaddi, Highland Technology > > Email address is currently out of order > > Also - I thought twice the amplitude would be +3dB? > I must be missing something from your explanation.Hint.. here is a conversation you should never hear... "could you hand me a 6dB pad.... sure, do you want a 6 dB voltage pad or a 6 dB power pad?" Mark
Reply by ●July 16, 20112011-07-16
On Jul 15, 6:01�pm, Tyler Mandry <tman...@gmail.com> wrote:> On Jul 15, 4:18�pm, Rob Gaddi <rga...@technologyhighland.com> wrote: > > > > > > > > > > > On 7/15/2011 1:28 PM, Tyler Mandry wrote: > > > > I'm creating an FFT-based real-time analyzer for audio (i.e. live > > > sound,) and have pretty much everything figured out except for this > > > one thing: should I plot the power spectrum (log of the _square_ of > > > the magnitude of FFT outputs,) or the amplitude spectrum (log of the > > > "plain old" magnitude of the FFT outputs)? (I think I'm using these > > > terms correctly; correct me if I'm wrong.) > > > > Every description of the method I see says to use one of these two > > > methods, but none of them say why you should square or not square the > > > FFT magnitudes. I'm sure each answer has its own uses. I'd just like > > > to know what the "norm" is for simple audio Real-Time Analyzers. > > > Particularly, if anyone knows what Smaart's RTA does, I'd be > > > interested in hearing that. > > > > As I understand it, a +3dB difference in an amplitude spectrum > > > corresponds to double the sound pressure, but it takes a +6dB > > > difference for it to sound twice as loud to humans. Whereas in a power > > > spectrum, +3dB is the same as +6dB in an amplitude spectrum. If I'm > > > not mistaken, SPL (and every other basic topic in audio) behaves like > > > (uses) amplitude, not power, so I'm leaning toward amplitude, but the > > > prevalence of people that say to square the magnitude has me confused. > > > > Am I wrong about any of these things? Please help me sort through this > > > confusion. > > > You're forgetting the essential thing in all of this. �10*log(P) = > > 10*log(V2^2/R) = 20*log(V) - 10*log(R). �The moral of that story being > > that, once you've normalized for a given 0dB level (which has to include > > the burden) then decibels in power and amplitude mean exactly the same > > thing. �A signal with twice the amplitude (+6dB) has four times the > > power (+6dB). > > > People are telling you to square the magnitude because the amplitude of > > a complex number is sqrt(re^2 + im^2), and by using the magnitude > > squared, you can save taking all those square roots. �If you're taking > > the logarithms anyhow, you can get from the log of mag^2 back to the log > > of mag just by dividing by two. > > > -- > > Rob Gaddi, Highland Technology > > Email address is currently out of order > > Right. So essentially, what I need to do is take 10*log(re^2 + im^2)/2 > (or just 5*log) and add/subtract some normalizing value?10*log(power/referencepower) = 20*log(voltage/referencevoltage) = dB either way. dB is a _relative_ power measurement. Not that the validity of 20*log(voltage/referencevoltage) depends on the impedance being the same for voltage and referencevoltage.> I guess what my question comes down to then is, do most RTAs leave out > that division by 2? (I would guess not, but I'm not sure.)What division by two do you mean?> @Jerry: Unless I'm mistaken, it's *not* just a level shift on a log > scale, it's a linear stretch on the log scale.My explanation was unclear. Ignore it. Jerry -- Engineering is the art of making what you want from things you can get.
Reply by ●July 16, 20112011-07-16
On Jul 15, 6:01�pm, Tyler Mandry <tman...@gmail.com> wrote:> On Jul 15, 4:18�pm, Rob Gaddi <rga...@technologyhighland.com> wrote: > > > > > On 7/15/2011 1:28 PM, Tyler Mandry wrote: > > > > I'm creating an FFT-based real-time analyzer for audio (i.e. live > > > sound,) and have pretty much everything figured out except for this > > > one thing: should I plot the power spectrum (log of the _square_ of > > > the magnitude of FFT outputs,) or the amplitude spectrum (log of the > > > "plain old" magnitude of the FFT outputs)? (I think I'm using these > > > terms correctly; correct me if I'm wrong.) > > > > Every description of the method I see says to use one of these two > > > methods, but none of them say why you should square or not square the > > > FFT magnitudes. I'm sure each answer has its own uses. I'd just like > > > to know what the "norm" is for simple audio Real-Time Analyzers. > > > Particularly, if anyone knows what Smaart's RTA does, I'd be > > > interested in hearing that. > > > > As I understand it, a +3dB difference in an amplitude spectrum > > > corresponds to double the sound pressure, but it takes a +6dB > > > difference for it to sound twice as loud to humans. Whereas in a power > > > spectrum, +3dB is the same as +6dB in an amplitude spectrum. If I'm > > > not mistaken, SPL (and every other basic topic in audio) behaves like > > > (uses) amplitude, not power, so I'm leaning toward amplitude, but the > > > prevalence of people that say to square the magnitude has me confused. > > > > Am I wrong about any of these things? Please help me sort through this > > > confusion. > > > You're forgetting the essential thing in all of this. �10*log(P) = > > 10*log(V2^2/R) = 20*log(V) - 10*log(R). �The moral of that story being > > that, once you've normalized for a given 0dB level (which has to include > > the burden) then decibels in power and amplitude mean exactly the same > > thing. �A signal with twice the amplitude (+6dB) has four times the > > power (+6dB). > > > People are telling you to square the magnitude because the amplitude of > > a complex number is sqrt(re^2 + im^2), and by using the magnitude > > squared, you can save taking all those square roots. �If you're taking > > the logarithms anyhow, you can get from the log of mag^2 back to the log > > of mag just by dividing by two. > > > -- > > Rob Gaddi, Highland Technology > > Email address is currently out of order > > Right. So essentially, what I need to do is take 10*log(re^2 + im^2)/2 > (or just 5*log)no, no, it's 20*log( sqrt(re^2 + im^2) ) or 10*log(re^2 + im^2) assuming a base-10 log.> and add/subtract some normalizing value?whatever it takes to define where 0 dB is. maybe full scale is at 0 dB.> I guess what my question comes down to then is, do most RTAs leave out > that division by 2? (I would guess not, but I'm not sure.)it comes out in the wash. double your voltage and you're up by 6 dB (well, 6.0206 dB to be more precise) and if you double your power, you're up by 3 dB. no square root is necessary and you just need to use the correct scaler to the log. and make sure you know what base your log() function is. r b-j






