L 19 Electronic Sound

L 19
Electronic SoundAnalog and Digital
Electronics in Music
1.Intro
2.Basic Analog
Electronics
3.Digital Audio
Edison Phonograph - 1879
Cylindrical Phonogram
(Thomas Edison 1877 )
(Youtube video)
Acoustic Recording Session ca. 1920
Voltage (Potential Drop)
The potential energy an electron
has divided by its charge
Ohm’s Law
The current (charge per unit time)
flowing through a circuit element is
equal to the potential drop across
this element divided by the
resistance of the element.
I= V/R
I
V
R
Suppose the current is 3 A and the
voltage is 6 V. What it the
resistance?
a) 3 W
b) 2 W
c) 1/2 W
d) 1/3 W
Power Amplifier Driving Loudspeaker
I
Z= 8 W
V
Signal
Source
Amplifier
Speaker
Capturing Sound Waves
25
Dynamic Microphone or Moving Coil Loudspeaker
Moving Coil
Loudspeaker
Demo:
Eddy Current
Digital Electronics
Introduction to Binary
Numbers
We can write the number 752 as
2x100 + 5x101 + 7x102
Similarly,
we could use the base 2 instead of 10,
e.g.
3 = 1x20 + 1x21, which we represent as
11.
Hence the binary
01 is our old friend 2.
11 and 01 are 2-binary digit (bit)
numbers.
Note the possible combinations of 2
bits:
00 = 0
01 = 2
10 = 1
11 = 3,
4 possible combinations = 2n
where n= # of bits
More examples of 4-bit binary numbers
0000
0100
0010
0011
The 2nd of these binary numbers, for
example, corresponds to the number
0x20 + 1x21 + 0x22 + 0x23 = 2
Note that there are 24 = 16 possible
combinations for a 4-bit binary number.
Note also that we have chosen the
sequence as the coefficient of 20
first, then 21, then 22 , etc.
This convention is used by
electrical engineers, but it is
arbitrary.
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)
34
Digital Sampling
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
Microphone converts acoustic to electrical
energy. It’s a transducer.
Continuously varying electrical energy is an analog
of the sound pressure wave.
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.
Analog to Digital Overview
Sampling Rate
How often analog signal is measured
[samples per second, Hz]
Example: 44,100 Hz
Sampling Resolution
*a.k.a. “sample word length,” “bit depth”+
Precision of numbers used for measurement: the
more bits, the higher the resolution.
Example: 16 bit
Common Sampling Rates
Which rates can represent the range of frequencies audible by
(fresh) ears?
Sampling Rate
Uses
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.
Common Sampling Resolutions
Word length
Uses
8-bit integer
Low-res web audio
16-bit integer
CD, DAT, DV, sound files
24-bit integer
DVD-Video, DVD-Audio
32-bit floating point Software (usually only for
internal representation)
3-bit Quantization
A 3-bit binary (base 2) number has 23 = 8 values.
7
6
Amplitude
5
4
3
2
1
0
Time — measure amp. at each tick of sample clock
A rough approximation
4-bit Quantization
A 4-bit binary number has 24 = 16 values.
14
12
Amplitude
10
8
6
4
2
0
Time — measure amp. at each tick of sample clock
A better approximation
Low Quality Sampling (low-res)
46
Low Quality Results
47
Higher Quality
48
Even higher quality
49
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….
50
A “sampler” which we describe might
have 16 bits, in which case the number
of possible combinations is
216 = 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 216, or 65,536,
values (amplitude points).
We typically use signed 16-bit integers, and center
the 65,536 values around 0.
32,767
0
-32,768
We now calculate the bit rate and
file size for 16 bit “resolution”.
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.
Calculating Bit-rates (CD quality)
Sampling
Rate
x
Resolution
x
# of
Channels
=
Bit-rate
44,100
x
16
x
2
=
1,411,200
Calculating File Sizes (one minute of CD audio)
Sampling
Rate
44,100
x Resolution x
x
16
x
Number of
Channels
x
Time in
Seconds
/
Bits
/
Byte
2
x
60
/
8
MP3 compression at 128 kbps compresses this by a factor of 11
=
File Size
(in Bytes)
=
10,584,000
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)
- Sample word length:
16 bits (i.e., 2 bytes) per sample
- Number of channels:
2 (stereo)
How big is a 5-minute CD-quality sound file?
DAC: Sample and Hold
To reconstruct analog signal, hold each sample value for one clock
tick; convert it to steady voltage.
7
6
Amplitude
5
4
3
2
1
0
Time
DAC: Smoothing Filter
Apply an analog low-pass filter to the output of the sample-andhold unit: averages “stair steps” into a smooth curve.
7
6
Amplitude
5
4
3
2
1
0
Time
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
60
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
61
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
62
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
63
MP 3 Compression
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.
MP3 is a Lossy Compression System
67
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
68
Format Comparison
•
CD Standard = 16 Bits at 44.1Khz
•
Professional Digital Recording Standards
•
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
– 16 or 24 Bits at 44.1Khz, 48Khz, 96Khz
69
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
70
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: 8bit, 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
71
Analog/Digital Conversions
A Basic Digital Audio Setup
1.
2.
3.
Acoustical to Electrical to Digital
(numerical) and back
4.
5.
Microphone converts sound
into an electrical signal
Anti-Alias “Brick Wall” filter
removes very high
frequencies from signal.
ADC periodically measures
(samples) the amplitude of
the analog signal, sending a
stream of numbers to CPU.
DAC converts a stream of
numbers into a stepped
analog signal.
Smoothing filter removes
staircase shape from signal.
Compact Discs
(CD’s)
A CD is a fairly simple piece of plastic, about four onehundredths (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.
How Does a CD Work?
More on CDs
750 Mbytes
Link: “how Edison got his groove back”
75 minutes of audio
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 CDROM 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.
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.