Csound Csound-dev Csound-tekno Search About

[Csnd] Re: Re: dynamic range

Date2008-12-21 09:52
Fromvictor
Subject[Csnd] Re: Re: dynamic range
Anyway, if you are using 16bit, the max positive value in its signed range 
is
32767, so 20log10(32767) = 90.3

Victor

----- Original Message ----- 
From: "victor" 
To: 
Sent: Saturday, December 20, 2008 10:31 PM
Subject: [Csnd] Re: dynamic range


> Again: where does it say that csound's max amp is 90.3dB?
> ----- Original Message ----- 
> From: "Federico Vanni" 
> To: "csound mailing list" 
> Sent: Saturday, December 20, 2008 8:36 PM
> Subject: [Csnd] dynamic range
>
>
>> hi list,
>>
>> i know the dynamic range of a 16 bit digital audio system is 96dB,
>> so why the maximum amplitude value in csound is 90.3 dB?
>>
>> thanks
>> fv
>>
>>
>>
>> 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" 


Date2008-12-21 09:56
FromFederico Vanni
Subject[Csnd] Re: Re: Re: dynamic range
yes, I know... so why all DSP books says that dynamic range is 96dB
and not 90.3????

thanks
fv



Il giorno 21/dic/08, alle ore 10:52, victor ha scritto:

> Anyway, if you are using 16bit, the max positive value in its  
> signed range is
> 32767, so 20log10(32767) = 90.3
>
> Victor
>
> ----- Original Message ----- From: "victor" 
> To: 
> Sent: Saturday, December 20, 2008 10:31 PM
> Subject: [Csnd] Re: dynamic range
>
>
>> Again: where does it say that csound's max amp is 90.3dB?
>> ----- Original Message ----- From: "Federico Vanni"  
>> 
>> To: "csound mailing list" 
>> Sent: Saturday, December 20, 2008 8:36 PM
>> Subject: [Csnd] dynamic range
>>
>>
>>> hi list,
>>>
>>> i know the dynamic range of a 16 bit digital audio system is 96dB,
>>> so why the maximum amplitude value in csound is 90.3 dB?
>>>
>>> thanks
>>> fv
>>>
>>>
>>>
>>> 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"


Date2008-12-21 11:10
Fromroot
Subject[Csnd] Re: Re: Re: Re: dynamic range
>From my lecture notes 96dB is the SNR.  The extra bit comes from a 
constant bit.  Will look up the details and reply


Date2008-12-21 11:21
Fromroot
Subject[Csnd] Re: Re: Re: Re: dynamic range
Sorry -- I think the real issue is 16bits is 96.32dB but if we have signed 
samples there are only 15 bits which is 90.3

Need more coffee.......



Date2008-12-21 11:34
FromFederico Vanni
Subject[Csnd] Re: Re: Re: Re: Re: dynamic range
what you mean "if we have signed sample"?

thanks
fv






Il giorno 21/dic/08, alle ore 12:21, root ha scritto:

> Sorry -- I think the real issue is 16bits is 96.32dB but if we have  
> signed samples there are only 15 bits which is 90.3
>
> Need more coffee.......
>
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
> "unsubscribe csound"


Date2008-12-21 11:51
Fromjpff@cs.bath.ac.uk
Subject[Csnd] Re: Re: Re: Re: Re: Re: dynamic range
>
> what you mean "if we have signed sample"?
>
> thanks
> fv
>

The 16 bits have to deal with -N to +N so one bit is "lost" to the sign,
and the ratio of smallest absolute to largest is 1 to 2^15, not 2^16

=JOhn


Date2008-12-21 13:09
FromFederico Vanni
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: dynamic range
...so why in many books is wrote that the dynamic range
of 16 bit systems is 96dB and not 90 dB?
see curtis roads and many others.
fv





Il giorno 21/dic/08, alle ore 12:51, jpff@cs.bath.ac.uk ha scritto:

>>
>> what you mean "if we have signed sample"?
>>
>> thanks
>> fv
>>
>
> The 16 bits have to deal with -N to +N so one bit is "lost" to the  
> sign,
> and the ratio of smallest absolute to largest is 1 to 2^15, not 2^16
>
> =JOhn
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
> "unsubscribe csound"


Date2008-12-21 13:28
FromAndrea Valle
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Re: dynamic range
if there's no sign issue, you have 16 bits available, I guess

Best

-a-

On 21 Dec 2008, at 14:09, Federico Vanni wrote:

...so why in many books is wrote that the dynamic range
of 16 bit systems is 96dB and not 90 dB?
see curtis roads and many others.
fv





Il giorno 21/dic/08, alle ore 12:51, jpff@cs.bath.ac.uk ha scritto:


what you mean "if we have signed sample"?

thanks
fv


The 16 bits have to deal with -N to +N so one bit is "lost" to the sign,
and the ratio of smallest absolute to largest is 1 to 2^15, not 2^16

=JOhn



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"

--------------------------------------------------
Andrea Valle
--------------------------------------------------
CIRMA - DAMS
Università degli Studi di Torino
--------------------------------------------------

"The objectives of SuperCollider have been taken a stage further with the development of SAOL, the fruits of a research project based at MIT, launched in 1998" 
(P. Manning, Electronic and Computer Music, revised and expanded edition, 2004)


Date2008-12-21 13:36
Fromjpff@cs.bath.ac.uk
Subject[Csnd] Re: Re: dynamic range
> ...so why in many books is wrote that the dynamic range
> of 16 bit systems is 96dB and not 90 dB?
> see curtis roads and many others.
> fv
>

I cannot speak for Cutis Roads, but 16bits translates to a ratio of 96dB. 
That is true but misleading.  In audio we hace to handle + and -
displacement from a norm, and so what we call 16bits is really 15 bits and
a sign.  Hence the dynamic range of "16bit" audio is 90dB.

Does it really matter?

==John ff




Date2008-12-21 14:02
FromAlan Peter Fitch
Subject[Csnd] Re: Re: Re: dynamic range
jpff@cs.bath.ac.uk wrote:
>> ...so why in many books is wrote that the dynamic range
>> of 16 bit systems is 96dB and not 90 dB?
>> see curtis roads and many others.
>> fv
>>
> 
> I cannot speak for Cutis Roads, but 16bits translates to a ratio of 96dB. 
> That is true but misleading.  In audio we hace to handle + and -
> displacement from a norm, and so what we call 16bits is really 15 bits and
> a sign.  Hence the dynamic range of "16bit" audio is 90dB.
> 
> Does it really matter?
> 
> ==John ff
> 
> 

The 96db figure is the dynamic range of maximum signal to quantization
noise, assuming quantization noise can be approximated as white
gaussian, and has a maximum value of +/- half an LSB.

In other words the range of a signal from maximum 16 bits to the minimum
that would be below the quantization noise level.

The other figure you are talking about is expressing an amplitude value
in dB. dB are always relative to something. Normally in audio, dB (as
Richard Dobson has repeated many times!) are relative to full scale, the
maximum value that the signal can take.

So a maximum amplitude sinewave would be 0dBFS (dB full scale).

There is another point of confusion here: with 2's complement
arithmetic, the possible range of values of a signal is -2^15 to 2^15 -1
i.e. -32768 to +32767.

However a full amplitude sinewave centred on zero would have to be
symmetrical, i.e. -32767 to +32767. Of course as quantization is to
+/-0.5 LSB you could argue that the maximum is

-32767.5 to +32767.5

if you wanted to.

If you want to express that in dB then the amplitude is +32767.5 - but
relative to what? The minimum representable sinewave would be +/-0.5
lsb, so if you express the maximum amplitude relative to the minimum you
get

  20log10(32767.5 / 0.5) = 96.32dB

To summarise

1) the often quoted 96dB is the ratio of the power in a full amplitude
sinewave to the power in the quantization noise, assuming quantization
noise can be approximated as white guassian noise.

2) the amplitude of a sinewave expressed in dB *must* be expressed
relative to a reference. If the reference is 0.5LSB, then the maximum is
96dB.

3) Most audio engineers express dbFS, the maximum amplitude is 0dBFS,
for a 16 bit system the minimum amplitude would be -96.32dBFS

I hope this helps,

regards
Alan


-- 
Alan Fitch

Date2008-12-21 14:57
FromFederico Vanni
Subject[Csnd] Re: Re: Re: Re: dynamic range
ok Alan, thanks...
so why we don't change the 'ampdb' opcode using
a maximum dB value of 96???
it should be more accurate teorically...
best
fv





Il giorno 21/dic/08, alle ore 15:02, Alan Peter Fitch ha scritto:

> jpff@cs.bath.ac.uk wrote:
>>> ...so why in many books is wrote that the dynamic range
>>> of 16 bit systems is 96dB and not 90 dB?
>>> see curtis roads and many others.
>>> fv
>>>
>>
>> I cannot speak for Cutis Roads, but 16bits translates to a ratio  
>> of 96dB.
>> That is true but misleading.  In audio we hace to handle + and -
>> displacement from a norm, and so what we call 16bits is really 15  
>> bits and
>> a sign.  Hence the dynamic range of "16bit" audio is 90dB.
>>
>> Does it really matter?
>>
>> ==John ff
>>
>>
>
> The 96db figure is the dynamic range of maximum signal to quantization
> noise, assuming quantization noise can be approximated as white
> gaussian, and has a maximum value of +/- half an LSB.
>
> In other words the range of a signal from maximum 16 bits to the  
> minimum
> that would be below the quantization noise level.
>
> The other figure you are talking about is expressing an amplitude  
> value
> in dB. dB are always relative to something. Normally in audio, dB (as
> Richard Dobson has repeated many times!) are relative to full  
> scale, the
> maximum value that the signal can take.
>
> So a maximum amplitude sinewave would be 0dBFS (dB full scale).
>
> There is another point of confusion here: with 2's complement
> arithmetic, the possible range of values of a signal is -2^15 to  
> 2^15 -1
> i.e. -32768 to +32767.
>
> However a full amplitude sinewave centred on zero would have to be
> symmetrical, i.e. -32767 to +32767. Of course as quantization is to
> +/-0.5 LSB you could argue that the maximum is
>
> -32767.5 to +32767.5
>
> if you wanted to.
>
> If you want to express that in dB then the amplitude is +32767.5 - but
> relative to what? The minimum representable sinewave would be +/-0.5
> lsb, so if you express the maximum amplitude relative to the  
> minimum you
> get
>
>   20log10(32767.5 / 0.5) = 96.32dB
>
> To summarise
>
> 1) the often quoted 96dB is the ratio of the power in a full amplitude
> sinewave to the power in the quantization noise, assuming quantization
> noise can be approximated as white guassian noise.
>
> 2) the amplitude of a sinewave expressed in dB *must* be expressed
> relative to a reference. If the reference is 0.5LSB, then the  
> maximum is
> 96dB.
>
> 3) Most audio engineers express dbFS, the maximum amplitude is 0dBFS,
> for a 16 bit system the minimum amplitude would be -96.32dBFS
>
> I hope this helps,
>
> regards
> Alan
>
>
> -- 
> Alan Fitch
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
> "unsubscribe csound"


Date2008-12-21 16:35
FromRichard Boulanger
Subject[Csnd] Re: dynamic range
Hello John,

I think that it does really matter - especially when you use the ampdb  
value converter and wonder
why you get samples out of range at what you thought were acceptable - 
dB values (based on
what  you were taught and what you have read.)

I am very very happy to know this information related to amplitude -  
that we loose a bit of
resolution for the - + sign.

Hopefully we can add something to the manual about this!  And I can't  
wait to share this with my
students next semester and from now on.

-dr. B.


On Dec 21, 2008, at 8:36 AM, jpff@cs.bath.ac.uk wrote:

>> ...so why in many books is wrote that the dynamic range
>> of 16 bit systems is 96dB and not 90 dB?
>> see curtis roads and many others.
>> fv
>>
>
> I cannot speak for Cutis Roads, but 16bits translates to a ratio of  
> 96dB.
> That is true but misleading.  In audio we hace to handle + and -
> displacement from a norm, and so what we call 16bits is really 15  
> bits and
> a sign.  Hence the dynamic range of "16bit" audio is 90dB.
>
> Does it really matter?
>
> ==John ff
>
>
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
> "unsubscribe csound"


Date2008-12-21 17:06
FromRichard Boulanger
Subject[Csnd] Re: dynamic range
To clarify - not asking you to change existing opcodes - but some of  
this info would
be very cool to add to the manual.

-dB

On Dec 21, 2008, at 11:35 AM, Richard Boulanger wrote:

> Hello John,
>
> I think that it does really matter - especially when you use the  
> ampdb value converter and wonder
> why you get samples out of range at what you thought were acceptable  
> -dB values (based on
> what  you were taught and what you have read.)
>
> I am very very happy to know this information related to amplitude -  
> that we loose a bit of
> resolution for the - + sign.
>
> Hopefully we can add something to the manual about this!  And I  
> can't wait to share this with my
> students next semester and from now on.
>
> -dr. B.
>
>
> On Dec 21, 2008, at 8:36 AM, jpff@cs.bath.ac.uk wrote:
>
>>> ...so why in many books is wrote that the dynamic range
>>> of 16 bit systems is 96dB and not 90 dB?
>>> see curtis roads and many others.
>>> fv
>>>
>>
>> I cannot speak for Cutis Roads, but 16bits translates to a ratio of  
>> 96dB.
>> That is true but misleading.  In audio we hace to handle + and -
>> displacement from a norm, and so what we call 16bits is really 15  
>> bits and
>> a sign.  Hence the dynamic range of "16bit" audio is 90dB.
>>
>> Does it really matter?
>>
>> ==John ff
>>
>>
>>
>>
>>
>> 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"


Date2008-12-21 17:11
FromAlan Peter Fitch
Subject[Csnd] Re: Re: Re: Re: Re: dynamic range
Federico Vanni wrote:
> ok Alan, thanks...
> so why we don't change the 'ampdb' opcode using
> a maximum dB value of 96???
> it should be more accurate teorically...
> best
> fv
> 
I don't see why. ampdb is returning with a reference of 1 so it's accurate.

I agree with Richard Dobson - just think of the maximum value as 0dBFS,
use dB values throughout (which will all be negative as they are less
then 1), then you don't care if the final system is using 16 bits, 24
bits, floats, doubles - it doesn't matter.

regards
Alan

P.S. ampdb has existed for a long time, so I don't think people will
want to change it!



-- 
Alan Fitch

Date2008-12-21 18:24
FromFederico Vanni
Subject[Csnd] Re: Re: dynamic range
jpff@cs.bath.ac.uk wrote:

>>  Hence the dynamic range of "16bit" audio is 90dB.
>
> ==John ff
>



hi john ff,

hoping to understand correctly:

the dynamic range is the "ratio between the smallest and largest  
possible values"...
(see, for example, wikipedia).
as alan wrote, with "smallest" we mean the "amplitude relative to
the minimum you get", that is  +/-0.5...

so the dynamic range should be 20*log10(32767.5 / 0.5) that is 96dB
NOT 90 dB...

90 dB, instead, is the ratio between ZERO and the largest possible  
value,
that is 20*log10 32767.

all books reports a 96 dB dynamic range for a 16 bit system... nobody
wrote about 90 dB.

thus, it would be nice to create a new opcode (not changing the  
previous ampdb)
such as "ampdb2", or something like that, in wich one can specify the
correct dynamic range...

fv



Date2008-12-21 18:55
Fromjpff@cs.bath.ac.uk
Subject[Csnd] Re: Re: Re: dynamic range
> jpff@cs.bath.ac.uk wrote:
>
> 90 dB, instead, is the ratio between ZERO and the largest possible
> value,
> that is 20*log10 32767.


Come on!  The ratio between zero and any strinctly positive number is
infinite



Date2008-12-21 20:49
FromFederico Vanni
Subject[Csnd] Re: Re: Re: Re: dynamic range
with ....ZERO i mean simply 32767 and nothing.
that is, again, 20*log10 32767.

fv


Il giorno 21/dic/08, alle ore 19:55, jpff@cs.bath.ac.uk ha scritto:

>> jpff@cs.bath.ac.uk wrote:
>>
>> 90 dB, instead, is the ratio between ZERO and the largest possible
>> value,
>> that is 20*log10 32767.
>
>
> Come on!  The ratio between zero and any strinctly positive number is
> infinite
>
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
> "unsubscribe csound"


Date2008-12-22 01:06
FromAlan Peter Fitch
Subject[Csnd] Re: Re: Re: dynamic range
Federico Vanni wrote:
> jpff@cs.bath.ac.uk wrote:
> 
>>>  Hence the dynamic range of "16bit" audio is 90dB.
>> ==John ff
>>
> 
> 
> 
> hi john ff,
> 
> hoping to understand correctly:
> 
> the dynamic range is the "ratio between the smallest and largest  
> possible values"...
> (see, for example, wikipedia).
> as alan wrote, with "smallest" we mean the "amplitude relative to
> the minimum you get", that is  +/-0.5...
> 
> so the dynamic range should be 20*log10(32767.5 / 0.5) that is 96dB
> NOT 90 dB...
> 
> 90 dB, instead, is the ratio between ZERO and the largest possible  
> value,
> that is 20*log10 32767.
> 
> all books reports a 96 dB dynamic range for a 16 bit system... nobody
> wrote about 90 dB.
> 
> thus, it would be nice to create a new opcode (not changing the  
> previous ampdb)
> such as "ampdb2", or something like that, in wich one can specify the
> correct dynamic range...
> 

Hi Federico,

 ampdb simply implements the conversion according to

   amp = 10^(db/20)

As long as you know what it's doing, it seems clear to me. What it's
doing is converting using a reference value of 1.

The dynamic range is still 96db. Just plug in the minimum and maximum
values, 0.5 and 32767 i.e. 90db and -6db (using 0dB = 1). The difference
is 90 - (-6) = 96dB.

dB only make sense if you know what the reference is.

regards
Alan

-- 
Alan Fitch