Hi-Fi 4 Sale - Malaysia / Singapore Audio Forum & Marketplace | www.hifi4sale.net
Would you like to react to this message? Create an account in a few clicks or log in to continue.







Search
 
 

Display results as :
 


Rechercher Advanced Search

440Hz.my - expanding musical horizons
Subscribe to our Feed
addtomyyahoo4 Subscribe with BloglinesAdd to netvibes
Add to Google

Explanation of LSB and MSB

2 posters

Go down

Explanation of LSB and MSB Empty Explanation of LSB and MSB

Post by WongKN Tue Jun 21, 2011 7:57 pm

Here is a short explanation of the terms LSB and MSB and why it can affect the sound quality of digital sound so much. A willingness to indulge in a little bit of math is required.

BINARY NOTATION

Digital music is, strictly speaking, encoded using BINARY digital. Binary digital means that we use only two digits or numbers to represent all possible values : 0 and 1. The contrasts with our numbering system used in daily life which is DECIMAL. In decimal, we use ten separate digits or numbers, from 0 - 9 to represent a value.

Basically the 'scale' of binary is like this:

Decimal Number, Binary binary
0 = 0
1 = 1
2 = 10
3 = 11
4 = 100
5 = 101

and so forth. In the examples above, I use the convention like we use in decimal that the numbers sort of runs from right to left. I.e. as we add a new binary digit, we add it to the left. There are binary number schemes where we do the reverse, i.e. we add it to the right and so the numbers runs from left to right. E.g. the progression is 0, 1, 01, 11, 001, 101, and so forth. The two schemes are differentiated by names like little endian and big endian. For the purpose of this explanation, I will just stick to the first example above.

THE SIGNIFICANCE OF A 'WORD SIZE'

For computer related processing, we group bits together. Everyone with a bit of computer knowledge should know that a group of 8 bits is called a 'byte'. Beyond that, groupings of bytes are often called 'words'. The number of bytes, or bits, is called the 'word size'. This simply means how many bits (or bytes) we use to represent the values we want.

For RBCD, we work with a word size of 16bits. For 'high-res' we work with a word size ranging from 20bits, through 24 bits and occasionally to even higher sizes.

What this means is that no matter how small or large is the value we want to represent, we ALWAYS use 16 bits (for the example of RBCD).

For e.g. in the example above, to represent 0 or 1, I used only 1 bit. From 2 to 3, I used 2 bits. For each doubling of vaues I add a bit. However, that is just for convenience and breviety. In the case of a RBCD, we need to work with 16 bits. So the table above now becomes:

0 = 0000000000000000
1 = 0000000000000001
2 = 0000000000000010
3 = 0000000000000011
4 = 0000000000000100

IMPORTANT EXAMPLES

To complete my explanation, I give the following three examples of 16bit numbers and their actual value.

1000000000000000 = 32,768.
1000000000000001 = 32,769
1100000000000000 = 49,152

SPOT THE DIFFERENCE

Here now is 'crunch-time'. Note the three important examples I gave above. From 1000000000000000, i.e. 32,768, BOTH examples 2 and 3 differs by only 1 bit. I.e. compared to the first value, I only changed ONE BIT in each of the next two values. BUT LOOK !!!! The 2nd value is 32,769, only ONE larger than the first value. But the 3rd value is 49,152, 16,384 LARGER than the first value.

Remember all the times I snigger when we come across the remark "errors is only ONE BIT and so is insignificant compared to analogue".

Yeah, so HOW MUCH DIFFERENCE does ONE BIT makes ?

Well I think you can see clearly now. IT DEPENDS WHERE THE ONE BIT SITS !!! For RBCD, a single bit change can make a difference of between 1 to 32,768 (i.e. when the 'first' or left-most binary digit is changed).

MSB and LSB

So, NOT ALL BITS ARE CREATED EQUAL. Those bits that sits further up in the word are assigned higher values, up to 32,768 for 16bits of RBCD. In other words, their SIGNIFICANCE differs depending on where in the word the bit sits.

The bit that sits on the RIGHTMOST, or 'lowest' position is called the LEAST significant bit or LSB.

The bit that sits on the LEFTMOST, or 'highest' position is called the MOST significant bit or MSB.

If an LSB is changed, the value the word represents is changed by a value of 1.

If an MSB is changed, the value the word represents is changed by a value of 32,768.

HOW IT RELATES TO RBCD

Now the point about data transfer error is still open to debate, as in some people argues that there is no bit error in digital transfer but some people says there are. I shall not get into that debate here.

But the following point relates.

When a bit error occurs, for binary, it is always a change from 0 to 1 or 1 to 0. Technically we call this a 'bit-flip'. I.e the actual binary value is 'flipped' to the other possible value.

When we read from a CD or in any digital transfer, it is always in BIT-STREAMING format. I.e. we read the data BIT BY BIT from a CD. We transfer the data BIT BY BIT from transport to DAC. We don't magically transfer all 16 bits instaneously in one go. It is always bit by bit.

If a transfer error occurs, if a 'bit-flip' happens, we CANNOT guarantee where it occurs. Within the 16bit word of an RBCD data, it can occur at any of the bits.

The 'QUIZ'

And to close this explanation, I just ask you these simple questions.

What is the significance if the 'bit-flip' happens when the LSB is being transferred ?
What happens now if the 'bit-flip' happens to the MSB ?

Enjoy yourselves !! Laughing
WongKN
WongKN
Moderator
Moderator

Number of posts : 1795
Age : 62
Location : Malaysia
Registration date : 2009-01-20

Character sheet
Source(s):
Amplification:
Speakers:

Back to top Go down

Explanation of LSB and MSB Empty Re: Explanation of LSB and MSB

Post by vt4c Wed Jun 22, 2011 4:53 pm

WongKN,
Do I get a price for answering your quiz questions...? Rolling Eyes

Anyway regarding what you've asked...
1.) What is the significance if the 'bit-flip' happens when the LSB is being transferred ?
As you've rightfully mentioned, the LSB error is in-significant to show any big difference. Most audio DAC chips will have some errors in the LSB anyway. For the same reason, to preserve the data/information integrity, DAC has evolved and move up to > 16-bits.

2.) What is the significance if the 'bit-flip' happens when the LSB is being transferred ?
Well...To answer this, you'll probably need to understand how the digital data is being constructed. It's a bit hard to explain without an illustration...Please look for signed binary 2's complement data conversion at....

http://www.labmaster.com/products/faq/html/ssi_faq_dac_equations.html

Depends on the data, you'll learn that, the 'bit-flip' will cause a change in the amplitude (half-cycle) .

All in all, you need not worry too much about minute error caused by 'bit-flip' in the data stream. Shopuld it happens, you're talking about nano second for each error.Say, a 16-bits data with a 48-bits per word (24-bits per channel) length...Under 44.1KHz sampling rate without the use of any over-sampling, that will equates to...

44.1KHz * 48-bits = 2.1168MHz ; which is about 472 nsec.

The above is just min. 1/Fs with 48-bits word data. To make thing simpler, the DAC bit/system clock frequency is the duration in which a LSB bit error can occurs. For 16.9344MHz, that's is 59.05 nsec.

Unless a string of error happened in the datastream during conversion (this will probably be a fault developed in the DAC); human will not able to detect an error at such high speed .....Jitter will involved stings of data error during conversion; but that is another topic and another can of worms. Rolling Eyes
vt4c
vt4c
Frequent Contributor
Frequent Contributor

Number of posts : 149
Age : 54
Location : M'sia
Registration date : 2009-05-09

Back to top Go down

Explanation of LSB and MSB Empty Re: Explanation of LSB and MSB

Post by WongKN Wed Jun 22, 2011 10:31 pm

You don't get a prize since you clearly showed you have knowledge of I/T ! Laughing

I have tried to avoid the minute details of the actual CD format because I just want to explain the impact of a bit-flip in LSB and MSB. You are a lot nastier than me because you went and talk about 2s complements !! Laughing

Basically an error in a single word would have minute impact though I often think it is not necessarily for the duration of that single sample because of the potential propagation of the error into subsequent samples in the subsequent conversion stages. E.g. a momentary 'spike' in the signal (from a bit-flip in a very significant bit - one of the bits near the left hand side) may cause the analog signal take a bit of time (even if nanoseconds) to decay back to correct levels so it may introduce errors in the signal for subsequent words.

Jitter as you pointed out is worse because it may cause 'bit shift' in the extreme case. Imagine the whole 16 bit word being misread so that all the bits are shifted say one place to the right, meaning the LSB is lost and an extra 0 is placed in the place of the MSB... and this can happen over a few samples....

To complicate things further, the RBCD standard provides for a CRC type error detection and correction using the Reed Solomon method (a formula is used to compute a 'check word' and that formula allows a detection of which bit is corrupted and potentially the correction of that corruption, to a certain extent). The correction algorithm allows for a 'graceful degradation' meaning that on extreme corruption of data, it cannot reconstruct the original word but can still allow 'estimations' of the original word to a certain degree of accuracy, not just a wild guess.

But the whole idea is to illustrate that dealing with digital data is just not that simple as what some magazines and websites tries to make it out to be.

Actual corruption of data in basic consumer level computers (like our notebooks and PCs) is not necessarily that rare an occurrence as I myself have encountered corrupted transfer of data more than a few occasions in recent times. It can be as simple as a failure to install a software the first time and then on the retry, the install completes successfully without a glitch. A single bit corruption can cause this to happen.

Thanks for contributing to make this thread a lot more interesting (and confusing) !! lol!
WongKN
WongKN
Moderator
Moderator

Number of posts : 1795
Age : 62
Location : Malaysia
Registration date : 2009-01-20

Character sheet
Source(s):
Amplification:
Speakers:

Back to top Go down

Explanation of LSB and MSB Empty Re: Explanation of LSB and MSB

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum