Analog and Digital - Analog
The words analog and digital are used a lot, but what do they mean? Here we'll look at those two worlds which you use every day.
- We are surrounded by signals
- What does that mean?
- A signal is a varying wave over time
- e.g. sound as a running example here
A signal is a varying wave, typically carrying information we care about. Sound is a great example of a signal, and we'll use that as a running example today.
How Does Sound Work?
- Sound is vibrations, small waves of pressure in the air
- e.g. violin:
1. Strings vibrate under the bow, pulling on their ends, a signal
2. the wooden violin top flexes in and out (same signal)
3. The wood flex creates pressure waves in the air (same signal)
4. The waves travel through the air, ultimately pushing on the eardrum, recreating the signal
- The violin sequence is an example of an analog process
-Have a continuously varying signal
-Transfers from one medium to the next
-Keeping its basic shape
- Great moments in etymology:
-analogy is a related word
- Many old technologies are analog (pre-computer)
- Why is digital better?
Sound is vibrations in the air over time -- essentially small changes in air pressure over time. When a violin plays, the wood top and back of the instrument flex in and out, producing little ripples of air pressure which flow out from the violin, like ripples in a pond. When the ripples hit an ear drum, it vibrates back and forth with the pressure changes, translating them into something your brain can sense. Your brain can easily distinguish the sound of a violin or voice or pipe organ playing the same note, but it is hard to put the differences into words. This is a very analog sequence -- the signal goes from one medium to the next, keeping its basic shape.
An oscilloscope really embodies the idea of analog. An oscilloscope connects to wires, looks at the electrical signal varying over time, and draws that signal on its screen in real time. Voltage is on the vertical axis, and time is the horizontal axis. So the oscilloscope takes in something pretty abstract -- signal varying over time -- and makes it visual.
Sound Demo -- Synthesizer and Oscilloscope
For this demo, I have a music synthesizer hooked up to speakers, and also hooked up to an oscilloscope so we can see the signal at the same time that we hear it. Demo: musical synthesizer, oscilloscope, notes, frequency, amplitude, timbre.
- Screen is 1/100 of a sec across
- Signal is drawn over itself
- See: frequency, amplitude, timbre
Frequency, Amplitude, Timbre
- Sound often as a repeated up/down pattern
- If waves are a consistent width peak to peak, e.g. 1/400th of a second, we hear a "note"
- Amplitude -- how high/low the wave goes, higher amplitude = louder
- Frequency is how often the wave repeats per second
"higher" note = more cycles per second
--Middle "A" on the piano -- 440 cycles
--Higher "A" note, one octave up -- 880 cycles (exactly 2x)
--Even higher "A", another octave up, 1760 cycles (2x again)
- All these "A" notes sound alike, but octaves apart
- An eerie relationship in our brains between music and math
- Timbre -- the shape of the wave sounds different
--Sine wave pure tone, vs. flute playing the same note
Below are oscilloscope screenshots for various notes. The width of the oscilloscope screen here is 1/100th of a second. The little random jags are just random noise from the cheesy, duct-tape way I wired this all together. The horizontal green line in the screenshots is an unimportant artifact of the oscilloscope. It represents a height value for which the oscilloscope tries to freeze the wave, hitting the y axis right at that value.
Low C note, sine wave:
C note, one octave higher (double the cycles per second):
Same C note as above, but now a flute timbre (shape) instead of sine wave:
Very often the sound -- or "signal" -- has a repetitive up/down pattern, with the peaks of the curves hitting at a regular interval, such as every 400th of a second. We hear a regular, repeating cycle like this as a musical "note". If the repeating pattern is a mathematically smooth sine wave, we hear it as a very pure, bell-like sound.
Frequency -- suppose a signal repeats 100 times per second, also known as 100 "cycles" per second, that's a frequency of 100. If the signal repeats more rapidly, we hear that as a "higher" note. An "octave" in music corresponds exactly to a doubling in frequency (i.e. twice as many up/down cycles in the same amount of time). The musical tuning standard is that A above middle C on a piano keyboard is 440 cycles per second. Going up to the next higher A note (about one hand's width on the piano) is 880 cycles per second (double the frequency). These two "A" notes sound similar to us, but one is higher. And of course there's next higher A at 1760 cycles, and higher still .. each time doubling the frequency.
Amplitude is the word for the height and depth that the signal makes on each cycle, corresponding to loudness. Big vertical swings are loud, small vertical swings are quiet. Or phrased as air pressure, bigger changes in air pressure sound louder. The timbre of the sound is the fine pattern of shapes and wiggles that can seen on the signal. So a flute "A" note has a timbre, varying a little around the basic 440 cycle pattern, and a trumpet playing that same note has a different timbre on the basic 440 cycle pattern.
There's Just One Air - Sum
There is just one body of air that fills a room. All of our ears are in it. A sound (vibrations) in this body of air, travels out to all our ears almost instantaneously at about 1000 feet/second. So what happens when multiple sounds are going into the air at once? The sound signals add, making a "sum" signal. The sum signal goes to your ears, and somehow your ear and brain are able to pull out and hear the component sounds.
Here again is the low-C note:
Here is a high-C note, 3 octaves above the low-C. You can see that the frequency is much higher .. many more cycles per second.
What Goes In Your Ear - Sum
What happens to the air if the low-C and high-C sounds are playing at the same time? The two signals add together in the air.
Here is the combination of low-c and high-c playing simultaneously. You can see how the high note is added on top of the more slow changing low note. Your ear takes in this signal, and pulls it apart so you hear both the low note and the high note. It's impressive that the ear can take in this jumbled signal, and pull out and hear the constituents.
As another example, here is low-C and the C note one octave higher:
What does the sum of the above two look like? To convince yourself of the sum behavior, you can draw the two signals on graph paper, manually measure the heights and do the addition, to verify that the sum indeed looks like this:
This "sum" idea is how noise-cancelling headphones work -- detecting the ambient sound and creating an exactly opposite sound (multiplying by -1) to feed into your ear, so they cancel out leaving silence.
When Chords Sound Good - Harmony - Discord - Math!
- A chord is 2 or more notes playing at once
- Chords sound good when the peaks/valleys match up regularly - harmony
- e.g. a a note played with the note at 2x the frequency (i.e. up one octave)
-a ratio of 1:2
-Every other wave, the peaks will match up
- A perfect-5th chord, the waves are in the ratio 3:2, so every 3rd peak will match
- When ratios are slightly off, the chord sounds terrible - discord
-e.g. 3:1.9 instead of 3:2
-e.g. 3:1.9 the peaks almost never match up
- Neat: when the math is "even" the chord sounds good
- There is a theory that music connects to our brains more deeply than words
- Like if an alien visited the earth:
We explain discord makes us uncomfortable but harmony we like
Alien would conclude a deep relationship between sound and our brains
Signal Sum Discord Demo
- Try making chord/discord combinations
- We see the "sum" wave of both notes added together
- 1:2 3:2 chords sound good ("harmony")
- But 3:1.9 sounds bad
- Peaks not matching up!
- Somehow this is in our DNA
Analog is the pre-digital way of transmitting or storing a signal. Examples:
Analog: Original Phone System
The first telephone was very analog, and in fact the wired phone in your house still works this way (an example of network effect inertia). Follow the trail of the sound signal.
- Person talks into microphone
- Microphone converts sound waves into electrical waves
- Electrical waves go down the wire to the other phone
- At the other phone, speaker has magnets connected to a paper cone -- converts the incoming electrical wave back into sound waves
- Desired signal keeps its shape, moves across mediums
- A person talks into the phone receiver. Their voice is vibrations in the air -- a signal.
- The phone receiver contains a microphone where the vibrations in the air move a tiny coil of wire. The movement of the wires sets up tiny electrical flow that is in one-to-one correspondence with the air vibrations. Essentially we translate a signal in the air, to an analogous signal of electricity in wires.
- The electrical signal travels out of the house to the phone company, gets amplified etc. and is eventually delivered to the phone at the other end,.
- There the electricity goes into a speaker -- a speaker is just an arrangement of wires and magnets to translate electrical variations back to sound (the reverse of the microphone).
- The key feature of analog signaling is 1-1 correspondence .. variations (a signal) in one medium such as sound in the air, are translated to variations in some other domain like electricity in wires. The signals in the different domains are in 1-1 correspondence -- one goes up, the other goes up.
Analog - LP Records
- Analog LP record
- Sound wave is recorded as hills and valleys in the plastic groove
- Playback needle rides in the groove, jiggles up and down, makes a little electrical signal
The old LP record format is totally analog. The sound signal is recorded as little hills and valleys in the plastic groove that runs around the record. For playback, a needle sits in the groove, the record spins, and the hills and valleys make tiny up and down movements of the needle. The needle is hooked up, in essence, to a microphone-like device which translates the up-down movement of the needle to an electrical signal, which eventually is sent to the speakers to translate the signal back into sound.
Analog: AM and FM Radio
Examples of analog technology you may still use. FM is more noise-resistant, but still analog.
Analog and Noise -- Hiss
- Signal does not go through microphones, wires, magnets, etc. perfectly
- Each step -- the wires, the magnets, etc. can introduce little errors
- "Noise" ... like little random wiggles around the true signal (+ there are other error forms)
- Noise can sound like "hiss" .. e.g. AM radio, cassette tapes
Pure signal, e.g. put into one end of the phone
Signal + noise as it comes out of the other end of the phone
What do "errors" look like in an analog system? The signal you care about is translated from sound to electricity and so on. With each translation step, little errors creep in. The microphone has a little stiffness, the wires don't carry the signal perfectly, and so on. The errors are called "noise" -- you can imagine the pure sound signal you wanted but it's been distorted by little up/down errors -- like fuzzy variations around the true signal.
This is the "hiss" you hear on the phone line or an AM radio or a cassette tape .. all analog technologies. Why do digital translations of music sound so much better?