Csound Csound-dev Csound-tekno Search About

ampdb (RE: oscil3 glitch problem)

Date1999-05-12 16:40
Fromluis jure
Subjectampdb (RE: oscil3 glitch problem)
>> according to the manual, ampdb returns a raw value of 32000 for 90dB,
thus
>> if you take 0dB as your maximum output, a value of 90 would give almost
0dB
>> for 16 bits (-0.3 in fact) and not -6 dB as you seem to want.
>>
>> by the way, looking at the output, ampdb doesn't seem to be extremely
>> precise. or is it?
>
>Hmm! I was under the impression that (perfect) 16 bit audio had a 96 dB
>dynamic range, hence the above. Perhaps ampdb is calibrated wrong, or am I
>missing something?


it seems you're talking about different things.
one thing is the signal to noise ratio of a given device. a simple way to
calculate the approximate _theoretical_ S/N of a digital to analog converter
is multiplying 6*number of bits. thus, for a 16 bit DAC you get
approximately 96dB in theory. with good and expensive (and i mean expensive)
cards you can get close to that figure, i guess. cheaper cards used in
personal computers can have a significantly lower performance.

but you know dB is not a magnitude in itself, just the log of a ratio. if
you take 0dB as your maximum amplitude, you have a raw value 32767 as 0dB
for a definition of 16 bits. now, in Csound ampdb returns 32000 (that
is -0.3 dB) for an input of 90, so if you use ilevl = ampdb(96 + p4), for p4
= 0 you'll get ampdb(96), i. e. a raw amplitude of 64000. in fact you'll get
cliping for all values of p4 greater than -6. not that ampdb is calibrated
wrong, it's just a convention.

i'm sorry all this is so simple, but i don't even have my pohlman handy, so
don't expect too much from me.

completely apart from this, it's true that ampdb is _not_ very well
calibrated; for 90 it returns 31622.8 and not 32000 as the manual says.
below is a table comparing what i and real values given by amdb:

90     32000        31622.8
89     28508.76     28183.8
88     25398.43     25118.9
87     22627.42     22387.2
86     20158.75     19952.6
85     17959.39     17782.8
84     16000        15848.9
83     14254.36     14125.4
82     12699.2      12589.2
81     11313.69     11220.2
80     10079.36     10000.0
79      8979.71      8912.5
78      8000         7943.3

and so on. as you see, deviations can be considered negligible.
all that if i calculated well, that might not be the case.





Date1999-05-14 03:40
FromTerry McDermott
SubjectRe: ampdb (RE: oscil3 glitch problem)
Hate to be pedantic, but you have to remember that 6dB is not exactly a
factor of 2, but 6.0206 is.  (20log2=6.0206...) So a change in 6 db is
slightly less than a factor of 2 in the linear amplitude. I assume that
this is the source of the 'discrepancy' of calibration.

>
>completely apart from this, it's true that ampdb is _not_ very well
>calibrated; for 90 it returns 31622.8 and not 32000 as the manual says.
>below is a table comparing what i and real values given by amdb:
>
>90     32000        31622.8
>89     28508.76     28183.8
>88     25398.43     25118.9
>87     22627.42     22387.2
>86     20158.75     19952.6
>85     17959.39     17782.8
>84     16000        15848.9
>83     14254.36     14125.4
>82     12699.2      12589.2
>81     11313.69     11220.2
>80     10079.36     10000.0
>79      8979.71      8912.5
>78      8000         7943.3
>
>and so on. as you see, deviations can be considered negligible.
>all that if i calculated well, that might not be the case.


Terry McDermott

Music Department
School of Arts & Media
Latrobe University
Bundoora, Victoria, 3083
Australia

email: T.McDermott@latrobe.edu.au

Telephone	+61 3 9479 2167
Fax		+61 3 9479 3651