오디오 AI 가이드

오디오에 대한 Constant-Q 변환

The constant-Q transform (CQT) turns audio into a time-frequency picture whose frequency bins are spaced like musical notes, a fixed number per octave, instead of evenly in hertz like the Fourier transform.

이 가이드를 들어보세요AI 내레이션 · ~8 min

이 페이지에서9분 읽기
  1. 개요
  2. 주요 시사점
  3. 심층 분석
  4. Find a note in a CQT with librosa
  5. 실제 구현
  6. 오디오를 위한 Constant-Q 변환의 미래
  7. 실천에 옮기기
  8. 출처 및 추가 자료
  9. 계속 탐색하세요
  10. 자주 묻는 질문

개요

Because a change of key simply slides the picture up or down, the CQT is a standard input for music transcription, pitch tracking and chord recognition models.

주요 시사점

  1. The constant-Q transform spaces frequency bins geometrically, a fixed number per octave, so each bin can line up with a musical note.
  2. Every CQT bin has the same ratio of center frequency to bandwidth, so low notes get long windows and high notes short ones.
  3. Transposing music shifts a CQT up or down without changing its shape, which suits convolutional neural networks.
  4. Judith C. Brown described the constant-Q spectral transform for music in the Journal of the Acoustical Society of America in 1991.
  5. Spotify's Basic Pitch uses a harmonic CQT input to transcribe audio to MIDI with fewer than 17,000 model parameters.

심층 분석

A spectrogram shows how much energy a sound has at each frequency over time. The usual way to compute one is the short-time Fourier transform (STFT), which cuts audio into frames and measures energy in frequency bins spaced evenly in hertz, for example every 10.8 Hz. Music does not work in even steps. Each octave doubles the frequency, and Western tuning splits the octave into 12 semitones, each about 5.9% higher than the last. Near the bottom of a piano, adjacent notes C1 and C#1 are only 1.9 Hz apart, while near the top they are more than 200 Hz apart. An evenly spaced spectrogram therefore blurs low notes together and spends many bins between high notes. The constant-Q transform fixes this by spacing bins geometrically: every bin is a fixed ratio above the previous one, so each bin can sit exactly on a musical note.

The name comes from the quality factor Q, the ratio of a bin's center frequency to its bandwidth. In the CQT every bin has the same Q, so bandwidth grows in proportion to frequency. To measure a narrow band precisely you must listen for longer, so low bins use long analysis windows and high bins use short ones. Step by step, the computation is: choose a lowest frequency, such as C1 at 32.70 Hz; choose bins per octave, typically 12 for semitones or 36 to 60 for finer pitch detail; place each center frequency a factor of two to the power of one over the bins-per-octave above the last; give each bin a window whose length is Q times the sample rate divided by its center frequency; and at regular time steps, multiply the audio by each bin's windowed complex sinusoid and sum, which yields the magnitude and phase of that note at that moment.

The idea was formalized for music by Judith C. Brown in "Calculation of a Constant Q Spectral Transform", published in the Journal of the Acoustical Society of America in 1991 (volume 89, pages 425 to 434). Her MIT Media Lab page still hosts Matlab code for the direct method. Computing every bin with its own long window was slow, so later work focused on efficiency. Christian Schörkhuber and Anssi Klapuri's 2010 constant-Q toolbox, the method cited by librosa, computes the top octave and then repeatedly halves the sample rate to compute each lower octave cheaply. In 2011 Gino Angelo Velasco, Nicki Holighaus, Monika Dörfler and Thomas Grill showed at the DAFx conference how to build a perfectly invertible CQT using nonstationary Gabor frames, the basis of MATLAB's cqt and icqt functions.

Deep learning gave the CQT a new role. A convolutional neural network learns small patterns and slides them across an image. On a CQT, playing the same chord in a different key moves the whole pattern by a fixed number of bins without changing its shape, so one learned filter recognizes the chord in every key. On a linear spectrogram the spacing between harmonics changes with pitch, so that trick fails. In 2017 Rachel Bittner and colleagues at New York University introduced the harmonic CQT (HCQT), a stack of CQTs whose lowest frequencies are multiplied by 0.5, 1, 2, 3, 4 and 5, so a note's overtones line up in the same position across layers, like the color channels of an image. Spotify's Basic Pitch, released in June 2022, uses this input to transcribe polyphonic audio to MIDI with fewer than 17,000 parameters and under 20 MB of peak memory.

Compared with the alternatives, the CQT's strength is pitch alignment and its cost is everything else. The STFT is fast, simple and exactly invertible but has the wrong frequency layout for notes. The mel spectrogram, widely used for speech, compresses frequency on a perceptual scale that is nearly linear at low frequencies, so its bins do not fall on musical notes. Chroma features, often computed from a CQT, fold all octaves into 12 pitch classes, which helps chord and key detection but discards which octave a note is in. Learned front ends let a network discover its own filters, at the price of more data and less interpretability.

The CQT has real limitations. Long low-frequency windows smear time: with 12 bins per octave at a 22,050 Hz sample rate, the window for C1 is about 11,300 samples, roughly half a second, so fast bass notes and drum hits blur at the bottom of the picture while the top is sharp. Classical implementations were not invertible, which mattered for editing and source separation until frame-based methods like Velasco's appeared. Computation is heavier than an STFT; the nnAudio authors measured librosa taking about 103 seconds for 1,770 piano recordings on a CPU, against 0.26 seconds for their GPU version. Tuning matters too: a recording tuned slightly away from A at 440 Hz puts notes between bins unless the transform is shifted to match.

In practice the CQT is cheap to try. librosa computes it with one function call, with defaults of a 512-sample hop, 84 bins and 12 bins per octave from C1 nnAudio and similar libraries compute it on a GPU as a layer of the network, which avoids storing spectrograms on disk and makes the filters trainable. The main design choices are the lowest frequency, the number of octaves, bins per octave, which trades pitch precision against time precision, and hop size. The 2017 deep salience model, for example, used 60 bins per octave, 20 cents per bin, to track fine pitch, while tasks that only need note names can use 12.

04실제 사례

Find a note in a CQT with librosa

  1. Generate or record a 2-second tone at 440 Hz (the A above middle C) sampled at 22,050 Hz.

  2. Compute C = librosa.cqt(y, sr=22050), keeping the defaults: hop 512, lowest frequency C1 at 32.70 Hz, 84 bins, 12 per octave.

  3. Take magnitudes with numpy.abs(C) and convert to decibels with librosa.amplitude_to_db.

  4. Predict the bright row: A4 is 45 semitones above C1 (36 to reach C4, plus 9 to A4), so expect bin index 45.

  5. Check with librosa.cqt_frequencies(84, fmin=librosa.note_to_hz('C1')), whose entry 45 should be about 440 Hz.

  6. Repeat with a 466.16 Hz tone (A#4) and confirm the bright row moves up by exactly one bin.

그것이 보여주는 것

A CQT image with a single bright horizontal line at bin 45 that moves one bin per semitone. Checking that the predicted and observed bins agree confirms the geometric spacing, and comparing the sharpness of a low note with a high note shows the time-frequency trade-off.

실제 구현

Spotify's open-source Basic Pitch, released in June 2022, converts recordings of many instruments, including voice, into MIDI using a harmonic CQT input and a model with fewer than 17,000 parameters.

The deep salience model from NYU (ISMIR 2017) estimates melodies and multiple pitches from a harmonic CQT of 6 octaves at 60 bins per octave, starting at C1 (32.7 Hz).

The librosa Python library's cqt function is a common starting point for music research, by default producing 84 semitone bins, seven octaves upward from C1.

The nnAudio toolbox computes the CQT on a GPU inside a neural network, which its authors measured at roughly 400 times faster than librosa on a set of 1,770 piano recordings.

MATLAB's cqt and icqt functions provide an invertible CQT, so an engineer can edit a sound in the note-aligned domain, for example removing one pitch, and convert it back to audio.

오디오를 위한 Constant-Q 변환의 미래

Current research uses the CQT less as a final feature and more as a structured input or a layer inside networks. Since nnAudio (2019) made GPU and trainable CQT layers practical, models can start from note-aligned filters and fine-tune them during training. The harmonic CQT introduced at ISMIR 2017 and reused in Spotify's Basic Pitch in 2022 shows a continuing trend toward representations that encode musical structure so that smaller models suffice; Basic Pitch runs faster than real time on most modern computers according to Spotify. Open problems remain. The trade-off between time and frequency resolution at low frequencies is fundamental, so fast bass lines and percussion stay blurred unless combined with another representation. Non-Western music that uses intervals other than 12 equal semitones does not map neatly onto standard bin spacings, although finer bins and adjustable tuning partly address this. Invertible CQTs based on nonstationary Gabor frames, available in MATLAB and other toolboxes, make note-domain editing and separation possible, but how they compare with learned encoders for generative music models is still being studied rather than settled.

실천에 옮기기

왜 중요한가요?

  • 접근 및 도달. 전사, 내레이션, 음성 인터페이스를 통해 접근성을 향상시킵니다.
  • 비용 및 예산. 미디어 팀은 더 적은 예산으로 세련된 오디오를 더 빠르게 출시할 수 있습니다.
  • 속도와 규모. 고객 대면 시스템은 음성 상호 작용을 더 큰 규모로 처리할 수 있습니다.

조심하세요

  • 동의가 없으면 음성 오용 및 명의 도용 위험이 높아집니다.
  • 악센트, 방언 또는 시끄러운 환경에서는 정확도가 떨어질 수 있습니다.
  • 합성 오디오는 명확한 라벨링이 없으면 실제 음성으로 오인될 수 있습니다.

다음 단계

  1. 음성 캡처, 복제 및 재사용에 대한 명시적인 동의를 얻습니다.
  2. 다양한 화자와 배경 조건에서 품질을 테스트합니다.
  3. 사람이 출력을 검토하거나 승인해야 하는 시기를 정의합니다.
  4. 합성 오디오에 라벨을 붙이고 책임을 묻기 위해 출처 기록을 보관하세요.

출처 및 추가 자료

  1. MIT Media Lab, Judith C. BrownConstant Q Transform (Matlab code and reference to Brown 1991)
  2. librosa documentationlibrosa.cqt
  3. DAFx 2011Constructing an invertible constant-Q transform with nonstationary Gabor frames
  4. MathWorkscqt: Constant-Q nonstationary Gabor transform
  5. ISMIR 2017Deep Salience Representations for F0 Estimation in Polyphonic Music
  6. Spotify EngineeringMeet Basic Pitch: Spotify's Open Source Audio-to-MIDI Converter
  7. arXiv (IEEE Access)nnAudio: An on-the-fly GPU Audio to Spectrogram Conversion Toolbox Using 1D Convolution Neural Networks

계속 탐색하세요

무료 뉴스레터

일일 AI 브리핑 받기

매주 평일 아침마다 3개의 검증된 AI 스토리를 일반 영어로 작성합니다. 무료이며, 광고 없음.

매주 평일마다 한 번 이메일을 받습니다. 한 번 클릭으로 구독 해지. 주소를 판매하거나 공유하지 않습니다.

자신을 테스트해 보세요

Take the Constant-Q Transform for Audio quiz

모든 답변에 즉각적인 피드백과, 과정을 통과하면 검증 가능한 ID가 있는 공유 가능한 인증서를 제공합니다.

퀴즈 시작

무료 AI 교육을 지원합니다. AI Understanding는 501(c)(3) 비영리 단체입니다 — 광고 없음, 유료 장벽 없음, 영원히. 기부하기

자주 묻는 질문

오디오용 Constant-Q 변환이란 무엇입니까?

The constant-Q transform (CQT) turns audio into a time-frequency picture whose frequency bins are spaced like musical notes, a fixed number per octave, instead of evenly in hertz like the Fourier transform. Because a change of key simply slides the picture up or down, the CQT is a standard input for music transcription, pitch tracking and chord recognition models.

Constant-Q 변환에서 주파수 빈의 간격은 어떻게 되나요?

CQT는 로그 간격 빈을 사용하므로 표준 FFT의 선형 간격과 달리 각 빈은 음악적 피치 간격에 해당합니다.

Constant-Q에서 'Q'는 무엇을 의미하나요?

Q는 필터의 중심 주파수와 대역폭의 비율이며 CQT는 모든 빈에서 이 비율을 일정하게 유지합니다.

CQT가 낮은 주파수에서 더 긴 분석 창을 사용하는 이유는 무엇입니까?

낮은 음표는 절대 헤르츠 단위로 서로 매우 가깝기 때문에 창이 길수록 이를 분리하는 데 필요한 미세한 주파수 분해능이 제공됩니다.

What happens to a CQT pitch pattern when a chord is transposed up one octave?

Because CQT bins are logarithmically spaced, doubling every frequency shifts a pattern by a fixed number of bins equal to the bins per octave.

옥타브당 몇 개의 CQT 빈이 반음과 정렬하는 데 일반적으로 사용됩니까?

옥타브당 12개의 빈은 각 빈을 서부 반음계의 반음에 맞춰 정렬합니다. 24개 빈은 1/4톤 해상도를 제공합니다.