Digital Electronics Introduction to Binary Numbers
We can write the number 752 as 2x10 0 + 5x10 1 + 7x10 2 Similarly, we could use the base 2 instead of 10, e.g. 3 = 1x2 0 + 1x2 1, which we represent as 11. Hence the binary 01 is our old friend 2. Keep in mind that the numbers written are the coefficients of 10 0, 10 1, etc. 11 and 01 are called 2-binary digit (bit) numbers.
Note the possible combinations of 2 bits: 00 = 0 01 = 2 10 = 1 11 = 3, 4 possible combinations = 2 n where n= # of bits
Some examples of 4-bit binary numbers 0000 0100 0010 0011 The 2 nd of these binary numbers, for example, corresponds to the number 0x2 0 + 1x2 1 + 0x2 2 + 0x2 3 = 2 Note that there are 2 4 = 16 possible combinations for a 4-bit binary number.
Note also that we have chosen the sequence as the coefficient of 2 0 first, then 2 1, then 2 2, etc. This convention is used by many electrical engineers, but it is arbitrary (e.g. Wikipedia uses the opposite convention).
35 Digital Audio - What is it? Really a method to capture and transform audio signals for the purpose of storage, transmission, manipulation, and playback Digital Approximation of the real event and sound waves Requires A/D and D/A Converters – Devices used to change analog to digital and back again. – These are generally found on computer sound cards A/D converters perform sampling of waveforms D/A converters convert digital data back into a waveform Employ various forms of encoding and decoding the bit stream using CODECS (Compressor/De-compressors)
Suppose we wish to represent a complex wave form digitally. We will now introduce the concept of sampling the wave form. The idea is to measure the amplitude at various times during the cycle and represent those amplitudes digitally.
Analog to Digital Recording Chain ADC Continuously varying electrical energy is an analog of the sound pressure wave. Microphone converts acoustic to electrical energy. It’s a transducer. ADC (Analog to Digital Converter) converts analog to digital electrical signal. Digital signal transmits binary numbers. DAC (Digital to Analog Converter) converts digital signal in computer to analog for your headphones.
Analog versus Digital Analog Continuous signal that mimics shape of acoustic sound pressure wave Digital Stream of discrete numbers that represent instantaneous amplitudes of analog signal, measured at equally spaced points in time.
[a.k.a. “sample word length,” “bit depth”] Precision of numbers used for measurement: the more bits, the higher the resolution. Example: 16 bit Analog to Digital Overview Sampling Rate How often analog signal is measured Sampling Resolution [samples per second, Hz] Example: 44,100 Hz
Common Sampling Rates Sampling RateUses 44.1 kHz (44100)CD, DAT 48 kHz (48000)DAT, DV, DVD-Video 96 kHz (96000)DVD-Audio 22.05 kHz (22050)Old samplers Most software can handle all these rates. Which rates can represent the range of frequencies audible by (fresh) ears?
Common Sampling Resolutions Word lengthUses 8-bit integerLow-res web audio 16-bit integerCD, DAT, DV, sound files 24-bit integerDVD-Video, DVD-Audio 32-bit floating point Software (usually only for internal representation)
3-bit Quantization A 3-bit binary (base 2) number has 2 3 = 8 values. 0 1 2 3 4 5 6 7 A rough approximation Amplitude Time — measure amp. at each tick of sample clock
4-bit Quantization A 4-bit binary number has 2 4 = 16 values. 0 2 4 6 8 10 12 14 Amplitude A better approximation Time — measure amp. at each tick of sample clock
51 The Nyquist Theorem This theorem holds that in order to preserve a reasonable representation of a waveform it must be sampled at least twice at its highest frequency Since the limits of human hearing are around 22khz (22,000 cycles per second), the sampling for CDs was established at 44.1 khz….
A “sampler” which we describe might have 16 bits, in which case the number of possible combinations is 2 16 = 65,536 This enables us to represent 65,536 sample amplitudes (in actuality, half of these are used for the positive amplitudes, the other half for the negative ones).
16-bit Sample Word Length A 16-bit integer can represent 2 16, or 65,536, values (amplitude points). We typically use signed 16-bit integers, and center the 65,536 values around 0. 32,767 -32,768 0
A digital computer represents data using the binary numeral system. Text, numbers, pictures, audio, and nearly any other form of information can be converted into a string of bits, or binary digits, each of which has a value of 1 or 0. The most common unit of storage is the byte, equal to 8 bits. A piece of information can be handled by any computer whose storage space is large enough to accommodate the binary representation of the piece of information, or simply data. For example, using eight million bits, or about one megabyte, a typical computer could store a short novel.digital computerdatabinary numeral systembitsbytedatamegabyte
We now calculate the bit rate and file size for 16 bit “resolution”.
Calculating Bit-rates (CD quality) Sampling Rate xResolutionx # of Channels =Bit-rate 44,100x16x2=1,411,200 Calculating File Sizes (one minute of CD audio) Sampling Rate xResolutionx Number of Channels x Time in Seconds / Bits / Byte = File Size (in Bytes) 44,100x16x2x60/8=10,584,000 MP3 compression at 128 kbps compresses this by a factor of 11
For the ultimate in high-fidelity, you might want to sample five 20-bit channels at 44,100 Hz. What is the bit rate? a)4.4 kbps b)44 kbps c)440 kbps d) 4.4 Mbps In this case, how big of a file is 40 minutes of uncompressed audio? a)13 Gbytes b)1.3 Gbytes c)130 Mbytes d)13 Mbytes
Audio File Size CD characteristics… - Sampling rate: 44,100 samples per second (44.1 kHz) How big is a 5-minute CD-quality sound file? - Sample word length: 16 bits (i.e., 2 bytes) per sample - Number of channels: 2 (stereo)
DAC: Sample and Hold To reconstruct analog signal, hold each sample value for one clock tick; convert it to steady voltage. 0 1 2 3 4 5 6 7 Amplitude Time
DAC: Smoothing Filter Apply an analog low-pass filter to the output of the sample-and- hold unit: averages “stair steps” into a smooth curve. 0 1 2 3 4 5 6 7 Amplitude Time
61 CD’s and your Computer CD standard is 16 bits at 44.1 KHz. Using CD Ripper software, you can take digital data from the CD which is in.cda format and convert it to.wav or MP3 format all in the digital domain Not dependent upon the sound card capabilities The sound file contains all the music but the vast number of samples makes such files big Approx: 10 Mbytes per stereo minute
62 Digital Compression Concepts Compression techniques are used to replace a file with another that is smaller Decompression techniques expands the compressed file to recover the original data -- either exactly or in facsimile A pair of compression/decompression techniques that work together is called a codec for short
63 What is MP3? (Motion Pictures Experts Group Layer 3) MP3 is a compression system developed specifically for music. It had its birth as a result of the desire to send music over the internet It reduces the amount of data on a CD without “hurting” the sound of the music too much It actually achieves a data reduction of about 90%! It achieves this dramatic reduction by eliminating things that our ears don’t hear very well – soft sounds that are masked by louder sounds – frequencies that are outside of our hearing range – frequencies that we don’t hear well – advanced compression techniques
64 MP3 Takes Advantage of the theory that There are certain sounds that the human ear cannot hear. There are certain sounds that the human ear hears much better than others. If there are two sounds playing simultaneously, we hear the louder one but often cannot hear the softer one
If we want compression without loss, we use systems like ZIP. This is very effective compression data files that hold plenty of redundant information. This could be Microsoft Word documents, they often zip very well. And when you unzip them, the document is identical to the original. You find similar compression within GIF and PNG graphics files, which compress many graphic images very well (but not photos). However you do not find much redundant information in music files. A zip compression of raw music data (WAV files) may only yield 10% reduction in file size. Therefore we use a lossy encoding to reduce the music files sizes. Lossy encoding mean that we take away music information (just as JPEG encoding take away image information from a photo). The goal is to remove music details you would not hear anyway!
The most important principle in MP3 compression is the psychoacustic selection of sound signals to cut away. Those signals, we are unable to hear are removed. These include weaker sounds that are present but are not heard because they are drowned out (masked) by louder instruments/sounds. Many encoders use the fact that the human ear is most sensitive to midrange sound frequencies (1 to 4 KHz). Hence sound data within this range is left unchanged. Another compression used is to reduce the stereo signal into mono, when the sound waves are so deep, that the human ear cannot register the direction. Also the contents of common information in the two stereo channels is compressed. The Huffman algorithm reduces the file size by optimizing the data code for the most often used signals. This is a lossless compression working within the MP3 system.
69 MP3 Files continued MP3 files are an average of 3-5 megabytes vs. CD files of 30 megabytes for the same song Easy to transmit over the internet Easy to store on portable devices They are an approximation of the original CD which in turn is a reasonable approximation of the real sound
70 Format Comparison CD Standard = 16 Bits at 44.1Khz Professional Digital Recording Standards – 16 or 24 Bits at 44.1Khz, 48Khz, 96Khz Wav – Probably the most common format and used by windows programs to capture CD music to a hard drive. Real representation or “Pits to Bits” but files are large MP3 – About 1/10 the size, 1meg/stereo minute compared to 10meg for the original and called near CD quality WMA – New windows format that boasts higher quality than MP3 with similar sample rates or same quality with lower sample rate and smaller file sizes MP4 – A new standard that allows for synchronized video and audio and can compete with WMA. It is non-proprietary MIDI- is not a digital audio file format per se but a language for creating electronic sounds using devices that understand that language
71 MIDI Instruments and Devices (Musical Instrument Digital Interface) MIDI is a standard interface between electronic musical instruments and synthesizers Devices which are MIDI-compatible can communicate with each other Advantages to MIDI – files are encoded and are much smaller than digitized sound files – files can be easily edited and mixed for multiple tracks
72 Summary Digital sound is produced by sampling sound waves over time A digital sound file consists of sampled amplitudes at a number of discrete times within a given time interval The number of samples per second is called the sample rate The number of bits devoted to storing individual sampled amplitudes is called the resolution of the digitized sound: 8- bit, 16-bit and higher resolutions are used depending on the kind of sound being digitized Fidelity will be largely determined by the sample rate and resolution
Analog/Digital Conversions 1.Microphone converts sound into an electrical signal 2.Anti-Alias “Brick Wall” filter removes very high frequencies from signal. 3.ADC periodically measures (samples) the amplitude of the analog signal, sending a stream of numbers to CPU. 4.DAC converts a stream of numbers into a stepped analog signal. 5.Smoothing filter removes staircase shape from signal. A Basic Digital Audio Setup Acoustical to Electrical to Digital (numerical) and back
A CD is a fairly simple piece of plastic, about four one- hundredths (4/100) of an inch (1.2 mm) thick. Most of a CD consists of an injection-molded piece of clear polycarbonate plastic. During manufacturing, this plastic is impressed with microscopic bumps arranged as a single, continuous, extremely long spiral track of data. We'll return to the bumps in a moment. Once the clear piece of polycarbonate is formed, a thin, reflective aluminum layer is sputtered onto the disc, covering the bumps. Then a thin acrylic layer is sprayed over the aluminum to protect it. The label is then printed onto the acrylic. A cross section of a complete CD (not to scale) looks like this: Cross-section of a CD
The elongated bumps that make up the track are each 0.5 microns wide, a minimum of 0.83 microns, they look something like this:
You will often read about "pits" on a CD instead of bumps. They appear as pits on the aluminum side, but on the side the laser reads from, they are bumps. The incredibly small dimensions of the bumps make the spiral track on a CD extremely long. If you could lift the data track off a CD and stretch it out into a straight line, it would be 0.5 microns wide and almost 3.5 miles (5 km) long! To read something this small you need an incredibly precise disc-reading mechanism. Let's take a look at that. CD Player Components The CD player has the job of finding and reading the data stored as bumps on the CD. Considering how small the bumps are, the CD player is an exceptionally precise piece of equipment. The drive consists of three fundamental components: A drive motor spins the disc. This drive motor is precisely controlled to rotate between 200 and 500 rpm depending on which track is being read. A laser and a lens system focus in on and read the bumps. A tracking mechanism moves the laser assembly so that the laser's beam can follow the spiral track. The tracking system has to be able to move the laser at micron resolutions.laser
What the CD Player Does: Laser Focus Inside the CD player, there is a good bit of computer technology involved in forming the data into understandable data blocks and sending them either to the DAC (in the case of an audio CD) or to the computer (in the case of a CD- ROM drive). The fundamental job of the CD player is to focus the laser on the track of bumps. The laser beam passes through the polycarbonate layer, reflects off the aluminum layer and hits an opto-electronic device that detects changes in light. The bumps reflect light differently than the "lands" (the rest of the aluminum layer), and the opto-electronic sensor detects that change in reflectivity. The electronics in the drive interpret the changes in reflectivity in order to read the bits that make up the bytes.CD- ROM drive lightbitsbytes
A CD has a single spiral track of data, circling from the inside of the disc to the outside. The fact that the spiral track starts at the center means that the CD can be smaller than 4.8 inches (12 cm) if desired, and in fact there are now plastic baseball cards and business cards that you can put in a CD player. CD business cards hold about 2 MB of data before the size and shape of the card cuts off the spiral. What the picture on the right does not even begin to impress upon you is how incredibly small the data track is -- it is approximately 0.5 microns wide, with 1.6 microns separating one track from the next. (A micron is a millionth of a meter.) And the bumps are even more miniscule...
What the CD Player Does: Tracking The hardest part is keeping the laser beam centered on the data track. This centering is the job of the tracking system. The tracking system, as it plays the CD, has to continually move the laser outward. As the laser moves outward from the center of the disc, the bumps move past the laser faster -- this happens because the linear, or tangential, speed of the bumps is equal to the radius times the speed at which the disc is revolving (rpm). Therefore, as the laser moves outward, the spindle motor must slow the speed of the CD. That way, the bumps travel past the laser at a constant speed, and the data comes off the disc at a constant rate.