Csound Csound-dev Csound-tekno Search About

[Csnd] Relationship between integer sample value and perceived loudness.

Date2009-03-19 02:59
FromTobiah
Subject[Csnd] Relationship between integer sample value and perceived loudness.
Hi,

Would someone please discuss this?  If I have one sine wave that generates
a maximum sample of +-10000, how will this compare in perceived loudness
to one that peaks at +-20000?  Do I need to use ampdbfs() to get this right?

When I write a guitar-pedal type of delay effect, I normally have one
parameter which is the feedback multiplier.  Values closer to 1 make
the repeated sound hang around longer before becoming inaudible.
Repeatedly multiplying the sample values by say .6 seems to result
in a perceptually linear decrease in volume.  Is there a better way?
Don't I need a logarithm in there somewhere?

Thanks,

Toby 

Date2009-03-19 03:14
Fromjpff@cs.bath.ac.uk
Subject[Csnd] Re: Relationship between integer sample value and perceived loudness.
> Hi,
>
> Would someone please discuss this?  If I have one sine wave that generates
> a maximum sample of +-10000, how will this compare in perceived loudness
> to one that peaks at +-20000?  Do I need to use ampdbfs() to get this
> right?
>
>

Two comments.

First th ephysics of hearing indicates that we hear multiplicatively, so
multiplying by 2 is the process not adding 2.  Hence the use of decibels
as the unit, where the dB value is 20 log_10(X).

Secondly there is a difference in the perception of loudness and
amplitude, which I think is the sone scale.  The physical and perceptual
diverge according to some formula like Tp = a Ta^b where a and b are
constants related to the kind of sensation.

In Csound there is an implementation of physical loudness in the ampdbfs
function, and on teh sone scale in the sone gen plugin.  This last one
needs a little refinement and is currently not documened.

Over to the experts......

==John ff



Date2009-03-19 03:50
FromTobiah
Subject[Csnd] Re: Re: Relationship between integer sample value and perceived loudness.
jpff@cs.bath.ac.uk wrote:
>> Hi,
>>
>> Would someone please discuss this?  If I have one sine wave that generates
>> a maximum sample of +-10000, how will this compare in perceived loudness
>> to one that peaks at +-20000?  Do I need to use ampdbfs() to get this
>> right?
>>
>>
> 
> Two comments.
> 
> First th ephysics of hearing indicates that we hear multiplicatively, so
> multiplying by 2 is the process not adding 2.  Hence the use of decibels
> as the unit, where the dB value is 20 log_10(X).

I'm not sure I understand.  Does that mean that if I have a
sound that peaks digitally at 10000, then to make it twice
as loud, I should multiply it by 20 log_10(10000) or should
the new value be exactly 20 log_10(10000)?
> 
> Secondly there is a difference in the perception of loudness and
> amplitude

Can you tell me the difference?  It would seem that 'loudness' would
have to indicate anticipated human perception.  We talk about 'amplitude'
often with respect to absolute digital values.  What do you mean here?

Thanks

Toby

> 
> 
> 
> 
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2009-03-19 08:49
Fromvictor
Subject[Csnd] Re: Re: Re: Relationship between integer sample value and perceived loudness.
> I'm not sure I understand.  Does that mean that if I have a
> sound that peaks digitally at 10000, then to make it twice
> as loud, I should multiply it by 20 log_10(10000) or should
> the new value be exactly 20 log_10(10000)?

No, if you are multiplying, a factor of 2 will double the waveform
amplitude. In the dB scale, this means a change of ca. 6dB
(20log10(2)). If you want to double the amplitude of a sound, you
will multiply it by 2 or by 10^(6/20),d epending on how you
are defining your amplitude changes.

>> Secondly there is a difference in the perception of loudness and
>> amplitude
> Can you tell me the difference?  It would seem that 'loudness' would
> have to indicate anticipated human perception.  We talk about 'amplitude'
> often with respect to absolute digital values.  What do you mean here?

yes, exactly, loudness is a perceptual quality, whereas amplitude, intensity
and power are measurable properties of a sound waveform. The former will
depend not only on intensity, but also on other factors, such as frequency.
The world-famous Fletcher-Munson curves link amplitude and frequency
to plot equal-loudness for pure tones (I am sure you can find these in
wikipedia or somewhere in the net).

Victor


> Thanks
>
> Toby
>
>>
>>
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
>> csound"
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
> csound" 


Date2009-03-19 09:13
Fromvictor
Subject[Csnd] Re: Re: Re: Re: Relationship between integer sample value and perceived loudness.
There you go:

http://en.wikipedia.org/wiki/Fletcher-Munson

----- Original Message ----- 
From: "victor" 
To: 
Sent: Thursday, March 19, 2009 8:49 AM
Subject: [Csnd] Re: Re: Re: Relationship between integer sample value and 
perceived loudness.


>
>> I'm not sure I understand.  Does that mean that if I have a
>> sound that peaks digitally at 10000, then to make it twice
>> as loud, I should multiply it by 20 log_10(10000) or should
>> the new value be exactly 20 log_10(10000)?
>
> No, if you are multiplying, a factor of 2 will double the waveform
> amplitude. In the dB scale, this means a change of ca. 6dB
> (20log10(2)). If you want to double the amplitude of a sound, you
> will multiply it by 2 or by 10^(6/20),d epending on how you
> are defining your amplitude changes.
>
>>> Secondly there is a difference in the perception of loudness and
>>> amplitude
>> Can you tell me the difference?  It would seem that 'loudness' would
>> have to indicate anticipated human perception.  We talk about 'amplitude'
>> often with respect to absolute digital values.  What do you mean here?
>
> yes, exactly, loudness is a perceptual quality, whereas amplitude, 
> intensity
> and power are measurable properties of a sound waveform. The former will
> depend not only on intensity, but also on other factors, such as 
> frequency.
> The world-famous Fletcher-Munson curves link amplitude and frequency
> to plot equal-loudness for pure tones (I am sure you can find these in
> wikipedia or somewhere in the net).
>
> Victor
>
>
>> Thanks
>>
>> Toby
>>
>>>
>>>
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
>>> csound"
>>
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
>> csound"
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
> csound" 


Date2009-03-19 10:03
FromRichard Dobson
Subject[Csnd] Re: Re: Re: Re: Relationship between integer sample value and perceived loudness.
victor wrote:
> 
>> I'm not sure I understand.  Does that mean that if I have a
>> sound that peaks digitally at 10000, then to make it twice
>> as loud, I should multiply it by 20 log_10(10000) or should
>> the new value be exactly 20 log_10(10000)?
> 
> No, if you are multiplying, a factor of 2 will double the waveform
> amplitude. In the dB scale, this means a change of ca. 6dB
> (20log10(2)). If you want to double the amplitude of a sound, you
> will multiply it by 2 or by 10^(6/20),d epending on how you
> are defining your amplitude changes.
> 


To amplify Victor's post a bit:  a key to understanding this is to see 
that one way or another, we are always making a comparison between two 
values. The value 10000 for example, is essentially meaningless until we 
state that the peak sample value is 32768 (say). Given that, we know 
that a sample value of 1  is VERY quiet. Whereas if a value of 1 is 
digital peak, that same sample value has likewise become a peak.

Problems arise because we can have many different representations of 
amplitude scales (not least, inside different sample formats - 16bit, 
24bit, floats, etc). Actually, we are not really all that interested in 
hard numeric sample values, we are far more interested in what the 
~relative~ change  is between them. This leads to the expression of a 
ratio, which in turn is where the dB calculation comes in. The value you 
give it is not, strictly speaking, an amplitude ~level~, it is an 
amplitude ~ratio~, signifying the comparison between the presenting 
amplitude value and the peak (or "reference") level.

This then eliminates all questions of amplitude range from 
consideration. Whether it is 10000/32767, 78/256, or 0.3/1.0 ceases to 
matter (though I suggest the last one is the easiest to understand). We 
put that ~ratio~ into the dB calculation and get (approx) -10.3dB. the 
reason for the arcane  calculation using log10 and a factor of 20 is an 
industrial convention in audio, arising (among other things) because 
amplitude ranges of interest to us are actually very wide - we either 
have some very large numbers  (such as 2^^23 = 8388608) or some very 
small numbers such as 0.0001  (which might be read as -80dB).  With the 
dB scale we can represent the whole audible dynamic range  using a 
comfortable set of small numbers that appear linear: -6dB, -12dB, -18dB 
represent successive halvings of amplitude. The use of dB maps very well 
to the logarithmic nature of our hearing, so that we can easily 
understand a change of 6dB as a doubling or halving ("-6dB")  of 
loudness, while a change of 1dB is barely noticeable. It is no different 
in principle from referring to octaves and semitones instead of raw Hz 
values.

One of the many advantages of using the 0dbfs = 1 notation in Csound is 
that you neatly eliminate part of that calculation: since 1 now = 
digital peak, you can put the individual amplitude value straight into 
the db calculation. On occasions you may have a reason to fiddle with 
explicit amplitudes (e.g. to find the difference between 0.01 and 
0.707); then you just need to remember that the input to the log10 
calculation  is the ~ratio~ of the two, either .01/.707 or the inverse. 
Which form you use depends on what you are looking for - the output will 
be the same dB value, but  either negative or positive. This is also why 
you can't put zero into such a calculation, as there is no such thing as 
a zero ratio.


Richard Dobson