Occasionally we find articles so compelling, we ask for permission to repost them here in our Guest Article series. Today’s article is by Cecilia Casarini, who is a PhD researcher in the Centre for Ultrasonic Engineering at the University of Strathclyde, in Glasgow, Scotland. Her article is on the subject of Bell Labs, their legendary scientists Claude Shannon & Harry Nyquist, the Nyquist sampling theorem, and aliasing, including audio samples. One slight edit we made from Casarini’s original is that sampling rates per second (samples/sec) are often improperly attributed to “Hertz” (Hz, cycles/sec). This misattribution started c.1983, about the time audio CD’s came into the mainstream, with their 44,100 sample/sec rate. With that brief introduction, here is Ms Casarini’s excellent article — Professor W Marshall Leach (obituary) smilingly approves!
Last weekend I was in Paris to meet a friend and we decided to visit the Musée des Arts et Métiers, which was hosting a very nice exposition on Claude Shannon (1916—2001) titled “Le magicien des codes.”
It is impressive to see how much Shannon contributed to the world of communication, as it seems that almost everything we do to communicate today, from writing a message on Facebook to calling a friend on Skype on the other end of the world, or paying the bill with our bank card, is the result of what he discovered years ago. Shannon is considered to be the father of information theory and a good amount of his work is included in his book “A Mathematical Theory of Communication.”
Here’s a documentary on his life and impact from University of California Television. Among other things he influenced the field of Boolean algebra; contributed to the concept of digitization and compression which allow us today to stream videos; and worked on speech encryption together with Alan Turing. He also in some way anticipated the ideas behind machine learning by building Theseus, an electrically controlled mouse that can find its way home by trial and error, as explained by Shannon himself in this video:
Well, of course Shannon has also been helped by a fascinating and inspiring working environment: Bell Labs. The north-central New Jersey Bell Labs [in fierce competition with RCA’s nearby David Sarnoff Research Center in Princeton ~DLS] contributed with Shannon to the development of Information Theory, and also to the invention of the transistor, the LASER, Unix, C, C++ …Just think that eight Nobel Prizes have been won by engineers & scientists working there.
[Editor’s note: Back in the day, competition was indeed fierce between Bell Labs and RCA’s Sarnoff Labs in Princeton, which wasn’t chopped liver, either. The first time, in 1980, I walked into the lobby, the 1956 Emmy Award, for Color TV was there on a pedestal. As you can see from their 70+ year timeline, other inventions, many in support of their NBC division, included the way to display computer characters on a screen, the LCD display you are reading this on, videotape, and so much more (And that doesn’t count the AEGIS missile defense system developed at Moorestown, the VCR, the color TV camera, the videodisk, and so much more at Camden). In between Sarnoff Labs and Bell Labs is the town of Menlo Park, New Jersey, home of the original engineering laboratory of Thomas Edison — Take that, Silicon Valley Millennials!]
Nyquist is without doubt well known to the DSP and audio engineering community for the development of the Shannon-Nyquist theorem, which explains aliasing and defines the Nyquist sampling rate. He was already quite revered at Bell Labs though, as testified by point 8 of this picture:
THE DAILY LIFE AT BELL LABS IS…
- The 20 to 30% of work time has to be devoted to a free project, chosen by the employee.
- Smart dress code is required.
- There are not personal profits: All the patents are sold for $1 to Bell Labs.
- The leaders have a role of advisors: they cannot interfere in the work of their subordinates.
- It is forbidden to flirt with the secretaries!
- It is allowed to collaborated without referring to one’s superior.
- Everyone has to give a scientific explanation to anyone who demands it.
- Whoever produces the highest number of patents has the right to have lunch with Harry Nyquist, one of the stars of our Lab!
- The employees are loyal to Bell Labs: One stays there for all his or her career.
- Works schedules are often substantial.
While dreaming of a lunch with Harry Nyquist, let’s then dive into the world of aliasing.
In order to record and digitize an analog signal we need to sample it. Sampling means that we check the value of that signal, we store it, and than we check it again after a certain period of time. We do not have any information regarding what happens between samples. If our sampling rate is not high enough in comparison to the highest frequency contained in our analog signal, we may experience aliasing.
“Aliasing” comes from the Latin word “alias,”
ALIASING EXAMPLE WITH MATLAB:
Let’s simulate a continuous signal sc composed of a simple sinusoid at a frequency f of 1000 Hz (I say “simulate” because of course nothing will ever be continuous in MATLAB).
% Number of points
NP = 50000;
% Signal length (s) -increase tmax if you want to hear a longer signal (but
% you will have a more dense graph.)
tmin = 0;
tmax = 0.01;
% Time axis
tc = linspace(tmin, tmax, NP);
% Frequency of the signal (Hz)
f = 1000;
sc = sin(2*pi*f*tc);
And let’s plot it:
Now, if we sample it at 44100 Hz, which is the most common sample rate for audio, we can clearly see that we have enough points to represent the signal.
% Sample rate (Hz)
Fs1 = 44100;
% Sampling period
Ts1 = 1/Fs1;
% Time line
t1 = tmin:Ts1:tmax;
s1 = sin(2*pi*f*t1);
In MATLAB you can also play the signal to listen to the frequency:
% Playing the resulting frequency
You can listen to it here:
Let’s now sample at a lower sample rate, for example 1500 Hz.
% Sample rate (Hz)
Fs2 = 1500;
% Sampling period
Ts2 = 1/Fs2;
% Time line
t2 = tmin:Ts2:tmax;
s2 = sin(2*pi*f*t2);
We can notice that there are not enough points to represent the signal:
There are many signals that could be represented by sinusoids passing through these orange points! It could be a signal at 500 Hz, 1500 Hz, 2000 Hz, 2500 Hz, etc… In this case the 1000 Hz original signal will be aliased and we will hear a 500 Hz signal, because 500 Hz is lower than the Nyquist frequency (1500 Hz / 2 = 750 Hz):
If you listen to the signal with soundsc you will hear indeed a 500 Hz frequency.
You can also listen to it here:
You can download or have a look at the Matlab .m file on aliasing that I created here.
Just to give you now a more musical example, I took the most famous bit of Der Hölle Rache and created an aliased version of it. As you probably know, the highest note in this aria is an F6, which corresponds to a frequency of 1396.91 Hz. By sampling at a rate of 2756/sec, which is lower than the Nyquist rate, the F6 will be aliased. We’ll hear a frequency of 1359 Hz instead, which sounds already a bit like an E6, a nightmare for singers trying to sing this aria!
Here you can listen to the original 44,100 samples/sec version:
And here you can enjoy (or probably not) the aliased version:
DISCLAIMER: This may be really hurting to hear if you love this piece!
Conclusion: Choose carefully your sampling rate when recording!
You can download the MATLAB script used to obtain the aliased version of Der Hölle Rache.
(Edda Moser (s), Queen of the Night)
About the author:
Cecilia Casarini is a PhD researcher in the Centre for Ultrasonic Engineering at the University of Strathclyde, Glasgow, Scotland. At this time she is working on 3D printed acoustic metamaterials, and her research interests are in general acoustics, bioinspired technologies, auditory systems, hearing aids, psychoacoustics, spatial & binaural audio, DSP, speech and language processing.
Her first encounter with the world of acoustics was during her years spent studying piano at the Conservatory. She also followed some courses on organology related to the history and the acoustics of musical instruments and to the physics of sound.
It was only some years later, when she moved to Scotland, that she realized what an amazing subject acoustics actually is. She enrolled in the MSc in Acoustics and Music Technology at the University of Edinburgh, where she attended course subjects including acoustics, digital signal processing, speech and language processing, and automatic speech recognition. In her final project she built a MATLAB model which simulated the phenomenon of otoacoustic emissions (OAE’s); and also measured them using a specific equipment and LabVIEW.
While editing and further researching this article, we stumbled across her fascinating basilar membrane oscillation simulation, which in itself is worth a look:
Ms Casarini publishes the new “It’s Acoustics Time! ” blog; and you can find her original version of this article here.