Digital Communication , Synchronous vs ASynchronous.

In this series of posts we will see how a digital file is converted to music. We will see also see what parameters affect the quality of music we listen to.

Digital Communication

There are two broad ways in which digital systems communicate (in this context).

Parallel
In parallel communication each bit of the number being sent has a separate physical wire between the sender and receiver and a seperate line that tells the receiver when to pickup the data (Clock). In this system the sender sets the all bits (say 8) of the data to send and tells the receiver to pick it all up in one go. so for each clock pulse 8 bits are transferred. This is how old Printers with Parallel port used to work. In these systems there are as many data lines as there are bits Widths to send.  For example PC Parallel ports have 8 Data Lines.

https://en.wikipedia.org/wiki/Parallel_port

https://upload.wikimedia.org/wikipedia/commons/thumb/a/a6/Parallel_and_Serial_Transmission.gif/300px-Parallel_and_Serial_Transmission.gif

Serial
 Most of the systems these days have switched to a serial way of sending data where there is only one data line and the data is sent one bit at a time. There are two types of serial communication, Synchronous and Asynchronous.

 

ASynchronous Serial Communication.

https://eeherald.s3.amazonaws.com/uploads/ckeditor/pictures/oldarticleimages/synchronous_transmission1.jpg (c)


In ASynchronous communication both the send and receiver decide on the speed of communication and send and receive the data. This speed is called bits per second or baud. All PC Serial ports work this way. A start and stop bit allows the receiver to figure out when the bit starts and bit ends.
https://en.wikipedia.org/wiki/Serial_port

Baud rates are from 300 bits per second to 460,800 bits per second. The problem here is that there is no synchronization between the sender and receiver except for agreed upon speed. So if the sender or receiver are expecting the data at a wrong speed they will get only garbled corrupted data. This is what happens when one PC is sending data at 9600 baud and another PC is expecting at 115200 baud.

Two things are required for this type of communication to work, both the sender and receiver should agree on the speed and should have clocks which are accurate.

There is only one data line for unidirectional communication and two data lines for full duplex bidirectional communication.

One more way the receiver can work is by rebuilding a clock from the data using PLLs (Phase locked loops) and use this to time the data.

SPDIF is a synchronous protocol where the receivers reconstruct the clock using PLLs.

Synchronous Communication

https://eeherald.s3.amazonaws.com/uploads/ckeditor/pictures/oldarticleimages/synchronous_transmission.jpg

Synchronous Communication is similar to parallel communication where a separate clock line tells the receiver when to pick up the bit (instead of the byte) so now the senders and receivers don’t have to agree on anything . They can have not so accurate clocks and still the data will reach the receiver pretty reliably.

There is one data line and one clock line for communication. The clock tells the receiver when to pickup the data from the dataline.

As we can see Synchronous Communication is better as the sender and receivers do not have to agree on anything prior to communication and changes in speed will not affect the data integrity.

References:
http://www.eeherald.com/section/design-guide/esmod7.html

How Does the music get from a Digital File to the Speakers ?

In this series of posts we will see how a digital file is converted to music. We will see also see what parameters affect the quality of music we listen to.

First this would be the process.

MP3, FLAC or WAV file is parsed (decompressed if needed) by a computer (or a streamer ) and converted in to a PCM Stream (We will see how DSD works later). PCM stands for pulse coded modulation. In PCM a number that represents amplitude (loudness) of sound at a particular instant is sent few thousand times a second (for CD it is 44,100 times a second). This is called the sample rate.  So when we say 16 bit 44.1 Khz PCM stream , it means that the stream has 44,100 numbers for each second of music . The numbers range from 0 – 65,536 or (−32,768 to 32,767)  which is 2^16.

So a loud region will have numbers close to 40,000-60,000 and silent portions will have numbers less than 3000.

The digital signal is a square wave where Bit 1 is represented by 5v and Bit 0 any voltave <~2.5 , 8 such pulses(bits) from one byte of data.


https://i.stack.imgur.com/rTpKu.png

These numbers are fed into a DAC (digital to analog converter), which converts these numbers in to voltage levels ranging from 0-2v (assuming 2v Peak to Peak output) . This analog signal is fed into an amplifier which in turn drives the speakers.

For more details you can read
http://manual.audacityteam.org/man/digital_audio.html
http://scharl.at/soundbearbeitung/Audacity/tutorial_basics_1.html
https://en.wikipedia.org/wiki/Pulse-code_modulation

So this system depends on getting those numbers into the DAC in a timely fashion without corruption.

We can assume that Digital Hi Resolution file we get has the correct data since it is not under our control anyway, our objective in our system  is to get this data as perfectly as possible to the DAC.

In our system let assume that we have a Streamer (PC or Dedicated Transport Device) which will give the raw decompressed digital data. The data might be sent over USB , SPDIF over Optical or COAX , I2s , HDMI etc based on the device.

you would connect a USB DAC or USB to spdif converter to the Transport to get the data out. Here the type USB receiver is very important.

For more details you can read
http://manual.audacityteam.org/man/digital_audio.html
http://scharl.at/soundbearbeitung/Audacity/tutorial_basics_1.html
https://en.wikipedia.org/wiki/Pulse-code_modulation