|
Digital Signal Processing (DSP) covers a whole host of topics. As radio operators bandpass and notch filters come to mind, but the tools of DSP can be used in medicine, economics and even in the creation of karaoke material. Let's look at a couple of simple examples:
The five audio files below all repeat the first line of Lincoln's Gettysburg address. The last four were derived from the original using various techniques:
|
Original:
Speed doubled by DSP compression: Speed doubled by simple squeeze: Speed halved by DSP expansion: Speed halved by simple stretch: |
Thirty years ago we could only change the speed of a recording by squeezing or stretching
it. We all did this by playing a 45 record at 33 or 78, or by playing a tape faster
or slower than the normal speed. Those mechanisms increase (or decrease) the frequency
of each sound component and distort the signal. That is how Alvin and the Chipmunks
created their unique sound and became famous. This clip from
"Good Morning, Vietnam" gives an entertaining example. With the advent of DSP tools we can transform the speed but make the signal sound almost the same. Not so good for Alvin, but imagine being able to slow down a native Spanish speaker so a language learner could have a better chance at understanding. If we used the stretch method it would make the Spanish harder to understand rather than easier. |
| The video shows another example of audio processing. It uses a DSP technique to map the dominant frequency in the music (between about 300 hz to 4 khz) to a corresponding place in the spectrum of light (between red at 430 Thz to violet at 770 Thz). It also maps volume to brightness. This is all done in a little Arduino type computer controlling a string of RGB LEDs. |
The methods for creating these effects depend on the major ideas of digital signal processing. The path to understanding these ideas is a fascinating journey of discovery covering four centuries and involving many master detectives. We won't be able to show all the steps and all the important people, but if you read this article you should gain an idea of how they discovered the important conclusions. There are many books dedicated to showing how to make use of the wonderful methods that have been developed.
| In order to motivate this discussion, we'll use an easy to understand problem that doesn't actually require DSP to solve, but where DSP can provide an effective solution. Imagine a voice waveform something like: |
|
We'd like to be able to transmit this waveform from San Francisco to Boston. Back in 1849 they were able to send word of the discovery of gold by writing it on a piece of paper, then spending several weeks transporting the paper to Boston, where the sound could be reproduced by someone reading from the paper. In today's world we could convert the voice to an electrical signal and transmit that through the telephone system and then convert it back to sound at the other end. That process would distort the signal a bit as it went through several transitions of medium and various amplifiers. The use of the analog signal allows for the introduction of noise and other distortions along the transmission path. |
| If we simplify the problem a bit we can find an easy solution that avoids any distortion. As a byproduct we are able to reduce the utilization of the transmission line (more information in less time). Consider a very simple sound, say a single tone of 440 hz, or A below middle C on your piano. Say we wanted to transmit 30 minutes of this tone. We could do as described above in the voice example and fully utilize the transmission line for 30 minutes. Alternatively, we could just transmit the information: sine wave, 440hz, 30 minutes. The receiver in Boston would understand and be able to reproduce (perfectly) the original tone. There would be a little delay at the start, but otherwise this method produces an excellent result and only requires the transmission line for a short time. |
|
This is feasible because we can express the waveform as a simple, well known formula. The complex voice waveform doesn't have a simple formula, in fact there is no obvious reason to believe that there is any formula at all for the voice waveform. It takes a large leap of faith to think that we might be able to find a formula for the waveform.
It just so happens that about 400 years ago some mathematicians were working on that problem. They didn't know about radios or cell phones or digital anything, nor did they know much about electricity ... it was just an interesting problem. The work they did motivated work by others, and their work motivated others, and 400 years later we have some pretty good solutions to the general problem of finding a formula for that voice waveform. As a byproduct we get a whole bunch of other useful results.
| What formulas do we know? We learned a few in high school: |
|
Sadly, after those it gets hard to find many well known formulas (functions). We can make more complicated versions of the ones above by mixing them together in various ways. Obviously, the voice waveform doesn't look much like any of those (except in the simple case of a single tone). We might try to find close approximations of waveforms by adding together some of these well know formulas. It wasn't obvious to the folks 400 years ago that something like that would accomplish the result. They started with much smaller goals...
Around the year 1680 colonists were settling in Pennsylvania (as well as New Jersey and South Carolina) while in England and Germany two mathematicians were trying to understand how to approximate a curve with a straight line. You might call it the tangent line to the curve. They recognized that you could only get a good approximation for a very small portion of the curve, but the discoveries that Issac Newton and Gottfried Leibniz made grew into a branch of mathematics known as mathematical anaysis and that first step is known as differential calculus. What they found was a way to find the formula for the tangent line to a curve at any point on the curve. The formula is simple, but the approximation isn't very good for more than a very small portion of the curve. You could approximate the curve at many places and put the lines together to get a bizzaro approximation, but it's only a small step in the right direction.
Skip ahead a few years and the colonists were spreading out to Louisiana and Texas while in 1715 Brook Taylor (England) and Colin Maclaurin (Scotland) were extending the ideas of Newton and Leibniz to get a little bit better approximation of a curve by using polynomials. This still only did a good job very locally, but it sparked other ideas. What they showed was that if you keep adding higher powers of x with appropriate coefficients you can get better and better approximations to the curve for a little greater distance. The big idea here is that adding together more and more very simple formulas one produces the approximation of something much more complex. The calculations necessary to find the coeficients are somewhat difficult, especially when the curve is only expressed as a picture, but we're still 200 years away from solving that part of the problem.
Make a large jump in time to about 1810. At this point the United States was pretty well established and James Madison was president. A French mathematician by the name of Jean-Baptiste Joseph Fourier was trying to understand heat transfer in solids. He conjectured that a large group of waveforms could be approximated as closely as desired by adding together sine waves of various frequencies and amplitudes. He was eventually able to prove a theorem that verified his conjecture. The big news here is that the formulas used in the approximation are sine waves and the approximation is good for a wide range. It does, however, restrict itself to a certain class of curves that (usually) don't include our voice waveform.
The good news is that we can apply Fourier's results to our voice waveforms over a portion of the waveform. If we could learn how to calculate the amplitudes, frequencies and phase shifts for sine waves representing our voice waveform, and there weren't too many of them, we could send them from San Francisco to Boston and get our perfect representation of the voice waveform just the way we did with our pure sine wave!
That calculation didn't become interesting or feasible for many years. Our next section develops the trail that leads to such computations.
Around 1875, when U. S. Grant was president, the telegraph was the method of choice for rapid long distance communication with the pony express coming in a distant second. The telegraph sent an electrical pulse across a wire which was keyed on or off in Morse code. About that time Alexander Graham Bell began thinking about an "acoustic telegraph" which transmitted multiple tones over a wire rather than the single signal. This was the first step to sending a voice signal across a wire. The next step was to convert sound into an electrical signal which could then be transmitted over a wire. Bell was able to construct that (microphone) in 1876. Over the next ten years the telephone became a practical reality and we had a way to convert audio to electrical signals. The reason this is important to our discussion is that it's the first step in obtaining some sort of mathematical expression for the waveform.
In order to "look" at an electrical signal we take voltage measurements at each point in time. We can't actually take measurements at "each" point in time since there are infinitely many such points. We take many discrete measurements as an approximation. That raises the question: How many samples is enough? That problem has been investigated by many people, but the one who seems to get the credit for the first discoveries is Harry Nyquist in about 1928, and his work was solidified by Claude Shannon shortly after World War II.
Nyquist and Shannon were able to show that if we sample at a rate twice the highest frequency in the voice pattern we won't lose any essential information from the waveform. For our puproses, the range of frequencies in a voice is from about 300 hz to about 6 khz, maybe a little higher. So, we have to take about 12000 samples a second to get a reliable representation of the waveform.
In theory, we could take these samples with high precision, but the more precision, the more numbers we have to deal with. In order to work with this large amount of information we have to organize it. We could choose to measure the signals to say 2 decimal places, but since we are going to process it with a digital computer, choose resolutions that recognize the use. We generally choose to encode levels with a number of "bits" that are compatible with a computer memory. So, 8 bits would allow for 256 levels of resolution; or 16 bits would allow 32768 levels.
In the picture above, the green line shows the original signal while the yellow line shows the path of the signal represented by the quantized values. The actual values we'll use are represented by the black circles. This exercise gives us a way of translating our voice waveform into a picture within a computer. The next step is to describe the progress of how those measurements are made.
Digital computers made significant advances during World War II and about 1950 a physicist in England, D. H. Wilkinson made a device to convert analog to digital signals to assist in his physics experiments. This allows us to easily get the analog signal into a computer so we can begin to process it. This advance motivated the study of analog to digital converters (ADCs). Initially these were quite slow and used for things like industrial automation, but as computers got faster and smaller it became practical to create representations of audio and later radio frequency signals in nearly real time. The number of samples involved as the frequency increases can require massive amounts of memory.
Now that we have a representation of the signal in the computer memory, can we use the power of the computer to determine the characteristics for Fourier's approximation of the signal? Many mathematicians and engineers were involved in the advances described above and along the way they found how to apply Fourier's discoveries from 1810 to create the characteristic values and present a representation of the waveform for our voice signal. In 1965 James Cooley and John Tukey published the modern version of a Fast Fourier Transform (FFT). The FFT is an algorithm which takes the digitized, quantized representation of a waveform and produces the components of that waveform as a list of frequencies amplitudes and phases of the approximation of the waveform. If we are willing to tolerate a little error, we can do this in near real time and with a relatively small list of components. So, by transmitting this list we can get our voice signal from San Francisco to Boston with minimal, predictable distortion.
I hope this discussion has given you some understanding of how digital signal processing techniques came to be. At the end of this page are some references that give more of the details and many applications. I've been somewhat casual in the use of the mathematics, but the details would fill several books so you'll have to tolerate the slopiness. I've also cheated somewhat in discussing transmission techniques. I suggested that once we have the characteistics of the sine waves approximating our wave form we just "send them to Boston". How? Since we want something that approximates real time, we take little chunks of our voice signal, create the approximation and then use a digital encoding to send those characteristics down the transmission line. The encoding can be simple, like Morse code, or very complex with forward error correction or perhaps a bi-directional verification mechanism. Digital codes are another large and important topic that we won't try to cover here. Just be assured that one can create a very reliable encoding in nearly real time.
In the 1960s we'd use a combination of inductors and and capacitors to create a bandpass filter. In the 1970s we started using operational amplifiers with a negative feedback loop for out of band frequencies. With DSP we can digitize a signal, find the component frequencies from an FFT, throw out the out-of-band frequencies and then reconstitute the analog signal. The best part is we can do it in software so that we can change the bandwidth and drop off frequencies by just swapping a few parameters around.
The same approach can be taken to build a notch filter, lowpass filter or highpass filter. The video example at the begining of the article uses a comb filter to parse the frequencies into buckets, pick the dominant bucket and then access a looktable to get the appropriate RGB values. A comb filter is just a little more complex bandpass filter.
Somewhat more complex operations are required to do the slow down and speed up operations in the audio examples at the start of the article. In those cases we move the components in time before reconstituting the signal.
Another popular audio application is changing voice characteristics. By transforming the component frequencies in a consistent way we can reconstitute a signal that will make a male voice sound female.
The few references below cover most of what one could want about these topics and have long bibliographies pointing to the original research as well as many other descriptions of the topics.