惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

人人都是产品经理
人人都是产品经理
Stack Overflow Blog
Stack Overflow Blog
S
SegmentFault 最新的问题
博客园 - 司徒正美
aimingoo的专栏
aimingoo的专栏
U
Unit 42
GbyAI
GbyAI
B
Blog RSS Feed
博客园 - Franky
L
LangChain Blog
Hugging Face - Blog
Hugging Face - Blog
美团技术团队
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
云风的 BLOG
云风的 BLOG
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 三生石上(FineUI控件)
Microsoft Azure Blog
Microsoft Azure Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
G
Google Developers Blog
Last Week in AI
Last Week in AI
阮一峰的网络日志
阮一峰的网络日志
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Apple Machine Learning Research
Apple Machine Learning Research

Hacker News

GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis Bonsai 1-bit WebGPU - a Hugging Face Space by webml-community Moving a large-scale metrics pipeline from StatsD to OpenTelemetry / Prometheus GitHub - Nightmare-Eclipse/RedSun: The Red Sun vulnerability repository GitHub - SethPyle376/hiraeth: Local AWS emulator focused on fast integration testing, with SQS support, SQLite-backed state, and a debug-friendly web UI. GitHub - macOS26/Agent: Any AI, replaces Claude Code, Cursor, OpenClaw. Over 18 LLM providers (Claude, OpenAI, Gemini, Ollama, Zai, HF, Qwen) wired into a native Mac app that writes code, builds Xcode projects, bumps versions, manages git, automates Safari, use AppleScript, JS or Accessibility, extend Agent! w/ MCP Servers, run tasks from your iPhone via Messages. YouTube now lets you turn off Shorts I Made a Terminal Pager Burgers | マクドナルド公式 Commands — HackerNews CLI documentation ChatGPT for Excel PiCore - Raspberry Pi Port of Tiny Core Linux Live Nation illegally monopolized ticketing market, jury finds Google Broke Its Promise to Me. Now ICE Has My Data. Founding Engineer at Adaptional | Y Combinator CRISPR takes important step toward silencing Down syndrome’s extra chromosome GitHub - saffron-health/libretto: The AI toolkit for building reliable browser automations US v. Heppner (S.D.N.Y. 2026) no attorney-client privilege for AI chats [pdf] Retrofitting JIT Compilers into C Interpreters IPv6 – Google The Accursèd Alphabetical Clock Cybersecurity Looks Like Proof of Work Now Fragments: April 14 Cal.com Goes Closed Source: Why AI Security Is Forcing Our Decision | Cal.com - Scheduling Software for Online Bookings Laravel raised money and now injects ads directly into your agent When moving fast, talking is the first thing to break Too much Discussion of the XOR swap trick – Heather Cafe Introduction to Spherical Harmonics for Graphics Programmers The Grand Line
The Constant-Q Transform — A Visual Guide
2026-05-29 · via Hacker News

A visual, interactive guide to the frequency transform that hears music the way we do — with logarithmic resolution matching the structure of pitch.

Chapter 1

01 The Core Intuition

"Constant Q" means the ratio of each frequency bin's centre frequency to its bandwidth is constant. Low notes get wide analysis windows (good frequency resolution); high notes get narrow windows (good time resolution).

This mirrors how musical pitch works. On a piano, the distance from C3 to C4 spans the same perceptual interval as C5 to C6, even though the latter covers four times the Hz range. The CQT spaces its bins logarithmically to match, typically placing 12, 24, 36, or more bins per octave.

Bins per octave: 24 Octaves: 5

CQT frequency bins — each bar is one bin. Notice how bandwidth grows with frequency, but Q = f/Δf stays constant.

Q factor: Q = fk / Δfk. In a standard FFT, Q varies — low-frequency bins are narrow (high Q), high-frequency bins are wide (low Q). In the CQT, Q is the same for every bin. This is why musical notes look equally spaced in a CQT spectrogram.

Chapter 2

02 FFT vs CQT

The FFT uses linearly-spaced frequency bins. Musical notes are logarithmically spaced. The mismatch makes pitch analysis with the FFT awkward — the CQT solves this directly.

Consider a signal containing notes at C3, E4, and G5. In the FFT, these three notes are unevenly distributed across the spectrum, and the low notes are smeared across very few bins. In the CQT, each note occupies proportionally the same width.

Three-note chord: C3 (130.8 Hz) + E4 (329.6 Hz) + G5 (784 Hz)

FFT — linear frequency axis. Low notes are crammed into a tiny region.

CQT — log frequency axis. Each note gets equal visual weight.

The fundamental difference: FFT bin spacing is Δf = fs/N (constant in Hz). CQT bin spacing is Δfk = fk · (21/B − 1) (proportional to frequency). This makes the CQT a natural fit for anything involving musical pitch, speech formants, or logarithmic frequency structure.

Chapter 3

03 Log-Frequency Geometry

The CQT maps frequency to a logarithmic axis where octaves are equally spaced. This aligns perfectly with the Western chromatic scale — and with human pitch perception.

Animated piano-roll CQT spectrogram — watch notes light up on a log-frequency axis as the arpeggio plays

Bins per octave (B): With B=12, each bin is one semitone. B=24 gives quarter-tone resolution. B=36 gives eighth-tones. Higher B means finer pitch discrimination but longer analysis windows at low frequencies.

fk = fmin · 2k/B   for k = 0, 1, …, K−1   where K = B · num_octaves

Chapter 4

04 The CQT Kernel

Each CQT bin uses a different-length analysis window. Low-frequency bins use long windows for precise pitch resolution; high-frequency bins use short windows for precise timing.

The window length for bin k is Nk = Q · fs / fk. This is the heart of the constant-Q property — the window always contains the same number of oscillation cycles, regardless of frequency.

Nk = ⌈ Q · fs / fk ⌉   where Q = 1 / (21/B − 1)

Bin index: 0

CQT analysis kernel for the selected bin — real part (top) and magnitude envelope (bottom). Drag the slider to see how window length shrinks at higher frequencies.

1

Compute the window length Nk for each bin from Q and fk

2

Generate a windowed complex exponential at fk

3

Multiply the signal by this kernel and sum — that's one CQT coefficient

4

Repeat for all K bins across all time frames

Chapter 5

05 Computing the CQT

The naive CQT is expensive — O(KN) per frame. Efficient algorithms use the FFT as a backbone, either via spectral kernels or recursive downsampling.

Speed:

Building a CQT spectrogram frame by frame — each column is one hop, each row is one log-frequency bin

Efficient CQT (Brown & Puckette, 1992): Pre-compute spectral kernels K̂k via FFT. For each frame, take the FFT of the signal segment X̂, then the CQT coefficient is simply X̂ · K̂k*. This converts the whole transform into sparse matrix–vector multiplications, often 10–100× faster than the naive approach.

CQT(k, n) = Σj x(n + j) · wk(j) · e−i2πfkj/fs

Where wk(j) is the window function of length Nk. The key insight is that each bin sees a different number of signal samples, unlike the FFT where every bin uses the same window.

Chapter 6

06 From CQT to Chromagram

Fold the CQT's log-frequency bins into a single octave and you get a chromagram — a 12-dimensional representation of harmonic content, perfect for chord recognition and key detection.

If the CQT has B=36 bins per octave across 5 octaves (180 bins total), the chromagram sums every 3rd bin (for 12 chroma classes) across all octaves, collapsing the 180 bins into 12.

Chord:

CQT spectrogram (top) folded into a 12-bin chromagram (bottom). Switch chords to see how the chroma profile changes.

Octave invariance: The chromagram treats C3, C4, and C5 as the same pitch class "C". This makes it robust to register changes and lets algorithms focus on harmonic identity rather than absolute pitch.

Chapter 7

07 Real-World Applications

The CQT is the backbone of modern music information retrieval, audio synthesis, and intelligent audio processing.

Signal:

Live CQT spectrogram of different musical signals — note how pitched content appears as distinct horizontal bands

🎵

Pitch tracking — automatic transcription, melody extraction, tuner apps

🎸

Chord recognition — real-time chord detection via CQT → chromagram pipeline

🎛

Audio synthesis — phase vocoders with perceptually uniform frequency resolution

🤖

Deep learning — CQT spectrograms as input features for music classification, source separation, and generative models

CQT in neural networks: Many state-of-the-art music AI systems (Demucs, OpenL3, CREPE) use CQT or CQT-like representations as input features instead of mel spectrograms, because the constant-Q resolution matches the structure of the data they're modelling.