{
  "id": "spectrogram",
  "title": "Spectrogram",
  "lang": "en",
  "source_lang": "en",
  "summary": "A spectrogram represents how a signal’s frequency content changes over time, revealing structures that are hidden in its waveform or overall spectrum.",
  "category": "science",
  "subcategory": "physics",
  "type": "concept",
  "aliases": [
    "Time–frequency spectrogram",
    "sound spectrogram",
    "sonogram"
  ],
  "generated_at": "2026-11-04",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/spectrogram/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/spectrogram/",
      "json": "https://aiwiki.page/zh/spectrogram.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "A spectrogram is a visual representation of the frequency content of a signal as it changes over time. In its most common form, time runs horizontally, frequency runs vertically, and brightness or color indicates the strength of a frequency component. Spectrograms are especially familiar in the analysis of sound, but the same principles apply to vibration, electrical recordings, radio transmissions, and many other time-varying measurements.\n\nUnlike a waveform, which shows signal amplitude against time, a spectrogram separates activity into frequency bands. Unlike a single spectrum calculated over an entire recording, it preserves information about when different components occur. This makes it possible to distinguish a sustained tone from a brief impact, follow the changing resonances of speech, identify an animal call, or track a machine component whose vibration changes with operating speed.\n\nMost spectrograms are calculated using the short-time Fourier transform, which analyzes successive, usually overlapping portions of a signal. Their appearance therefore depends not only on the recorded phenomenon but also on analysis settings, normalization, and display choices. Understanding a spectrogram requires attention to these choices, particularly the trade-off between temporal and frequency resolution."
    },
    {
      "heading": "Representation and physical meaning",
      "text": "A spectrogram maps a one-dimensional signal into a two-dimensional time–frequency representation. For sound, the original signal may be a measurement of acoustic pressure or an electrical voltage proportional to it. Each vertical slice of the spectrogram describes the frequency content of a short interval. Reading across slices reveals how that content develops: horizontal lines indicate relatively steady frequencies, sloping lines indicate frequency changes, and brief vertical structures often indicate rapidly occurring events.\n\nThe word spectrogram has both a strict mathematical meaning and a broader practical meaning. Strictly, it commonly denotes the squared magnitude of the short-time Fourier transform. Software may instead display its magnitude, a normalized estimate of power spectral density, or a logarithm of one of these quantities. These representations can look similar while having different numerical meanings and units. A power spectral density derived from a pressure signal, for example, can have units of pascals squared per hertz; an unnormalized squared Fourier magnitude generally does not.\n\nColor often encodes a logarithmic quantity expressed in decibels. For a power-like quantity \\(P\\), the displayed level relative to a reference \\(P_{\\mathrm{ref}}\\) is\n\n\\[L_P=10\\log_{10}\\left(\\frac{P}{P_{\\mathrm{ref}}}\\right).\\]\n\nFor an amplitude quantity \\(A\\), the corresponding expression is \\(20\\log_{10}(A/A_{\\mathrm{ref}})\\), provided that power is proportional to amplitude squared under the relevant conditions. A display normalized to its own maximum is not an absolute acoustic measurement. Its brightest pixel may mean only “largest value in this recording,” rather than a specified physical sound level.\n\nFrequency axes may be linear or logarithmic. A linear axis assigns equal vertical distances to equal differences in hertz, making harmonics of a periodic signal appear evenly spaced. A logarithmic axis assigns equal distances to equal frequency ratios, which is useful for music because octave intervals correspond to a doubling of frequency. Display orientation also varies: some instruments place time vertically, or show recent measurements as a scrolling waterfall.\n\nThe term sonogram is sometimes used for an acoustic spectrogram, but it is ambiguous because it also refers to an ultrasound image. A sound spectrogram should likewise not be confused with an optical spectrum or a spectrographic plate in spectroscopy. These share the general idea of resolving a signal into components, but they need not represent time on one of their axes."
    },
    {
      "heading": "Development from analyzing instruments to digital displays",
      "text": "Spectrograms emerged from attempts to make changing sounds visible. During the nineteenth and early twentieth centuries, investigators used resonators, mechanical recording devices, oscillographs, and filter systems to examine sound. A waveform could reveal periodicity and timing, while a spectrum could identify component frequencies, but neither alone provided an easily readable record of rapidly changing speech. Producing a time-resolved spectral display required both frequency-selective analysis and a means of recording its output.\n\nA major development occurred at Bell Telephone Laboratories during the 1940s. The sound spectrograph analyzed recorded speech through frequency-selective filtering and produced a visible pattern whose darkness represented signal strength. Early instruments could repeatedly play a short recorded passage while changing the analyzed frequency band. The successive measurements were assembled into a two-dimensional image. This was a mechanical and electronic procedure rather than the instantaneous calculation familiar from modern software.\n\nThe sound spectrograph was described publicly in a 1946 paper by Walter Koenig, H. K. Dunn, and L. Y. Lacy. The 1947 book Visible Speech, by Ralph K. Potter, George A. Kopp, and Harriet C. Green, helped establish spectrograms as tools for studying spoken language. Their images made vowel resonances, consonant transitions, and the timing of speech events available for systematic comparison. Work associated with World War II and telecommunications research therefore became important to postwar phonetics and acoustic analysis.\n\nDigital computation changed both the speed and flexibility of the technique. Instead of physically filtering repeated playback, a computer could divide sampled data into short frames and calculate a spectrum for each frame. The fast Fourier transform, especially the widely influential algorithm published by James Cooley and John Tukey in 1965, greatly reduced the computational cost of discrete Fourier analysis. It was not the first fast Fourier method, but its dissemination helped make repeated spectral calculation practical across engineering and science.\n\nAs computing resources expanded, spectrograms moved from specialized laboratory equipment into general-purpose audio editors, scientific programming libraries, field recorders, and real-time instruments. Analysts could change window lengths, zoom into short events, compare channels, and inspect recordings lasting hours or days. Modern systems may calculate spectrograms continuously from streaming data. Nevertheless, the central interpretive problem remains the same as in early sound spectrography: the visible pattern reflects the joint behavior of the source, the recording system, and the analyzer."
    },
    {
      "heading": "Calculation with the short-time Fourier transform",
      "text": "The mathematical foundation of most spectrograms is the Fourier transform, which represents a signal in terms of sinusoidal components. A Fourier transform of an entire recording indicates which frequencies occur overall, but does not directly identify when they occur. The short-time Fourier transform addresses this by multiplying the signal by a localized window function and repeating the calculation as the window moves through time.\n\nFor a discrete signal \\(x[n]\\), one common definition is\n\n\\[X[m,k] = \\sum_{n=0}^{L-1} x[n+mH]\\,w[n]\\, e^{-i2\\pi kn/N},\\]\n\nwhere \\(L\\) is the window length in samples, \\(H\\) is the hop size between frames, \\(N\\geq L\\) is the transform length, and \\(w[n]\\) is the window. The indices \\(m\\) and \\(k\\) identify time frames and frequency bins. Under this convention, the frame begins at sample \\(mH\\); software often labels it by its center instead. A basic spectrogram is then\n\n\\[S[m,k]=|X[m,k]|^2.\\]\n\nWindows such as the Hann and Hamming windows reduce the abrupt discontinuities introduced by cutting a finite segment from a longer signal. Without tapering, those discontinuities spread energy across frequencies, a phenomenon known as spectral leakage. Windowing reduces some leakage at the cost of broadening the main response around each frequency component. Thus, choosing a window is not merely a cosmetic decision: it changes how weak components near strong ones can be distinguished.\n\nNormalization determines the numerical interpretation. For example, a common two-sided power spectral density estimate for each frame is\n\n\\[\\widehat{P}[m,k] = \\frac{|X[m,k]|^2} {f_s\\sum_{n=0}^{L-1}w[n]^2},\\]\n\nwhere \\(f_s\\) is the sampling rate. This expression assumes the unnormalized forward transform used above. For a real-valued signal, a one-sided representation usually retains only nonnegative frequencies and doubles the interior frequency-bin powers, while leaving the zero-frequency component and, when present, the Nyquist component unchanged. Different software conventions can therefore produce different values from the same samples unless their normalization is matched.\n\nSampling and framing establish the coordinate system. The frequency-bin spacing is \\(f_s/N\\), while successive frames are separated by \\(H/f_s\\) seconds. Overlap makes the display more densely sampled in time and can reduce the chance of missing events near window boundaries. It does not, by itself, make each individual frame temporally sharper. Implementations must also decide how to treat the beginning and end of a recording: omit incomplete frames, pad them with zeros, or extend the data by another rule. These choices matter particularly for very short signals and events close to recording boundaries."
    },
    {
      "heading": "Resolution, sampling, and the time–frequency trade-off",
      "text": "A central limitation of spectrogram analysis is that precise timing and precise frequency separation cannot both be obtained arbitrarily from a single fixed window. A short window localizes an event in time but contains relatively few cycles of a low-frequency oscillation. A long window captures more cycles and can distinguish closer frequencies, but combines information across a longer interval. This is a property of time–frequency analysis, not simply a limitation of computer speed or screen resolution.\n\nFor a window characterized by root-mean-square time and frequency spreads, calculated from its normalized squared magnitude and that of its Fourier transform, the Fourier uncertainty relation can be written\n\n\\[\\sigma_t\\sigma_f\\geq\\frac{1}{4\\pi}.\\]\n\nThe numerical constant depends on using ordinary frequency rather than angular frequency. A Gaussian window attains equality under these definitions. This mathematical relation is closely related in form to uncertainty relations elsewhere in physics, but an acoustic spectrogram does not require a quantum-mechanical interpretation.\n\nConsider audio sampled at \\(48{,}000\\) samples per second. A 960-sample window covers 20 milliseconds. With a 960-point transform, frequency bins are spaced 50 hertz apart. A 4,800-sample window covers 100 milliseconds and yields 10-hertz bin spacing. The longer window can better separate nearby steady tones, while a sudden onset is spread across a longer time interval. The actual ability to distinguish two tones also depends on the window’s main-lobe width, sidelobes, relative signal amplitudes, and noise—not just the spacing between plotted bins.\n\nAdding zeros before the Fourier transform increases the number of frequency samples without adding new observations. This zero-padding can produce smoother-looking curves and improve interpolation of an isolated peak’s position, but it does not confer the resolving power of a longer recording window. Similarly, a very small hop size produces closely spaced time columns without removing the temporal averaging imposed by the window.\n\nThe sampling theorem imposes another constraint. For real-valued data sampled at rate \\(f_s\\), the unique nonnegative frequency range extends to \\(f_s/2\\). Components above this limit can appear at misleading lower frequencies through aliasing unless sufficiently attenuated before sampling. Digital resampling can introduce comparable problems if filtering is inadequate. A finely rendered spectrogram cannot recover the true frequency of an already aliased component from the sampled signal alone.\n\nResolution also depends on the problem being studied. Detecting a short high-frequency click may require millisecond-scale windows, whereas distinguishing closely spaced low-frequency machinery tones may require much longer intervals. A single analysis configuration is therefore rarely optimal for every event in a heterogeneous recording."
    },
    {
      "heading": "Reading patterns in sound and other signals",
      "text": "The simplest spectrogram patterns correspond to elementary signals. A steady sinusoid produces a horizontal ridge whose thickness depends on the analysis window. A frequency sweep, or chirp, produces a rising or falling ridge. A brief impulse spreads across a broad frequency range and appears approximately vertical, although its visible duration is affected by the window. Random noise produces a diffuse texture; its distribution across frequency distinguishes, for example, an approximately flat spectrum from one concentrated at low frequencies.\n\nA periodic but nonsinusoidal signal produces components at integer multiples of its fundamental frequency. These are harmonics. A source repeating at 100 hertz may therefore generate lines near 100, 200, 300 hertz, and so on. Their strengths depend on the shape of the repeating waveform and on filtering by the surrounding system. Harmonic spacing can reveal periodicity even when the fundamental itself is weak or absent. A low-frequency spectral peak, however, is not automatically the fundamental: it may be a resonance, a modulation component, or unrelated interference.\n\nChanges in amplitude and frequency leave characteristic structures. Periodic amplitude variation can create sidebands around a carrier frequency; periodic frequency variation can create a more extensive family of sidebands. Smooth frequency modulation may appear as a wavering ridge when temporal resolution is sufficient. Abrupt modulation can instead generate broad spectral spreading. Multiple simultaneous sources may produce crossing tracks, parallel harmonic stacks, or overlapping bands that cannot be assigned uniquely from appearance alone.\n\nRecording artifacts can resemble physical events. Clipping, which occurs when a signal exceeds a system’s available amplitude range, changes waveform shape and generates additional frequency components. Electrical interference may produce persistent lines near a mains frequency of 50 or 60 hertz and its multiples. Wind at a microphone often creates strong low-frequency activity. Reverberation extends sound after its direct arrival, and echoes can create repeated structures or frequency-dependent patterns through interference.\n\nInterpretation therefore involves distinguishing the behavior of a source from that of the transmission path and measuring instrument. A rising tonal track might reflect an increasing source frequency, changing rotational speed, or a Doppler shift caused by relative motion. A disappearing band might indicate the end of an event, but it could also result from microphone directionality, filtering, masking by stronger signals, or a change in display scale.\n\nA spectrogram provides evidence about signal structure, not an automatic identification of its cause. Similar patterns can arise from different mechanisms, and different settings can make the same event look substantially different. Waveforms, spectra, contextual information, and repeated observations are often needed to distinguish competing interpretations."
    },
    {
      "heading": "Speech, language, and musical analysis",
      "text": "Speech spectrograms reveal the interaction between sound production and the resonant filtering of the vocal tract. During voiced speech, vibration of the vocal folds creates an approximately periodic excitation. The vocal tract shapes the resulting spectrum, emphasizing some frequency regions and attenuating others. Prominent vocal-tract resonances are called formants. Their frequencies and movements are central to the acoustic study of vowels and many consonants.\n\nTwo traditional display settings emphasize different aspects of this process. A wideband spectrogram uses relatively broad analysis filters, equivalent to comparatively short time windows. It shows rapid events and can reveal individual glottal pulses as vertical striations, while formant regions appear as broad bands. A narrowband spectrogram uses narrower filters or longer windows, making individual harmonics easier to distinguish. The names refer to analysis bandwidth, not to the total frequency range recorded.\n\nFor vowels, the first and second formants, conventionally \\(F_1\\) and \\(F_2\\), are especially informative. Broadly, \\(F_1\\) tends to be lower for high vowels and higher for low vowels, while \\(F_2\\) is strongly affected by tongue position and lip configuration. These are relationships rather than exact one-to-one rules: anatomy, speaking style, neighboring sounds, and language all affect the measured values. A spectrogram can display the spectral evidence from which formants are estimated, but a formant is not simply any dark horizontal line. Individual harmonics can be mistaken for resonances, especially in high-pitched voices.\n\nConsonants produce other recognizable structures. Stop consonants may include a closure interval, a release burst, and transitions into neighboring vowels. Fricatives produce turbulent, noise-like energy whose spectral concentration depends on the constriction and surrounding cavities. Nasal sounds introduce both resonances and spectral reductions associated with the coupled oral and nasal cavities. Spectrograms are consequently used in phonetics to examine articulation, timing, coarticulation, and contrasts between speech sounds.\n\nIn music, harmonic tracks help reveal notes, changes in pitch, vibrato, and transitions between instruments. An onset may contain a broad transient followed by more stable partials. A piano string can produce partials that depart from exact integer multiples because of stiffness, while bells often have strongly inharmonic modal frequencies. Percussive sounds may therefore be better described in terms of resonant modes than a single harmonic series.\n\nSpectrograms do not reproduce auditory experience directly. Perceived pitch, timbre, loudness, and intelligibility depend on auditory processing as well as physical spectra. Nevertheless, connecting visible structures with known production mechanisms makes them useful in language research, musicology, sound design, and the analysis of recorded performances."
    },
    {
      "heading": "Scientific and engineering applications",
      "text": "In ecology and animal behavior, spectrograms support the study of vocal communication and environmental sound. Bird songs may appear as repeated whistles, trills, and frequency-modulated phrases; bat echolocation often contains short ultrasonic sweeps; marine mammal recordings can include tonal calls, clicks, and broadband pulses. These patterns allow researchers to compare call types and measure duration, frequency range, repetition rate, and modulation. Their interpretation requires suitable sampling rates: an ordinary audio recording cannot preserve ultrasonic calls above its recording bandwidth.\n\nLong-term acoustic monitoring extends this approach to habitats and communities. Recorders can collect data over days or months, after which spectrograms assist event detection and manual verification. However, the amount of visible acoustic activity is not a direct count of animals or a complete measure of biodiversity. Vocal behavior, distance, weather, recorder response, and overlapping calls all influence what is recorded. Comparisons across sites depend on consistent methods and appropriate ecological sampling.\n\nIn mechanical engineering, spectrograms expose vibration components that change with machine operation. A rotating shaft can generate a component at its rotation frequency and harmonics associated with imbalance, misalignment, or other processes. Gear meshing introduces frequencies related to tooth count and rotational speed, while impacts can excite broadband resonances. During acceleration or deceleration, these components trace curves rather than stationary lines. Order tracking, which relates components to rotational speed rather than fixed hertz, is often more informative when speed varies substantially.\n\nIn neuroscience, time-resolved spectral analysis is applied to electrical and magnetic recordings of brain activity. Spectrogram-like displays can show changes in oscillatory power during tasks, sleep, or sensory stimulation. The interpretation differs from that of a clean musical tone: physiological recordings contain overlapping sources, nonoscillatory background activity, artifacts, and substantial statistical variability. A bright patch in a chosen frequency band does not by itself establish a distinct neural oscillator or a particular cognitive function.\n\nRadio and radar systems use time–frequency displays to distinguish steady carriers, pulsed emissions, hopping frequencies, and swept signals. When recordings use complex in-phase and quadrature data, positive and negative frequencies can carry distinct information rather than duplicating one another as they do for a real-valued signal. Spectrograms also help inspect seismic events and other geophysical measurements, where changing frequency content can distinguish signal phases or reveal persistent instrumental noise.\n\nA prominent astronomical application involves gravitational waves. Compact-binary inspirals can generate a chirp whose frequency and amplitude increase as the orbit evolves. Time–frequency images provide an intuitive view of such events, but precise detection and parameter estimation also use waveform models, noise characterization, and statistical methods. The image is a representation of measured evidence rather than an independent substitute for those analyses."
    },
    {
      "heading": "Related representations and recovery of signals",
      "text": "The ordinary spectrogram uses the same window duration throughout an analysis. Other time–frequency methods alter this arrangement to suit signals whose characteristic timescales vary with frequency. A wavelet transform uses scaled analyzing functions, commonly providing finer temporal localization at high frequencies and finer frequency localization at low frequencies. The squared magnitude of its coefficients is often called a scalogram. Although scalograms can resemble spectrograms, their coordinate spacing, normalization, and resolution properties differ.\n\nThe constant-Q transform uses frequency bands whose center frequency divided by bandwidth is approximately constant. This produces narrower absolute bandwidths at low frequencies and wider ones at high frequencies, making it useful for musical analysis on a logarithmic pitch scale. A logarithmic display of an ordinary fixed-window spectrogram is not equivalent to a constant-Q transform: changing the plotted axis does not change the underlying resolution.\n\nA mel spectrogram is formed by combining spectral values through filters arranged according to a perceptually motivated frequency scale. It is widely used in speech and audio processing, often after logarithmic compression. It reduces the frequency dimension and emphasizes broad spectral structure, but discards detail. Mel-frequency cepstral coefficients apply an additional transformation to log filter-bank values and are not themselves an ordinary time–frequency image.\n\nOther methods seek sharper localization. Reassignment relocates spectral energy using information derived from the local phase of the transform, concentrating components near estimated times and frequencies. The Wigner–Ville distribution can provide high concentration for some signals, but multiple components generate cross-terms that may be mistaken for real signal content. Sharper-looking images therefore do not necessarily provide simpler or more reliable interpretation.\n\nSignal reconstruction introduces a separate distinction. The complex short-time Fourier transform retains both magnitude and phase. Under suitable window and overlap conditions, its frames can be transformed back and combined to recover the original signal. For the same analysis and synthesis window, one common overlap-add reconstruction is\n\n\\[\\widehat{x}[n] = \\frac{\\sum_m w[n-mH]\\,y_m[n-mH]} {\\sum_m w[n-mH]^2},\\]\n\nwhere \\(y_m\\) is the inverse-transformed frame, equal to the corresponding windowed signal segment in the unmodified case. Reconstruction requires a nonzero denominator wherever recovery is intended.\n\nA magnitude or power spectrogram lacks explicit phase information, so direct inversion is unavailable. Additional constraints and phase-retrieval algorithms can sometimes recover or approximate a compatible waveform. The Griffin–Lim algorithm, introduced in 1984, iteratively alternates between transform-domain magnitude constraints and consistency with a time-domain signal. A rendered image loses still more information through color mapping, clipping, and pixel reduction; converting such an image back into sound is consequently a different and generally more underdetermined task."
    },
    {
      "heading": "Quantitative reliability and computational interpretation",
      "text": "A spectrogram’s visual clarity does not guarantee quantitative comparability. Two displays of the same recording can differ dramatically because one uses automatic normalization, another uses a fixed reference, and a third applies a different window or frequency scale. Reproducible analysis therefore identifies the sampling rate, window type and duration, hop size, transform length, normalization, frequency range, and logarithmic reference. It also specifies whether the plotted values represent magnitude, power, or power spectral density.\n\nPhysical measurement requires attention to the recording chain. Microphones, amplifiers, accelerometers, and digitizers have frequency-dependent responses and finite noise floors. Calibration establishes how recorded values relate to the physical quantity of interest, while measurement uncertainty describes limits on the resulting estimates. Without such information, relative changes within a recording may remain useful, but comparisons of absolute levels between instruments or recording sessions can be misleading.\n\nDisplay processing introduces additional choices. A logarithmic plot cannot represent zero directly, so implementations impose a lower floor before or after taking logarithms. Restricting the dynamic range can reveal weak structures but can also make low-level noise appear prominent. Resizing a large spectrogram to fit a screen may average or otherwise aggregate values, suppressing short or narrowband events. Color maps with abrupt or uneven perceptual changes can exaggerate boundaries not present in the numerical data.\n\nNoise and statistical dependence also affect interpretation. A short-time spectrum of a random signal is a variable estimate, not a perfectly stable description of its underlying process. Overlapping frames share samples and are therefore correlated. Averaging across time, frequency, or repeated observations can reduce variability, but also changes resolution and may obscure brief events. When spectrograms support statistical claims, these dependencies and the number of time–frequency comparisons become relevant.\n\nSpectrograms are common inputs to machine-learning systems because local patterns can be processed by artificial neural networks and other models. Applications include speech recognition, acoustic event detection, musical transcription, and equipment monitoring. The representation can simplify learning, but it also encodes preprocessing choices. A model trained on one sample rate, frequency range, or normalization may respond poorly when those conditions change.\n\nEvaluation must distinguish learning the intended phenomenon from learning incidental properties of the recordings. A classifier may exploit microphone response, background noise, compression artifacts, or repeated recording conditions rather than the target call or fault. Separating training and evaluation data by recording session, device, location, or individual source can expose such effects. In these computational uses, the spectrogram remains a measurement-derived representation whose scientific meaning depends on how the signal was collected and transformed."
    }
  ],
  "links": [
    "short-time-fourier-transform",
    "pressure",
    "decibel",
    "music",
    "spectroscopy",
    "world-war-ii",
    "fast-fourier-transform",
    "fourier-transform",
    "window-function",
    "uncertainty-principle",
    "physics",
    "sampling-theorem",
    "aliasing",
    "harmonic",
    "interference",
    "doppler-effect",
    "formant",
    "language",
    "biodiversity",
    "neuroscience",
    "gravitational-wave",
    "calibration",
    "measurement-uncertainty",
    "machine-learning",
    "artificial-neural-network"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}