Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: help a student please (dBFS and loudness measures)! (Read 30149 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

help a student please (dBFS and loudness measures)!

Dear all,

I am a student and I have problems with dBFS and loudness measures. My prof assigned a problem set without an explanation on the subject. I have looked over the net, but wikipedia and other source confused me a lot. 

I used matlab to read a wav files, I have a two vectors of numbers between -1 and 1... but I don't really know how to obtain certain loudness measures.

Let's make the problem general enough: suppose that I read a sequence of samples , that is x_1, x_2, ..., x_n

now my *silly* questions are

1. how do I convert these numbers to dBFS? I know dB are 20*log10(In/out) but I have negative numbers and I don't know what to put inside the logs!

2. how do I compute average RMS loudness?

3. how do I compute peak loudness?

I would appreciate any help from you guys... I hope somebody will help me!!!
Jp


help a student please (dBFS and loudness measures)!

Reply #1
Quote
1. how do I convert these numbers to dBFS? I know dB are 20*log10(In/out) but I have negative numbers and I don't know what to put inside the logs!


It's usually the other way 'round... 20*log10(Out/In)  or 20*log(value/reference).  For example, an amplifier will give you "out" values greater than "in" values, which gives a "gain", or positive dB value.  An attenuator will give you a "loss", or negative dB values.

I think you just use absolute values.    Or, use the maximum possible positive value as your reference for positive values, and the maximum possible negative value for negative values.  (i.e. With 16-bits signed integers your "reference" is -32,768 or +32,767.)

Quote
2. how do I compute average RMS loudness?
Wikipedia...  Calculate the RMS value, and then convert that RMS value to dBFS.    Your sum-of-squares value can get really huge!  So in "real life" (with millions of samples in megabyte-size files) , I think most audio editors take reasonable size blocks of samples (whatever "reasonable" is...), calculate a series of RMS values and then take an overall average of those RMS values (like an "average of averages"... Does that make sense?

Quote
3. how do I compute peak loudness?
Just find the negative or positive peak with the highest absolute value and calculate dBFS.



help a student please (dBFS and loudness measures)!

Reply #2
I used matlab to read a wav files, I have a two vectors of numbers between -1 and 1... but I don't really know how to obtain certain loudness measures.

Let's make the problem general enough: suppose that I read a sequence of samples , that is x_1, x_2, ..., x_n

1. how do I convert these numbers to dBFS? I know dB are 20*log10(In/out) but I have negative numbers and I don't know what to put inside the logs!


It seems like these numbers will represent the percentage of a full scale signal, ie, 0.7 AND -0.7 is 70% of full scale (just opposite polarity)...very similar to a 'weighted' measurement, where '1' is the reference.


Therefore, the dBFS conversion is:
= Full Scale - (20 * log [the ratio of the sample to the peak])

Since full scale is 0 dBFS

= 0 - (20 * log [the ratio of the sample to the peak])

Since the value of each sample should be taken with respect to the peak of the same polarity

= 0 - (20 * log [the absolute value of the sample])

2. how do I compute average RMS loudness?

3. how do I compute peak loudness?

I would appreciate any help from you guys... I hope somebody will help me!!!
Jp


DVDdoug has these answers for you in his post above...

Best,
Elias

help a student please (dBFS and loudness measures)!

Reply #3
Wikipedia...  Calculate the RMS value, and then convert that RMS value to dBFS.    Your sum-of-squares value can get really huge!  So in "real life" (with millions of samples in megabyte-size files) , I think most audio editors take reasonable size blocks of samples (whatever "reasonable" is...), calculate a series of RMS values and then take an overall average of those RMS values (like an "average of averages"... Does that make sense?


Hello guys,

thanks for your answers. Mmhh, it's  still confusing.  Once I compute the RMS of the sequence    x_1, x_2,..., x_n what does it mean to convert it to dBFS?  This fields seems a bit obscure to me, is there any reference book where I can look at these issues?

Best
Jp




help a student please (dBFS and loudness measures)!

Reply #4
Wikipedia...  Calculate the RMS value, and then convert that RMS value to dBFS.    Your sum-of-squares value can get really huge!  So in "real life" (with millions of samples in megabyte-size files) , I think most audio editors take reasonable size blocks of samples (whatever "reasonable" is...), calculate a series of RMS values and then take an overall average of those RMS values (like an "average of averages"... Does that make sense?


Hello guys,

thanks for your answers. Mmhh, it's  still confusing.  Once I compute the RMS of the sequence    x_1, x_2,..., x_n what does it mean to convert it to dBFS?  This fields seems a bit obscure to me, is there any reference book where I can look at these issues?

Best
Jp




help a student please (dBFS and loudness measures)!

Reply #5
Quote
(i.e. With 16-bits signed integers your "reference" is -32,768 or +32,767.)
Ignore that.  As Elias said, your reference is +1 or -1.  (I think this also makes your sum-of-squares number more managable...)

help a student please (dBFS and loudness measures)!

Reply #6
Since you're a student a decent text book should be the first place to start. Your prof. should be able to recommend one or two appropriate to the course. The questions are to check your understanding of basic concepts.

A dB is a ratio of two numbers. In the case of dBFS you are comparing a value to the max. possible, in this case 1. So to get a value in dBFS use 20*log10(x/1). To get the RMS value in dBFS just replace x in the expression with the calculated RMS value.

help a student please (dBFS and loudness measures)!

Reply #7
... A dB is a ratio of two numbers. In the case of dBFS you are comparing a value to the max. possible, in this case 1. So to get a value in dBFS use 20*log10(x/1). To get the RMS value in dBFS just replace x in the expression with the calculated RMS value.


Well this is mathematically strange. Does it make sense from the statistical point of view? What does it mean to compute 20*log(RMS/1)? RMS is the sample standard deviation of a signal that has 0 mean (assuming it is scaled so that it belongs to the [-1,1] interval), Now this means that RMS is the square root of the second moment of the signal so
20*log(RMS/1) is the log ratio of the square root of the second moment of a random variable to the peak value... I don't understand the statistical meaning.

Thanks anyway
Jp

help a student please (dBFS and loudness measures)!

Reply #8
What course is this for?

help a student please (dBFS and loudness measures)!

Reply #9
What course is this for?



Well I am doing a PhD in mathematical statistics and I am taking a course in "time series analysis", the focus of the course is on continuous time  stochastic processes sampled at a given fixed frequency, so music signals are an example of those processes.

... I think I have a completely different background compared with people in this forum, but that's interesting.

Jp

help a student please (dBFS and loudness measures)!

Reply #10
Decibels are used to describe signals in engineering because the resulting values are convenient (perceptual loudness is considered to be logarithmic). I could be wrong but I reckon this material is just preparing you with the right language to consider stuff like autocorrelation.

help a student please (dBFS and loudness measures)!

Reply #11
Quote
Well this is mathematically strange. Does it make sense from the statistical point of view? What does it mean to compute 20*log(RMS/1)? RMS is the sample standard deviation of a signal that has 0 mean (assuming it is scaled so that it belongs to the [-1,1] interval), Now this means that RMS is the square root of the second moment of the signal so
20*log(RMS/1) is the log ratio of the square root of the second moment of a random variable to the peak value... I don't understand the statistical meaning.
You lost me with the mathematical terminology...    Would it make more sense if you were to calculate the average level?  (i.e. The average of the absolute values?)  From a practical/engineering point of view RMS is just a different way of looking at "average", which relates to power.   

The original question was about loudness, and loudness correlates better with RMS because RMS relates to power.  The classic example is a 120 Volt AC sine wave, which has an RMS value of 120V...  If you hook that up to a light bulb, it will give you the same power/brightness as if you were using 120V DC.  Of course this works any arbitrary wave shape, not just sine waves.  The same is NOT true if you calculate the average (absolute value) voltage.   

If you want to evaluate the power/loudness of an audio signal, you need to use RMS.

And, if you send your digital audio samples/signal into a DAC (digital-to-Analog Converter), the values get converted to voltage.  So, the RMS voltage from the DAC relates to the power (watts) from the speaker (depending on amplification, etc.). 

Quote
I am taking a course in "time series analysis", the focus of the course is on continuous time stochastic processes sampled at a given fixed frequency, so music signals are an example of those processes.  I am taking a course in "time series analysis", the focus of the course is on continuous time stochastic processes sampled at a given fixed frequency, so music signals are an example of those processes.
      I think I flunked that course!    ...Actually, it sounds vaguely familiar from a business course I took....  Time Series Forecasting, or something????  I don't remember much, and I don't think I ever understood the practical applications...

help a student please (dBFS and loudness measures)!

Reply #12
... A dB is a ratio of two numbers. In the case of dBFS you are comparing a value to the max. possible, in this case 1. So to get a value in dBFS use 20*log10(x/1). To get the RMS value in dBFS just replace x in the expression with the calculated RMS value.


Well this is mathematically strange. Does it make sense from the statistical point of view? What does it mean to compute 20*log(RMS/1)? RMS is the sample standard deviation of a signal that has 0 mean (assuming it is scaled so that it belongs to the [-1,1] interval), Now this means that RMS is the square root of the second moment of the signal so
20*log(RMS/1) is the log ratio of the square root of the second moment of a random variable to the peak value... I don't understand the statistical meaning.

http://en.wikipedia.org/wiki/DBFS#RMS_levels

help a student please (dBFS and loudness measures)!

Reply #13
You lost me with the mathematical terminology...    Would it make more sense if you were to calculate the average level?  (i.e. The average of the absolute values?)  From a practical/engineering point of view RMS is just a different way of looking at "average", which relates to power.


a PCM encoded signal is a sample from a continuous time stochastic process... so the mathematics should be understood. Average is the first order moment of a random variable, RMS is the square root of the second order moment. They describe two different aspects of a symmetric (around zero)  probability distribution, basically they capture central tendency and mean dispersion (read variance if you like).  If you take higher order moments they will capture skewness and kurtosis and so on. But this make sense only for symmetric-around-the-mean random variables.

The sample RMS would make sense (from a probabilistic viewpoint) for a continuous time sinus or square signal, it doesn't make to much sense when you take the signal in dBFS  scale it is not symmetric at all, it has heavy tails and strong asymmetry. So most of the mathematics is just wrong.

I am so amazed how sloppy is the use of mathematics in certain fields.

...Actually, it sounds vaguely familiar from a business course I took....  Time Series Forecasting, or something????  I don't remember much, and I don't think I ever understood the practical applications...


Time Series Analysis  is the statistic of Stochastic Processes, i.e. dependent data. It's not that funny I know, but all the physics is based on that... quantum physics is probably the most relevant example.

best
Jp





help a student please (dBFS and loudness measures)!

Reply #14
Now I think I see the problem. You thought that the RMS was taken of a logarithmic signal. In fact, the RMS is calculated from the linear PCM data. Its magnitude is then expressed on a logarithmic scale.

help a student please (dBFS and loudness measures)!

Reply #15
Now I think I see the problem. You thought that the RMS was taken of a logarithmic signal. In fact, the RMS is calculated from the linear PCM data. Its magnitude is then expressed on a logarithmic scale.



No I got it right. But, still it is strange that the RMS is used on symmetric random variables (such as sinus wave signals) and non-symmetric random variables thinking that they measure the same thing! They don't in fact.

Best
Jp

help a student please (dBFS and loudness measures)!

Reply #16
No, from that response, I think you still have it wrong. I don't think anybody has proposed anything here which would logically lead to the use of asymmetric variables.

Moreover - not only has nobody really proposed anything on this thread that would cause the RMS computation to be supplied non-symmetric data, but even if you did, as long as the physical acts of computing square/mean/root make sense in the units of measurement, RMS is still a valid operation. It's not valid on dB figures not because the distribution is asymmetric, but because squaring a decibel is completely meaningless, and generally leads to quantities which have no bearing on anything else.

Would it help if I mentioned that much of the use of RMS figures has little to do with statistics, and much more to do with eg Parseval's Theorem? In electrical engineering, RMS figures are used as a tool to reduce AC problems into DC problems. In signal processing they facilitate signal computation between the time and frequency domains. In the context of loudness, RMS measurements can be almost directly interpreted in terms of signal energy.

help a student please (dBFS and loudness measures)!

Reply #17

From what you say I understand you have problems with mathematics and probability theory... very common among
engeneers.

Best
Jp



No, from that response, I think you still have it wrong. I don't think anybody has proposed anything here which would logically lead to the use of asymmetric variables.

Moreover - not only has nobody really proposed anything on this thread that would cause the RMS computation to be supplied non-symmetric data, but even if you did, as long as the physical acts of computing square/mean/root make sense in the units of measurement, RMS is still a valid operation. It's not valid on dB figures not because the distribution is asymmetric, but because squaring a decibel is completely meaningless, and generally leads to quantities which have no bearing on anything else.

Would it help if I mentioned that much of the use of RMS figures has little to do with statistics, and much more to do with eg Parseval's Theorem? In electrical engineering, RMS figures are used as a tool to reduce AC problems into DC problems. In signal processing they facilitate signal computation between the time and frequency domains. In the context of loudness, RMS measurements can be almost directly interpreted in terms of signal energy.


help a student please (dBFS and loudness measures)!

Reply #18
From what you say I understand you have problems with mathematics and probability theory... very common among engeneers.

  I agree with the other posters that you mixed up something, got stuck in your way of thinking and now call the rest of the world stupid. This is not a nice way to ask for help...

help a student please (dBFS and loudness measures)!

Reply #19
I can assure you that there is no shortage here of knowledge about math and statistics. The problem is that you are not getting what they are telling you, or you are not able to express yourself adequately as to what it is that you are confused about.

help a student please (dBFS and loudness measures)!

Reply #20
From what you say I understand you have problems with mathematics and probability theory... very common among
engeneers.


Could you be more specific? Where do you think he has problems? Just because you happened to hear of RMS in the context of looking at the second moment of a distribution doesn't mean that it is not also useful to a complex analyst.

help a student please (dBFS and loudness measures)!

Reply #21
You lost me with the mathematical terminology...    Would it make more sense if you were to calculate the average level?  (i.e. The average of the absolute values?)  From a practical/engineering point of view RMS is just a different way of looking at "average", which relates to power.


a PCM encoded signal is a sample from a continuous time stochastic process... so the mathematics should be understood. Average is the first order moment of a random variable, RMS is the square root of the second order moment. They describe two different aspects of a symmetric (around zero)  probability distribution, basically they capture central tendency and mean dispersion (read variance if you like).  If you take higher order moments they will capture skewness and kurtosis and so on. But this make sense only for symmetric-around-the-mean random variables.

The sample RMS would make sense (from a probabilistic viewpoint) for a continuous time sinus or square signal, it doesn't make to much sense when you take the signal in dBFS  scale it is not symmetric at all, it has heavy tails and strong asymmetry. So most of the mathematics is just wrong.

I am so amazed how sloppy is the use of mathematics in certain fields.


This reminds me of "if all you have is a hammer, everything looks like a nail".

Quote
Time Series Analysis  is the statistic of Stochastic Processes, i.e. dependent data. It's not that funny I know, but all the physics is based on that... quantum physics is probably the most relevant example.


Quantum mechanics an example of a stochastic process? Come on. It's most definitely not a classical stochastic process.

help a student please (dBFS and loudness measures)!

Reply #22
But, still it is strange that the RMS is used on symmetric random variables (such as sinus wave signals) and non-symmetric random variables thinking that they measure the same thing!



A RMS of a sine wave is not zero. I hope you understand it, do you?

Root Mean Square does a power of two of the value (so the sign is removed), does the mean of the sum of those powers (so gets the average of the powers)*, and then applies a square root (so that it compensates for the original power of two).

Definitely nothing to do with an average of the values.



* In audio, generally RMS is calculated for a determined amount of samples (like, 20 to 50milliseconds), since such approximates the response of our hearing.

help a student please (dBFS and loudness measures)!

Reply #23
Another way of describing RMS is that it's the norm of the vector of all the samples you're working with.

help a student please (dBFS and loudness measures)!

Reply #24
Another way of describing RMS is that it's the norm of the vector of all the samples you're working with.


Which shows why it's related to Parseval's theorem in a nice way (Fourier transformation, loosely, is a rotation of the axes, maybe in a functional space if we're dealing with a function of a continuous variable).

But surely this is well-known to our mathematical expert?