← Glossary
What is a spectrum analyzer and how to analyze a sound with a smartphone?

Spectral Analysis

Spectral analysis is the decomposition of a complex signal into its different frequency components, allowing identification of the frequencies that constitute it and their respective intensity. A smartphone microphone is enough to practise it on sounds: it reveals the fundamental and the harmonics of a note, and therefore the timbre of an instrument or a voice.

Discover FizziQ

How to measure it in class

FizziQ decomposes in real time the sound captured by the microphone and displays its spectrum, that is, the amplitude of each frequency between 0 and 5,000 Hz: this is the Spectrograph instrument of the app. The frequency resolution depends on the duration of the analysed signal.

Steps:

  • Open FizziQ and select the Spectrograph instrument (FFT audio spectrum). Produce a pure tone using a tuning fork or an online frequency generator, and observe the spectrum: a single peak appears at the sound’s frequency.
  • Replace the pure tone with a note played on a musical instrument (flute, guitar, piano). Observe the additional peaks that appear: these are harmonics, integer multiples of the fundamental frequency.
  • Compare the spectra of two instruments playing the same note (for example, an A at 440 Hz). Observe that harmonics differ in number and intensity: this is what creates timbre.
  • Analyze the spectrum of a sung vowel (the “a” for example) and compare it with an “i.” Identify formants, those frequency zones that are amplified and characterize each vowel.

Scientific activities on this topic

Several experiments easily achievable with a smartphone, tablet, or computer allow performing spectral analyses of sounds and signals.

Learn more

Joseph Fourier and the birth of spectral analysis

In 1807, French mathematician Joseph Fourier presented a revolutionary idea to the Academy of Sciences: any periodic signal can be decomposed into a sum of sinusoids. This idea, initially controversial, has become one of the most used mathematical tools in science and engineering. The Fourier transform bears his name and remains at the heart of digital signal processing.

From analog to digital

Before the digital era, spectral analysis was done with analog filters or prisms for light. The FFT algorithm, published by Cooley and Tukey in 1965, made it possible to calculate spectra on computers in reasonable time. Today, a smartphone can calculate thousands of spectra per second thanks to the power of its processors.

Applications in music and acoustics

Spectral analysis is the basic tool of the sound engineer. It allows identifying resonances in a concert hall, detecting annoying frequencies in a recording, tuning a piano, or synthesizing digital sounds. Vocoders, which transform the human voice, rely entirely on spectral analysis and resynthesis.

Spectral analysis in astrophysics

Spectral analysis of starlight revolutionized astronomy. In 1859, Kirchhoff and Bunsen showed that each chemical element absorbs and emits light at specific frequencies. Thanks to this technique, we now know the chemical composition of stars located billions of light-years away, their surface temperature, their velocity of movement, and even the presence of planets around them.

Formula

The discrete Fourier transform, used for digital spectral analysis, is written:

X(k) = sum[ x(n) x e^(-j x 2*pi x k x n / N) ]

Meaning: X(k): complex amplitude of frequency component k x(n): signal value at point n N: total number of signal points j: imaginary unit (j^2 = -1) e: exponential k: index of the analyzed frequency (from 0 to N-1)

Application examples

  • The graphic equalizer of a hi-fi system that displays bass, mid, and treble levels

  • The Shazam app that identifies a song by analyzing its frequency spectrum

  • The prism that decomposes white light into a rainbow, the optical analog of spectral analysis

  • The seismograph that separates the different waves of an earthquake according to their frequencies

  • The medical spectrometer that analyzes the chemical composition of blood by spectral absorption

FAQ

Q: What is the difference between a spectrum and an oscillogram? A: An oscillogram shows the evolution of the signal over time (amplitude as a function of time). A spectrum shows the frequency composition of the signal (amplitude as a function of frequency). They are two complementary representations of the same signal.

Q: What is the difference between a spectrum and a spectrogram? A: The spectrum is a snapshot of the frequencies at a given moment. The spectrogram adds the dimension of time: it shows how the spectrum evolves, which allows following a melody, a vowel or a Doppler effect.

Q: Can spectral analysis of light be done with a smartphone? A: The microphone allows spectral analysis of sounds. For light, the smartphone’s photo sensor does not separate individual wavelengths, but a diffraction grating can be used in front of the camera to observe a light spectrum.

Q: What is a harmonic? A: A harmonic is a component whose frequency is an integer multiple of the fundamental frequency. If the fundamental is at 440 Hz, harmonics are at 880 Hz, 1,320 Hz, 1,760 Hz, etc.

Q: Why is the FFT so fast? A: The FFT (Fast Fourier Transform) is an optimized algorithm that reduces the number of calculations from N^2 to N x log2(N). For 1,024 points, this goes from more than a million to approximately 10,000 operations.

Q: Does spectral analysis only work for sound? A: No. Spectral analysis applies to any periodic or quasi-periodic signal: mechanical vibrations, electrical signals, light waves, seismic waves, biological signals such as the electrocardiogram.

Frequency - Harmonics - Fourier transform - Timbre - Sound spectrum - Spectrogram - Amplitude - Sound wave - Resonance

Explore FizziQ

Discover all the science experiments you can do with your smartphone.