The dynamic range of 16 bits

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.

First, the 96db is misleading. CD is not realy 16 Bit but a signed
(+/-) 15-Bit System. That means we have 15 Bit for "negative" Values
and 15-Bit for "postive" Values. That immediatly takes 6db out of that
96db Spec.

I shall bother doing all the math here, because it seem that plenty of
people have not done so before posting.

As said, 16 Bit are realy 15Bit plus "sign", that translates into a
system capable of representing 2^15 discrete levels.

2^15 equals 32768

20 * Log(32768) equals 90.30899869919 (db).

These are the ABSOLUTE limits of the CD Format. Below this (-90.3db)
or above this (0db) there is no way to record any Information.

Some people have insisted that CD is capable of a Dynamic Range of
more than the (erronous) 96db. This is pure Science Fiction.


KYW , do you stand by the assertion quoted above?

ray.
 
diyAudio Retiree
Joined 2002
Ninety-six and a half LSB just won't do Oh,no,no, just won't get it*

*Creedence redundancy check or CCR-CRC for short.



Never in the field of human conflict was so much posted to so many and of meaning to so few.
 

Attachments

  • wcphoto.jpg
    wcphoto.jpg
    21.8 KB · Views: 282
The dynamic range of a signed 16 bit number is the same as the dynamic range of an unsigned 16 bit number.

The smallest signal that can be represented with 16 bits has a peak-to-peak amplitude of 1/2^16 * FS, or -96.3dBFS. Most DACs are AC coupled so the 1/2^17 * FS DC offset doesn't really matter.
 
0.5 LSB won't work

SY said:
The dynamic range is defined as the ratio between biggest and smallest encodable signal. Converting to dB, 20 x log (65536) = 96.3 dB.

If we apply the 0.5 LSB dc shift, we also enlarge the "smallest encodable signal". Say, 0x0001 would be 0.5, 0x0000 would be -0.5, there's no way to destinguish 0x0001 and 0x0000 with Zero signal. Thus 0x0002 or 0xFFFF would become the "smallest encodabe signal", which makes things even worse.
 
What the heck, here's a hack!

Kuei,

since you don't seem to get any commercial programs to
produce the 1-bit p-p sine wave, here's a C++ one that does.

Beware however, it is just a slight rehack of a quick hack
I did a few years ago to produce a test CD. Don't use it as
an example for how to write programs, it was never meant
to be read by others. Everything is hardcoded in the code.
Relevant constants are

int frequency Frequency of the sine wave
float ampliture The p-p amplitude in bits
int time lengt of data in seconds

The output is written as a Windows wave file called "sine.wav"
which can be burnt to CDR by any normal burning program. It
should really take the above constants as parameters to be
a bit more flexible, but since I only post for the purpose of
the -96dB case I won't bother. BTW, I did add the half bit
offset when I rehacked it. had never bothered about that
before.

All rights reserved. The wrongs are free, though. :)

--------------------------------------------------------

#include <stdlib.h>
#include <fstream>


typedef union {int val; unsigned char c[4];} charint;



void OutWord(ofstream& o, int i){
charint x;
x.val = i;
o.put(x.c[0]); o.put(x.c[1]);
};

void OutDword(ofstream& o, int i){
charint x;
x.val = i;
o.put(x.c[0]); o.put(x.c[1]); o.put(x.c[2]); o.put(x.c[3]);
};


int main(int argc, char** argv){
int frequency = 1000;
float amplitude = 0.5; // Number of bits for peak value, not peak-to-peak!
int samplerate = 44100;
int nofbits = 16;
int nofbytes = nofbits/8; // Not correct for other than 16 bits!!
int channels = 2;
int samplesize = nofbytes*channels;
int time = 10;
int nofsamples = time*samplerate;
int datachunklen = nofsamples * samplesize;


const int riffhdrlen = 8;
const int wavhdrlen = 4;
const int fmthdrlen = 8;
const int fmtchunklen = 16;
const int datahdrlen = 8;

int totfmtlen = fmthdrlen + fmtchunklen;
int totdatalen = datahdrlen + datachunklen;
int rifflen = 4 + totfmtlen + totdatalen; // 4 is for "WAVE"


ofstream wav("sine.wav", ios::eek:ut|ios::binary);

// Write RIFF header
wav << "RIFF";
OutDword(wav, rifflen);

// Write Wave format chunk
wav << "WAVEfmt ";
OutDword(wav, fmtchunklen); // Lengt of Wave fmt chunk
OutWord(wav, 1); // PCM coding
OutWord(wav, 2); // # of channels
OutDword(wav, samplerate); // Sample rate
OutDword(wav, samplerate*4); // # of bytes/s.
OutWord(wav, 4); // # of bytes/sample (for all channels)
OutWord(wav, 16); // # of bits

// Write Data chunk
// First the header
wav << "data";
OutDword(wav, datachunklen);
// Then the data itself

cout << "Time = " << time << ", nofsamples = " << nofsamples
<< ", data chunk length = " << datachunklen << endl;

float cycletime = 1/frequency;
float samples_per_cycle = samplerate/frequency;
const float pi = 3.1415926;
float yf;
int y;
float sumf = 0;
int sumi = 0;

/// Main loop writing sample values to file ///
///////////////////////////////////////////////
for (float i = 0; i < nofsamples; i++){
// Compute sample value as a float
yf = amplitude * sin(2*pi*(i / samples_per_cycle));
// Add 1/2 bit DC offset.
yf += 0.5;
// Make it an integer and add 0.5 to get roundoff instead of truncation
y = int(yf+0.5);
OutWord(wav, y); OutWord(wav, y);
};

};
 
And here is the beginning of the wave file. The first 44 bytes
are just the file header, the rest is data. Note that there are
two channels (same data on both) and that byte order is
Intel-style, ie. backwards.

happy "listening"

---------------------------------


00000000: 5249 4646 c4ea 1a00 5741 5645 666d 7420 RIFF....WAVEfmt
00000010: 1000 0000 0100 0200 44ac 0000 10b1 0200 ........D.......
00000020: 0400 1000 6461 7461 a0ea 1a00 0100 0100 ....data........
00000030: 0100 0100 0100 0100 0100 0100 0100 0100 ................
00000040: 0100 0100 0100 0100 0100 0100 0100 0100 ................
00000050: 0100 0100 0100 0100 0100 0100 0100 0100 ................
00000060: 0100 0100 0100 0100 0100 0100 0100 0100 ................
00000070: 0100 0100 0100 0100 0100 0100 0100 0100 ................
00000080: 0100 0100 0100 0100 0000 0000 0000 0000 ................
00000090: 0000 0000 0000 0000 0000 0000 0000 0000 ................
000000a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
000000b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
000000c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
000000d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
000000e0: 0100 0100 0100 0100 0100 0100 0100 0100 ................
000000f0: 0100 0100 0100 0100 0100 0100 0100 0100 ................
00000100: 0100 0100 0100 0100 0100 0100 0100 0100 ................
00000110: 0100 0100 0100 0100 0100 0100 0100 0100 ................
00000120: 0100 0100 0100 0100 0100 0100 0100 0100 ................
00000130: 0100 0100 0100 0100 0000 0000 0000 0000 ................
00000140: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000150: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000160: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000170: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000180: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000190: 0100 0100 0100 0100 0100 0100 0100 0100 ................
000001a0: 0100 0100 0100 0100 0100 0100 0100 0100 ................
000001b0: 0100 0100 0100 0100 0100 0100 0100 0100 ................
000001c0: 0100 0100 0100 0100 0100 0100 0100 0100 ................
000001d0: 0100 0100 0100 0100 0100 0100 0100 0100 ................
000001e0: 0100 0100 0100 0100 0000 0000 0000 0000 ................
000001f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
 
Re: What the heck, here's a hack!

Koinichiwa,

Christer said:
Kuei,

since you don't seem to get any commercial programs to
produce the 1-bit p-p sine wave, here's a C++ one that does.


Using Cooledit set to 1/2 LSB offset and attempting to code a -91dbfs Sinewave did the trick. Except, the output as shown is more noise than signal.

The point is that you can artificially generate anything, but the resulting file is in effect not valid as Audio file, otherwise the various Shareware, Freeware and commercial wave edit programs out there would do it.

In effect it means that you cannot in any way that is demonstrable create a valid file (this includes actual recordings) that go below -90.3dbfs without adding jutter. Try it. Try making an AUDIO file with a -96dbfs sinewave encoded in 16 Bit. DO NOT write a Binary file that in effect is outside the 16 Bit PCM Specs, PLEASE TRY. You will be amused by the results.

My contention that CD and CD equivalent PCM Audio does not accept (without dither) signals below -90.3db with any reasonable encoding has yet to be disproven, reams of math presented nonwithstanding. No-One has produced a suitable file and posted it.

Sayonara
 
diyAudio Retiree
Joined 2002
We have been down this path.........

"You haven't answered the question: are you toggling the LSB on and off?"

The wave form show appears to be doing just that. The Burr Brown data sheet shows the LSB voltage step as 92 microvolts. Common sense would one to believe that that waveform shown would be the smallest possible 1 kHz waveform and would be to show the performance at the lowest amplitude signal that the device can generate. Is this such a stretch in reasoning to draw this conclusions? Data and measurements from Burr Brown and Stereophile would seem to be reasonably credible sources. It says its an undithered 1 kHz sine wave at-90.3 dB referenced to full scale for 16 bit data. The zero to peak voltage appears to be in the 90 to 100 microvolt neighborhood. Most lawyers and engineers would call that pretty solid evidence.........
 

Attachments

  • 90.3sine.jpg
    90.3sine.jpg
    20.8 KB · Views: 255
...Yes M'Lud, the evidence...

Fred said

It says its an undithered 1 kHz sine wave at-90.3 dB referenced to full scale for 16 bit data. The zero to peak voltage appears to be in the 90 to 100 microvolt neighborhood. Most lawyers and engineers would call that pretty solid evidence.........

And that is exactly what KYW said you get. The point is you can't get less than a -90.3dB sine wave from a signed 15bit system.

Signed 15 bits coding is not the same as 16 bit coding. Period.

It is that simple... otherwise they would have called it the same thing and we wouldn't have signed 15 bits coding. Using 16 bit coding maths to describe a signed 15 bit system is silly. Use the signed 15 bit maths and you get Kuei's figures.

Although I have to say that I have great admiration for Fred's et als ability to turn an argument and use words and pictures just enough out of context to help his case. You should have been a lawyer not an EE :nod:

And I have even greater admiration for KYW's patience in continuing to explain things to people who just won't take an open look (or relook) at thier established knowledge base...

ciao

James
 
The dynamic range is a function of the smallest step-change that can be generated and is not necessarily the amplitude of the smallest "sine" that can be represented.

A wave of the form:

0...,-1...,0...,-1...
0x0000...,0xFFFF...,0x0000...,0xFFFF...

or:

0...,1...,0...,1...
0x0000...,0x0001...0x0000...,0x0001...

Both have a peak amplitude of 2^-17 and peak-to-peak amplitude of 2^-16 in a signed representation.

The unsigned equivalent can be found by adding 0x8000 modulo 2^16 to those:

0x8000...,0x7FFF...,0x8000...,0x7FFF...

or:

0x8000...,0x8001...0x8000...,0x8001...

Only the LSB changes...
 
The dynamic range is a function of the smallest step-change that can be generated and is not necessarily the amplitude of the smallest "sine" that can be represented.

Absolutely correct. And Fred's picture illustrates why. He is NOT in any sense toggling the LSB, he's toggling two LSBs. So no surprise that he sees the signal at 6 dB higher than the minimum encodable signal level.

To your point, Rob, dynamic range does not even have to be referenced to a periodic signal. If a DAC has an output of zero at a data input of zero, and you turn on the LSB, the output will step accordingly- or else you've got a defective DAC.
 
Re: We have been down this path.........

Fred Dieckmann said:
"You haven't answered the question: are you toggling the LSB on and off?"

The wave form show appears to be doing just that. The Burr Brown data sheet shows the LSB voltage step as 92 microvolts. Common sense would one to believe that that waveform shown would be the smallest possible 1 kHz waveform and would be to show the performance at the lowest amplitude signal that the device can generate. Is this such a stretch in reasoning to draw this conclusions? Data and measurements from Burr Brown and Stereophile would seem to be reasonably credible sources. It says its an undithered 1 kHz sine wave at-90.3 dB referenced to full scale for 16 bit data. The zero to peak voltage appears to be in the 90 to 100 microvolt neighborhood. Most lawyers and engineers would call that pretty solid evidence.........


I am sure the lawyers would, what do they know about binary
numbers, and I am sure there are a lot of engineers who don't
know about them either. I know oF one gooD example.

They are not toggling the LSB at all, that can only give a 1-bit
change. If one bit is 90uV and the zero-peak value above is
90uV there is in fact a swing of +/- 1 bit, that is, three different
binary numbers are required to represent the waveform (which
also means we would need at least 2 bits to represent this
waveform. Fortunately, we have 16).

Whether the dynamic range is 90dB or 96dB is another question,
though. Except for some confusion about binary numbers etc.
the main controversy seem to me to be rather about the
definition of dynamic range. So the proper question is probably
not whether we have 90 or 96 dB, but how we should define
the dynamic range. I admit to having made some premature
ill-decided remarks early on in this discussion, first accepting
the 90dB figure, then instead accepting the 96dB figure. Well,
now I am just confused. As we are discussing the CD-format
specifically, I think, and not arbitrary 16-bit representations I
might also be reasonable to ask whether the Red Book allows
the data to have a DC offset, for instance? I have not read it,
and so have no clue to this.
 
Re: ...Yes M'Lud, the evidence...

James D. said:
And that is exactly what KYW said you get. The point is you can't get less than a -90.3dB sine wave from a signed 15bit system.

You need to go back and re-read Kuei's original claim. Here's the pertinent part:

These are the ABSOLUTE limits of the CD Format. Below this (-90.3db) or above this (0db) there is no way to record any Information.

This is simply incorrect. You can indeed record information below -90.3dB. You can record down to +/-1/2LSB, which is at the -96dB level.

Signed 15 bits coding is not the same as 16 bit coding. Period.

It's not signed 15-bit encoding, it's signed 16-bit encoding. All 16 bits are used to describe the waveform with 16-bit quantization levels giving it a 16-bit dynamic range which has been established over and over and over and over and over again as 96dB.

It is that simple... otherwise they would have called it the same thing and we wouldn't have signed 15 bits coding. Using 16 bit coding maths to describe a signed 15 bit system is silly. Use the signed 15 bit maths and you get Kuei's figures.

Kuei's figures are incorrect. Like a magician, he's only showing you half the picture. You're not describing the waveform with just 15 bits. You're describing the waveform with the full 16 bits in TWO domains of 32,768 values. +32,768 and -32,768. That means that your maximum signal swing can span (+32,768) - (-32,768) or 65,536. That's 16 bits. Not 15.

If the waveform were being described with ONLY 32,768 values, then indeed you would have a 15 bit system and ITS dynamic range would indeed be 90.3dB.

And I have even greater admiration for KYW's patience in continuing to explain things to people who just won't take an open look (or relook) at thier established knowledge base...

Well, I've looked at the established knowledge base of many others and read quite a few books and research papers on the issue by those with a knowledge base far far greater than my own and not so much as one of them backs up Kuei's claim.

Kuei's basically standing all alone. So either he has completely overturned all that which has been established by far greater minds than his from Shannon and Nyquist on down, or he's wrong.

se
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.